https://github.com/agent-006/javascriptinterview
https://github.com/agent-006/javascriptinterview
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/agent-006/javascriptinterview
- Owner: Agent-006
- Created: 2023-12-27T10:35:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-14T15:04:54.000Z (over 2 years ago)
- Last Synced: 2025-11-21T20:04:04.772Z (7 months ago)
- Language: JavaScript
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
JavaScript
๐Note: ๐ฏ --> means basic topics.
๐ฏ ---> means advanced topics
๐ฏ word vs keyword โ
--> Anything that doesn't have it's meaning in JavaScript is known as a 'word'.
Anything that have some meaning in JavaScript is known as a 'keyword'.
๐ฏ var vs const vs let โ
-->
๐ variable - Is is a container which is used to store data in
programming or code that may change in future (code
mein koi bhi data store karne ke liye jiska use hota hai
use kahte hai variable).
โญExmp:
var dulha = "Lab";
var dulhan = "Laby";
๐ constant - It is also used for storing data but, the data can't be changed in future.
โญExmp:
const dulha = "Lab";
const dulhan = "Laby";
๐ let - It is also used for storing data.
โญExmp:
let dulha = "Lab";
let dulhan = "Laby";
dulha = "Haraamzada"; // This will throw an error if const is used.
console.log(dulha + " weds " + dulhan);
๐ฏ the difference โ
---> There are two versions of JavaScript ES5 and ES6. ES5 is the old version of JavaScript
which only have 'var'. In ES6 we have both 'let' and 'const'.
๐Note: We can use both ES5 and ES6 together and at the same time.
๐ var is present in old (ES5) JavaScript\
๐ var is function scoped - 'var' can be anywhere in it's parent function ('var' apne parent
function me kahi bhi use ho sakta hai).
โญExmp:
function abcd() {
for (var i = 1; i < 12; i++) {
console.log(i); // This will print 1 to 11
}
console.log(i); // As 'var' is function scoped, 'var' can be used in it's parent function. So, now 'i' holds the value '12' and it will print '12'
}
abcd();
๐ The final output will be: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
๐ var adds itself to the window object
โญExmp:
var a = 12; // Open inspect element, then console and type window, then unfold the window object
๐ let & const is present in new JavaScript
๐ let & const is braces scoped
โญExmp:
function abcd() {
for (let i = 0; i < 12; i++) {
console.log(i); // This will print 1 to 11
}
// console.log(i); // This will throw an error as 'i' is not defined
}
abcd();
๐ The final output will be: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
๐ let & const doesn't adds itself to the window object
โญExmp:
let a = 12; // Open inspect element, then console and type window, then unfold the window object
const b = 12; // Open inspect element, then console and type window, then unfold the window object
๐ฏ window object โ
---> In JavaScript there are many features that we can use, there are features that we can use
but, they are not in JavaScript but, JavaScript can use those features through window.\
๐window is a box of features given by the browser to use with JavaScript.
-- browser context api
-- stack
-- heap memory
-- execution context
-- lexical environment
-hoisting
-types in js
-- how to copy reference values
-conditionals
-if else else-if
-- truthy vs falsy
-- switch
-loops
-for while
--foreach forin forof do-while
-functions
--callback funcs
--what is first class funcs
-params, arguments
-arrays
-push pop shift unshift
--how arrays are made behind the scenes
--why we can make negaitve indexes arrays in js
--practice questions and scenarios
-objects
-props vs methods
-updating object porps
--how to delete object prop
--practice questions, scenarios