the neccesary name or age;It seems theres SyntaxError which i cant find.Can you guys help me? :(
const data=[
{name:"vica",age:12},
{name:"ani",age:23},
{name:"arpush",age:78}
]
function find(...args){
if(typeof(args[0] === "number") {
return data.filter(obj => obj.age === args[0]);
} else {
return data.filter(obj => obj.name === args[0]);
}
}
alert(JSON.stringify(find("vica")));
alert(JSON.stringify(find(19)));
Download VScode, install prettier and paste this code creating new file
That's how you find syntax error
if (typeof(args[0] === "number"))
try eslint, you can't be the real js dev without it.
Does that mean before eslint JavaScript developers didn't exist
sorry whats that for? :D i ust opened and curios what is this for
Standardizing code across a team
Обсуждают сегодня