Answers for "how to assign a variable in javascript"

1

how to add a variable in js

var x = 5;         // assign the value 5 to x
Posted by: Guest on November-26-2020
0

how to add a variable in js

var x = 5;         // assign the value 5 to x
Posted by: Guest on November-26-2020
1

how to assign variables in javascript

// data from json: resp = {"home": 1, "landmark": 2}
// Method 1: 
// use ` for add variable
url = `workspace/detail/${resp.home}`;
console.log(url) -> // workspace/detail/1
  
// Method 2: 
// use ' and + for concentrace variable
url = 'workspace/detail/' + resp.home;
console.log(url) -> // workspace/detail/1
Posted by: Guest on March-25-2021
0

how to create a variable in javascript

// you an pass in strings or a number 

var exampleVariable = 'Example string' // this is a normal string 
var anotherExample = 839;
Posted by: Guest on June-25-2021

Code answers related to "how to assign a variable in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language