🔰initial value
🚧 施工中
Last updated
Was this helpful?
🚧 施工中
Last updated
Was this helpful?
Was this helpful?
variable declaration can assign a value to a variable.
let i = 0, j = 0, k = 0; // ⭐ in a single declaration
let [u, v] = [3, 4]; // 💡 destructuring assignment
let x = 2, y = x * x; // ✅ use "previously declared"
let [p, q, ...rest] = [10, 20, 30, 40, 50]; // "rest" operator
// ❌ "destructuring assignment" can't use "previous element"
let [a, b] = [ 2, a * a ]; // ⛔ ReferenceError
const must be declared with an initial value❗
if you don't specify an initial value for a , its will be assigned automatically.
- declaration hoisted, value initialized to "".
- declaration hoisted, value "
const requires initialization - must have with initial value❗️
function hoisting - declaration hoisted, value initialized to a function.