“Zmienna LET nie jest zdefiniowana” Kod odpowiedzi

Zmienna LET nie jest zdefiniowana


let to_date = to ? moment(to) : null;

Jealous Jay

Zmienna LET nie jest zdefiniowana

function a () {
    let ar = 1
}

console.log(ar);

//console: TypeError: ar is not defined

/*
let and const are local variables, that means, if declared on function, then you will
not be able to use the variable, you must use it inside the function or declare
the variable in the file and not a local function
*/

function a () {
    let ar = 1
    
    console.log(ar);
}

const ar = 1
console.log(ar);

//console: 1 1
Eager Eel

Odpowiedzi podobne do “Zmienna LET nie jest zdefiniowana”

Pytania podobne do “Zmienna LET nie jest zdefiniowana”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu