xxxxxxxxxx
function list() {
return Array.prototype.slice.call(arguments)
}
let list1 = list({0:"zero"}, {1:"one"}, {2:"two"}) //[ { '0': 'zero' }, { '1': 'one' }, { '2': 'two' } ]
console.log(list1);
let list2 = list({0:{z:"zero"}, 1:{o:"one"}});
console.log(list2) //[ { '0': { z: 'zero' }, '1': { o: 'one' } } ]
xxxxxxxxxx
// JSON string representing the object
$jsonString = '{"name":"John","age":30,"city":"New York"}';
// Convert JSON string to an associative array
$array = json_decode($jsonString, true);
// Print the resulting array
print_r($array);
xxxxxxxxxx
var j = {0: "Hello", 1: " ", 2: "World", 3: "!"};
console.log(Object.values(j))
// Object.values(j) = ["Hello"," ","World","!"]
xxxxxxxxxx
const responseTypes = {
json: 'application/json',
text: 'text/*',
formData: 'multipart/form-data',
arrayBuffer: '*/*',
blob: '*/*'
};
console.log(Object.entries(responseTypes));
/*[each of the json key value becomes an array ]*/