how to create a variable in javascript
//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//let and var are both editable variables and can be changed later on in your program;
let dog = 'Woof';
//dog is equal to the string 'Woof';
dog = false;
//You can changed the value of dog now because it was defined with let and not const;
let cow = 'Moo';
//cow is equal to the string 'Moo';
cow = true;
//You can change the value of cow later on because it is not defined with const;
//const is used when declaring a variable that can't be changed later on -- const stands for constant;
const pig = 'oink';
//This assigns the string 'oink' to pig which can not be changed because it is defined with const;
pig = 'snort';
//Above throws an error
//Good Job you now know how to declare variables using JavaScript!!!// write what ever you want
// one way is
// this is to declare intigers
var a = 10;
//this is to declare strings aka words
var b = "hi";
// the key word var can be replaced by let
//like this
let a = 10;
let b = "hi";
// i recomend using let insted of var
Also in JavaScript:
- terser plugin Cannot read property 'javascript' of undefined
- angularjs show form validation errors
- events in javascript
- javascript get all cookies
- what is JSON TREE
- vuetify use selected value
- how to collect keys using lodash javascript
- expressjs cheat sheet
- loop through json array python
- how to code a minecraft json file mod
- javascript count digits
- how to get data in json format in javascript
- pass value from one component to another in polymer
- javascript vs java
- js canvas fill color
- fetch data from external url nodejs
- filter keys from object using ramda
- catch statement javascript
- date difference
- how to add links in react js
- onchange value in hidden input
- angular pipe first letter uppercase
- javascript online test
- How to hthe amount of users online in discordjs