javascript 判断变量是否存在

var myFun = new Function("5+2")
var shape="round"
var size=1
var today=new Date()

The typeof operator returns the following results for these variables:

typeof myFun == 'function'   
typeof shape == 'string'
typeof size == 'number'
typeof today == 'object'
typeof dontExist == 'undefined'
原文地址:https://www.cnblogs.com/kevinge/p/1773750.html