Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js var vs const

//var variables can be re-declared and updated
    var greeter = "hey hi";
    var greeter = "say Hello instead";
//it becomes a problem when you do not realize that a variable 
//greeter has already been defined before.

//const declarations are block scoped
//const cannot be updated or re-declared
	const greeting = "say Hi";
	greeting = "say Hello instead";// error: Assignment to constant variable. 

	const greeting = "say Hi";
	const greeting = "say Hello instead";// error: Identifier 'greeting' has already been declared
Comment

PREVIOUS NEXT
Code Example
Javascript :: read image metadata javascript 
Javascript :: mongoose show all indexes 
Javascript :: jquery checkbox group selected value 
Javascript :: how to disable right click of mouse on web page 
Javascript :: jest Your test suite must contain at least one test. 
Javascript :: moment diff 
Javascript :: javascript promise example basic 
Javascript :: js blur element 
Javascript :: toastandroid react native 
Javascript :: jquery form submit 
Javascript :: slide hide animaition in react 
Javascript :: nodejs: http:send HTML to the Browser 
Javascript :: jquery dropdown selected value show field 
Javascript :: JavaScript .clearRect 
Javascript :: find element by object field vuejs 
Javascript :: javascript variable 
Javascript :: async function in javascript 
Javascript :: react-select 
Javascript :: convert json into map in java example 
Javascript :: using regex in javascript 
Javascript :: reset select2 jquery | clear select2 option value 
Javascript :: app bar in react native 
Javascript :: create empty json file python 
Javascript :: nested function javascript 
Javascript :: pause javascript 
Javascript :: string length in javascript 
Javascript :: radio button checked jquery 
Javascript :: let var diferencia 
Javascript :: send variable to javascript promise 
Javascript :: some method javascript 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =