an interesting elaboration why using classes in JavaScript is an anti-pattern in some cases
Towards class-less JavaScript · Markus Tacker · Software Crafter
Dependency Injection without classes - Fun Fun Function - YouTube
Saturday, April 27, 2019
await fetch in Chrome dev tools console
Here is a simple way to get data from a web URL in Chrome dev tools console.
Since fetch() is an async function that returns a javascript promise, need to use await keyword, that is now supported by Chrome dev tools console.
Since fetch() is an async function that returns a javascript promise, need to use await keyword, that is now supported by Chrome dev tools console.
await fetch('https://jsonplaceholder.typicode.com/posts').then(r => r.json())and to make result data nicely formatted as a table:
await fetch('https://jsonplaceholder.typicode.com/posts').then(r => r.json()).then(console.table)
Chrome/Firefox console.table()
Console.table() - Web APIs | MDN
Console API Reference | Tools for Web Developers | Google Developers
Console Overview | Tools for Web Developers | Google Developers
// an array of arrays
var people = [["John", "Smith"], ["Jane", "Doe"], ["Emily", "Jones"]]
console.table(people);
Console API Reference | Tools for Web Developers | Google Developers
console.table([
{
first: 'René',
last: 'Magritte',
},
{
first: 'Chaim',
last: 'Soutine',
birthday: '18930113',
},
{
first: 'Henri',
last: 'Matisse',
}
])
Console Overview | Tools for Web Developers | Google Developers
Subscribe to:
Posts (Atom)