Answers for "variable in js"

41

javascript declare a variable

//choose the best for your solution
var myVariable = 22; //this can be a string or number. var is globally defined

let myVariable = 22; //this can be a string or number. let is block scoped

const myVariable = 22; //this can be a string or number. const is block scoped and can't be reassigned
Posted by: Guest on March-09-2020
4

how to change a variables value in javascript

var variable = 10;

function start() {
  variable = 20;
}
console.log(variable + 20);

// Answer will be 40 since the variable was changed in the function
Posted by: Guest on March-19-2020
3

how to write a variable in js

//choose the best for your solution
var myVariable = 22; //this can be a string or number. var is globally defined

let myVariable = 22; //this can be a string or number. let is block scoped

const myVariable = 22; //this can be a string or number. const is block scoped and
Posted by: Guest on June-03-2020
6

js variable

var Number = 5;
var String = "Hi!";
var boolen1 = true;
var boolen2 = false;
var array = [11, "Hi!", true];
var object = {age:11, speach:"Hi!", likes_Bananas:true};
Posted by: Guest on June-21-2020
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

variable in js

////We can define variables in 3 ways {var,let,const}/////// 
////syntax- var variable_name=value;
/////  let variable_name=value;
/////const variable_name=value;

var myfristvariable="neha jaiswal";
const mysecondvariable=80;
let mythirdvar=abc;
Posted by: Guest on January-24-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language