MkyTaP - 開發筆記
主要工具: Linux, Python, SQL
Monday, March 19, 2018
javascript: 檢查變量是不是undefined
如果想檢查變量是不是underfined,可以用typeof 來取得變量的類型字串。
if (typeof myObject !== "undefined") {
alert('myObject is existed');
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment