Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

var vs let js

let: //only available inside the scope it's declared, like in "for" loop, 
var: //accessed outside the loop "for"
Comment

difference between let and var in javascript

//let
1. It's used in block-scoped.
2. It does not allow to redeclare variables.	
3. Hoisting does not occur in let.
// var 
1. It's used in function scoped.
2. It allows to redeclare variables.
3. Hoisting occurs in var.
Comment

js var vs let

let = 10 // accessable only in defined scope
var = 10 // accessable in the function it is declared in (global variable in a function)
  
Comment

what to use let vs var js

/* DIFFERENCE BETWEEN LET AND VAR */

//LET EXAMPLE
{
  let a = 123;
};

console.log(a); // undefined

//VAR EXAMPLE
{
  var a = 123;
};

console.log(a); // 123
Comment

var vs let javascript

var makes a grobal variable
let makes a local variable
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript arr.flat 
Javascript :: react router remove location state on refresh 
Javascript :: agregar atributo con id jquery 
Javascript :: check if s3 bucket exists in lambda 
Javascript :: aes 256 file encryption node js 
Javascript :: The element.parentNode Property 
Javascript :: projection in mongodb 
Javascript :: compare date and time in js 
Javascript :: react enzyme 
Javascript :: get year from date in mongodb 
Javascript :: get current location city name react native 
Javascript :: change terminal shortcut vscode 
Javascript :: npm install could not resolve peerDependencies 
Javascript :: how to insert with variables from js to mysql 
Javascript :: node powershell 
Javascript :: convert string to lowercase javascript 
Javascript :: mongoose find multiple and delete 
Javascript :: javascript get cursor position without event 
Javascript :: add line number in javascript 
Javascript :: react owl-carousel 
Javascript :: vue dynamic routes with parameters 
Javascript :: vuelidate required if another props 
Javascript :: url encoded body in node.js 
Javascript :: array javascript 
Javascript :: template literals in javascript 
Javascript :: how to make button in react js 
Javascript :: validation in react native 
Javascript :: nuxt js file other site 
Javascript :: electron js execute command 
Javascript :: how to import json data from a local file 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =