1. Write a JavaScript that shows how a variable’s type can be changed on-the-fly.
<!-- --------------------------------------------------------------------------------------------------------------------------------- HTTP://WWW.GTUMCA.CO.CC ---share your college materials on --- [email protected] JOIN US ON FACEBOOK: with more than 1000 GTU MCA FRIENDS TWITTER @MCAGTU ---------------------------------------------------------------------------------------------------------------------------------------> <HTML> <head> <script language="javascript"> var a=10; document.write("var a=10; typeof(a)=> "+ typeof(a)); var name="www.gtumca.co.cc"; document.write("<br>var name=\"GTUMCA.CO.CC\"; typeof(name)=> "+ typeof(name)); </script> </head> <body> </body> </HTML>
2. Write a JavaScript that demonstrates the use of +=,-=,*=,/= operators.
<!-- --------------------------------------------------------------------------------------------------------------------------------- HTTP://WWW.GTUMCA.CO.CC ---share your college materials on --- [email protected] JOIN US ON FACEBOOK: with more than 1000 GTU MCA FRIENDS TWITTER @MCAGTU ---------------------------------------------------------------------------------------------------------------------------------------> <HTML> <head> <script language="javascript"> var a=10;
document.write("<br>* var a=10;"); a+=2; document.write("<br>* a+=2   "+ a);