Тёмный

[3,4,6,7][1,2,3] = 7? Javascript Tricky Interview question explained by Frontend Master  

Frontend Master
Подписаться 65 тыс.
Просмотров 1,4 тыс.
50% 1

Javascript Interview Questions
My Blogs: / rahuulmiishra
LinkedIn: / rahuulmiishra
Instagram: / allahabadi.dev
#javascript #websuccess #websecurity #html #css #frontend #frontenddeveloper #reactjs #angular #vuejs #reactremix #mobx #redux #reduxtoolkit #allahabadi.dev #rahuulmiishra #frontendmaster #coding #interviewprep #interview #javascriptinterview

Опубликовано:

 

2 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 11   
@shivakumarm6994
@shivakumarm6994 5 месяцев назад
array[index] // index (means one) but not indices/indexes let r = [9, 8, 7, 6][1, 2, 3, 0]; // [array][index] index = 0 1 2 3 // starts with 0 and the increment is 1 console.log(r); When we use the array [1, 2, 3, 0] as an index to access the elements in another array [9, 8, 7, 6], JavaScript does not throw a syntax error but it rather evaluates [1, 2, 3, 0] as an array expression. JS only considers the last element a ‘0’ as the index to access the element in the array [9, 8, 7, 6], and the other elements 1, 2, and 3 are ignored in this context. Output: 9 // Index considered by JS is only the last element, the right extreme One, in this case 0. let r = [9, 8, 7, 6][3] // Output 6 as element at index 3 is 6 index = 0 1 2 3 let r = [9, 8, 7, 6][1, 3] // Output 6 as element at index 3 is 6 let r = [9, 8, 7, 6][1, 0, 3] // Output 6 as element at index 3 is 6 let r = [9, 8, 7, 6][1, 0, 2, 3] // Output 6 as element at index 3 is 6 index = 0 1 2 3 If we need more than one element, use slice(start_Index_include, end_Index_exclude) let r = [9, 8, 7, 6].slice(1, 3); console.log(r) Output: (2) [8, 7] //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function a() {return "a"} function b() {return "b"} function c() {return "c"} console.log(a(), b(), c()); console.log(c(), a(), b()); console.log(b(), c(), a()); Output: a b c c a b b c a
@utkarshpant5297
@utkarshpant5297 8 месяцев назад
Brilliant...
@rushichebale5723
@rushichebale5723 8 месяцев назад
Keep going sir . I like the way you teach and do some xss attack in real time
@alokapsensys
@alokapsensys 4 месяца назад
could you please answer what will be output for this let b = [14,15,8,115][1,2,3][1]; console.log(b); as per your statement the value of b should be 8 but it is undefind why??
@rahuulmiishra
@rahuulmiishra 4 месяца назад
good question but why do you think it should be 8
@alokapsensys
@alokapsensys 4 месяца назад
@@rahuulmiishra because 1st it will get value 2 as it is index 1 of 2nd array and then it will retrive value from 1st array with index 2 which is 8
@amitgarg7703
@amitgarg7703 3 месяца назад
this will execute from left to right. So after solving first two array will get [115][1]. Now by solving this, we get undefined
@The_Terminator
@The_Terminator 8 месяцев назад
what happen with tthe 3 then ?
@shujamigo
@shujamigo 8 месяцев назад
those who are facing pop-up on Answer. Try inspect element and make VISIBILITY:HIDDEN
@rahuulmiishra
@rahuulmiishra 8 месяцев назад
i have removed it btw
@rahuulmiishra
@rahuulmiishra 8 месяцев назад
🥇
Далее
JavaScript LIVE Coding Interview Round (Mock)
18:55
Просмотров 40 тыс.
The Value of Source Code
17:46
Просмотров 41 тыс.
Callback Hell | Ep  01 Season 02 - Namaste JavaScript
15:28