This article is a recap from the youtube Talk “JS WAT Talk Reup”, which shows that Javascript has some weird things and also its powerful strengths (syntax flexibility).
Array Plus Array
[] + [] evaluates to empty string
Array Plus Object
[] + {} evaluates to [object Object]
Object Plus Array
{} + [] evaluates to 0
Object Plus Object
{} + {} evaluates to NaN
NaN join
Array(5).join(“a” – 1) + ” man” evaluates to NaNNaNNaNNaN man
Also: typeof this (inside String.prototype function) equals to “object” instead of “string”.
–EOF (The Ultimate Computing & Technology Blog) —
GD Star Rating
loading...
196 wordsloading...
Last Post: Disable Spam Comments in WordPress by Checking Referer
Next Post: Shell Coding Exercise - Word Frequency