Answers for "var = {} js"

6

javascript variable

var user_name = prompt("Please enter your name:", "Type here");
alert("Hello " + user_name);
Posted by: Guest on November-03-2020
0

var = {} js

//An array is a type of object intended to be only assigned numeric keys
var tmp = []; // or: var tmp = {}
tmp.one = 1;
JSON.stringify(tmp);

// array:
'[]'

// object:
'{"one":1}'
Posted by: Guest on December-04-2020
0

js variables

// Can be a number
var myVar = 21
//Can be a string
var myVar2 = "string"
// Used in a function
function printVar(parvar) {
  print(parvar);
}

printVar(myVar2);
// prints "string"
printVar(myVar);
// prints 21
Posted by: Guest on July-31-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language