how do i assign variable in javascript code example
Example 1: how to add a variable in js
var x = 5; // assign the value 5 to x
Example 2: 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