首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

javascript当中局部变量和全局变量

2)局部变量和全局变量 浏览器里面 window 就是 global,通常可以省。 nodejs 里没有 window,但是有个叫 global 的。 例 3.2.1 <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <script> /* 有var无var, 在function外是一样的,都是全局的,在function里面时,var是局部的,而无var时是代表全局的*/ var testVar = "全量"; document.writeln("window.testVar is" + window.testVar+testVar); var testqVar = "全量q"; /*如不屏蔽下句话,程序直接停在这了,因为出错了,不认识testGlobal,得把下一句和下下句换一下位置,就ok了 */ // document.writeln("testGlobal is" + testGlobal); testGlobal = "全量global"; document.writeln("abc is" + abc); var abc; testGlobalInVar = "全量globalInVar"; function testSco() { var lll = "qqq"; var testVar = "局量"; //此testVar非外面的testVar testqVar = "全量qchange"; //此testqVar就是外面的testqVar testGlobal = "全量globalchange"; var testGlobalInVar = "局量global";//此testGlobalInVar非外面的testGlobalInVar /*local variable is stronger than global variable.so "testVar" in the following statement means local variable.*/ document.writeln(testVar); document.writeln(testqVar); document.writeln("testGlobalInVar is " + testGlobalInVar); } testSco(); document.writeln("second test is " + testVar); document.writeln("second testqVar is " + testqVar); document.writeln("testGlobal is " + testGlobal); document.writeln("testGlobalInVar is " + testGlobalInVar); </script>

00
您找到你想要的搜索结果了吗?
是的
没有找到

像经典计算机一样「开箱即用」,百度走出中国量子计算产业化的重要一步

机器之心原创 作者:杜伟 在这场开发者大会上,百度向世人展示了自己的量子计算发展之路。 二十世纪初德国物理学家、量子力学创始人马克斯·普朗克通过普朗克公式描述了黑体辐射,拉开了第一次量子革命的序幕。之后,爱因斯坦、海森堡、薛定谔、玻尔等物理学家完善了量子力学的理论框架,并催生核能、核磁共振、晶体管、激光等应用。第一次量子革命赋予了人类掌控物理现实世界的规则,深刻改变了生产生活,带来物质文明的极大进步。 2003 年,已故爱尔兰裔美国理论物理学家 Jonathan Dowling 和澳大利亚理论物理学家Ger

01
领券