1. 變數宣告方式
使用 let 宣告變數,可以重新賦值。
使用 const 宣告常數,不可重新賦值。
123let apple = 4; // 宣告 apple 變數,值為 4const pi = 3.14; // 宣告 pi 常數,值為 3.14
2. 變數命名規則
不能以數字開頭
❌ let 1apple = 3;
✅ let apple1 = 3;
大小寫敏感
123456let name = "小熊";let Name = "大熊";console.log(name); // 小熊console.log(Name); // 大熊
不能使用保留字(如 let, if, for 等)
3. 在瀏覽器 Console 中使用變數
變數只會在 當前頁面與當前 Console session 存在。
重新整理頁面或開新分頁,變數會消失。
如果已經宣告過 let,再次賦值時 不需要重複宣告。
1234let count = 10; // 第一次要用 letcount = 20; // 之後改值,不需 ...
title: Hello Worldcategories: Hexo,前端Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post1$ hexo new "My New Post"
More info: Writing
Run server1$ hexo server
More info: Server
Generate static files1$ hexo generate
More info: Generating
Deploy to remote sites1$ hexo deploy
More info: Deployment









