You can output a hash as a table in the browser console with console.table
:
const inventors = [
{ first: 'Albert', last: 'Einstein', year: 1879 },
{ first: 'Isaac', last: 'Newton', year: 1643 },
{ first: 'Galileo', last: 'Galilei', year: 1564 },
];
console.table(inventors);
You can right click an object in the console and select the menu option store as global variable
.
This will output a variable like temp1
to the console.
You can then JSON.stringify(temp1)
.
function randomIntFromInterval(min, max) { // min and max included
return Math.floor(Math.random() * (max - min + 1) + min);
}
myArray[Math.floor(Math.random() * myArray.length)];