JavaScript Check if Variable is Object
home
Run
screen_rotation
fullscreen
cloud_download
navigate_before
<html> <head> <title>Javascript Demo</title> <script type='text/javascript'> function checkobject(){ var myCar = {type:"Hundai", model:"1000", color:"white"}; if(myCar instanceof Object == true){ alert("Object"); }else{ alert("Not Object"); } } </script> </head> <body> myCar = {type:"Hundai", model:"1000", color:"white"}; <a href="javascript:void(0)" onclick=" checkobject()">Check Object-</a> <p id='result'></p> </body> </html>
<html> <head> <title>Javascript Demo</title> <script type='text/javascript'> function checkobject(){ var myCar = {type:"Hundai", model:"1000", color:"white"}; if(myCar instanceof Object == true){ alert("Object"); }else{ alert("Not Object"); } } </script> </head> <body> myCar = {type:"Hundai", model:"1000", color:"white"}; <a href="javascript:void(0)" onclick=" checkobject()">Check Object-</a> <p id='result'></p> </body> </html>
Copyrights@tutorialsplane.com