js var
var a;
console.log(a); // scrive in console "undefined" o "" a seconda del browser usato.
console.log('still going...'); // scrive in console "still going...".
js var
var a;
console.log(a); // scrive in console "undefined" o "" a seconda del browser usato.
console.log('still going...'); // scrive in console "still going...".
js var
var x = y, y = 'A';
console.log(x + y); // non definito
how to declare variables javascript
//variables are a way to easily store data in javascript
//variables are declared by the var keyword, example...
var x = 10;
//or
var dog_name = "daisy";
//which can also be written as
var dog_name = 'daisy';
//same thing with single quotes and double quotes
js variables
// 3 ways to create
var mrVariable = 'x'; // You can set it to to a string ( '' ) or no. ( 0 ). It
// is globally defined
let myVariaible2 = 'y'; // You can set it to string or no. let is block scoped
const myVariable = 'z'; // It is block scoped, can be a string or no. and can't
//be reassigned
js var
function x() {
y = 1; // Genera un ReferenceError in strict mode
var z = 2;
}
x();
console.log(y); // scrive "1" in console
console.log(z); // Genera un ReferenceError: z non è definita fuori dalla funzione x
js var
var nomevariabile1 [= valore1] [, nomevariabile2 [= valore2] ... [, nomevariabileN [= valoreN]]];
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us