Skip to content

Instantly share code, notes, and snippets.

View dikshadhote's full-sized avatar

Diksha Dhote dikshadhote

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Everyone has story to tell</title>
<h1>Everyone has story to tell</h1>
</head>
<body>
@dikshadhote
dikshadhote / Scope of variable
Last active June 6, 2022 04:06
Scope of variable in js
var number = 4;
function test()
{
if (number ==8) {
var number = 16;
}
console.log(number );
}
test();
var number = 4;
function test()
{
console.log(number );
}
test();
var number = 4;
function test()
{
(function() {
if (number ==8) {
var number = 16;
}
})();
console.log(number );
}
@dikshadhote
dikshadhote / lexical environment
Created June 6, 2022 17:35
lexical environment
function outerFunc(){
var a=7;
function innerFunc(){
console.log(a)
}
return innerFunc;
}
var output= outerFunc();
console.log(output);
function outerFunc(){
var a=7;
function innerFunc(){
console.log(a)
}
a=100
return innerFunc;
}
var output= outerFunc();