title | slug |
---|---|
JSMinders |
JSMinders |
Standard foreach loop in JS is:
for(var obj of [{},3,5.3,[9,0],2])
{
if(typeof(obj)==="number") console.log(obj)
}
OR:
[{},3,5.3,[9,0],2].forEach(obj=>
{
if(typeof(obj)==="number") console.log(obj)
})
Completely unnecessary now that we have Object.keys({"key":"val"}).foreach
One example of when you might need == is checking for null/undefined at the same time: myVar == null
See This Table