一、更新變量spa
一個變量被從新賦值以後,原來的值會被覆蓋,以最後一次賦的值爲準code
<script> var username="zhai"; var username="zhang"; alert(username); </script>
二、同時聲明多個變量blog
<script> var address="河南"; var age=12; var name="zhai"; console.log(address); console.log(age); console.log(name); var address="河南",age=12,name="zhai"; console.log(address); console.log(age); console.log(name); </script>
變量之間用逗號分隔ip
三、變量的命名規範console
<script> var uname="zhai"; var uName="zhang" console.log(uname) console.log(uName); </script>
後面的uName並未更新前面的變量,說明大寫和小寫是兩個不一樣的變量class