javascript var
//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 reassignedvar num = 1:var <variable-name>;
var <variable-name> = <value>;
// 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// 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 varvar a = 1;
b = 2;
delete this.a; // Genera un TypeError in strict mode. Altrimenti fallisce senza generare messaggi.
delete this.b;
console.log(a, b); // Genera un ReferenceError.
// La proprietà 'b' è stata cancellata e non esiste più.
Also in JavaScript:
- nodejs current timestamp
- js page reload
- shorthand if statement js
- javascript split string into array by comma and space
- starting with react router dom
- react native passing params to nested navigators
- button style in jquery datatable
- Uncaught ReferenceError: function is not defined at HTMLUnknownElement.onclick
- node command get to much time
- javascript ... operator
- how to show progress on ajax call
- jquery style display
- from json timestamp to date python
- object to json c#
- uncheck checkbox when another is checked javascript
- axios get request javascript stackoverflow
- make angular to run on a different port
- on focused text input style react native
- How to check whether a checkbox is checked in jQuery?
- adonis migration column char
- firestoreConnect query
- jquery wrap inner text
- react native italic text
- how to create an event calendar in javascript