“var funkcja js” Kod odpowiedzi

JS var

var x = 0;

function f() {
  var x = y = 1; // x è dichiarata localmente. y invece no!
}
f();

console.log(x, y); // Genera un ReferenceError in strict mode (y non è definita). 0, 1 altrimenti.
// In modalità non-strict mode:
// x è la globale come si ci aspettava
// però, y è uscita fuori dalla funzione!
DevLorenz02

var JavaScript

var is a keyword to define the varible in js but as of es-6 we, use let and const keywords for the same
Xerothermic Xenomorph

JS var

var a = 'A';
var b = a;

// è come dire:

var a, b = a = 'A';
DevLorenz02

funkcje i zmienne JavaScript

/*A function is like an operation, you pass two or more values/variables 
into it, it will output a value (if return is used).
Also, you will not have to redeclare the parameters if you used arguments. */

/* A global variable can be accessed anywhere including in curly braces { }.
You do not have to list them as an argument however it is recommended */

/*            | scroll down |
              v             v     */

/* You will opt a global variable into an argument if
you want it to become a different variable in the function */

/*Use*/ let /*and*/ const /*more often because it will not allow you to
declare it again*/

/*Parameters are like the placeholder variables for the variables
outside the function being used as arguments*/

// Local variables(like in functions) take priority over global variables

/*The */return/* operator will output a value such as */ 4, "string", 
true /*etc. this will not be assigned to a variable unless you do assign it
yourself. */

/*If a*/ return /*operator is not used  it will change the global variable 
instead (if there is one).*/

// A good explenation on global and local variables is below
('  https://www.youtube.com/watch?v=iJKkZA215tQ  ')
Shiny Salmon

JS var

var a = 0, b = 0;
DevLorenz02

var funkcja js

hi = () => {}
Doubtful Dotterel

Odpowiedzi podobne do “var funkcja js”

Pytania podobne do “var funkcja js”

Więcej pokrewnych odpowiedzi na “var funkcja js” w JavaScript

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

Przeglądaj inne języki kodu