Online since 1990 Yes! I started with Gopher. I do modern Web Component Development with technologies supported by **all** WHATWG partners (Apple, Google, Microsoft & Mozilla)
let dogsNames = Array.from(dogs, ({name}) => name);
is not as complicated as:
let dogsNames = dogs.map( ({name}) => name );
BUT..
the documentation says the y parameter in Array.from(x,y,z) IS a mapFn
So yes, you do not type those 3 letters... but you still have to understand you are mapping an Array.
Since you mention the Performance API; this gives a very interesting result:
letdogs=[{name:"Rio",age:2},{name:"Mac",age:3},{name:"Bruno",age:5},{name:"Jucas",age:10},{name:"Furr",age:8},{name:"Blu",age:7},];functionperformance(method){constfirstTime=performance.now();letdogsNames;for(leti=0;i<10000;i++){if(method==1){dogsNames=Array.from(dogs,({name})=>name);}else{dogsNames=dogs.map(({name})=>name);}}constsecondTime=performance.now();console.log(`The something function took ${secondTime-firstTime} milliseconds.`);}performance(1);performance(2);
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Interesting to learn that:
let dogsNames = Array.from(dogs, ({name}) => name);
is not as complicated as:
let dogsNames = dogs.map( ({name}) => name );
BUT..
the documentation says the y parameter in
Array.from(x,y,z)
IS a mapFnSo yes, you do not type those 3 letters... but you still have to understand you are mapping an Array.
Since you mention the Performance API; this gives a very interesting result: