Answers for "how to declare variables javascript"

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 define variable in javascript

var <variable-name>;

var <variable-name> = <value>;
Posted by: Guest on June-09-2020
2

variable javascript

//You can make a variable by using:
var variable-name = 'defenition of the variable';
// Or you can use
let variable-name = 'defenition of the variable';
Posted by: Guest on May-25-2020
1

js variables

// let & var are both editable variables:
var cow = 'moo';
let pig = 'oink';
cow = 10;
pig = 10;
// const is a permanent variable; you cannot change it.
const uncuttableGrass = '\/\/';
uncuttableGrass = '___';
// above throws an error
Posted by: Guest on June-09-2020
0

variables javascript

var example = "hello";
document.write(example);// it will say hello when it runs
Posted by: Guest on February-25-2021
0

how to declare variables javascript

//variables are a way to easily store data in javascript
//variables are declared by the var keyword, example...
var x = 10;
//or
var dog_name = "daisy";
//which can also be written as 
var dog_name = 'daisy';
//same thing with single quotes and double quotes
Posted by: Guest on July-22-2020

Code answers related to "how to declare variables javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language