JSFiddle - React, Tailwind, and code Playground

by DineshAngappa

JavaScript

var arrVal = [0,1,2];

/*for(var i=0; i< arrVal.length; i++){
 setTimeout(function(){
   console.log(arrVal[i]);
 },1000);
}*/


var myMethod = function(){
  console.log(this)
}

var myObject = {
 myMethod: myMethod,
 a: 5,
 set current(name){
   this.a +=5
 },
 get current(){
   return this.a
 }
}

myObject.current = 6;

//console.log(myObject.a);


myMethod();
myObject.myMethod();

let test;

if(true){
var i =1;
		var j =1;

  test = () =>{
  	
    return () =>{
      console.log(i);
      console.log(j);
      //return i
    }
  }

}

console.log(i);

console.dir(test());

(function(){
  var a = 10;
let a = 20;
function abc(){
  let a =15;
  
  //let a = 20;
  console.log('Inside Function',a);
}

console.dir(this);
console.log('Outside Loop',a);

abc();

console.log('Outside Loop2',a);

})();