JavaScript coding Interview questions | reactjs interview questions | TCS | Capgemini | Must watch

preview_player
Показать описание
#JavascriptInterview #ReactInterview #ReactJS #javascript #codewithhuma
JavaScript coding Interview questions | reactjs interview questions | TCS | Capgemini | Must watch

Very important interview question of javascript which everyone should know before interview.
In this video we explained every question with solution and that will help you alot.
#javascript #javascriptfunctions #reactjs #reactjstutorial #interviewReactjs #interviewjavascript
#youtube #youtubeshorts #youtuber #youtubevideo #importantjavascriptQuestions

For more amazing videos you can subscribe us and press the bell icon 🔔
lets learn together and grow together ✌️😊.

Рекомендации по теме
Комментарии
Автор

for the last question we can reduce the code like :
const obj = {}

array.forEach(item => {
obj[item] = obj[item]? obj[item] +1 : 1
})
console.log(obj)

vamsim
Автор

Q3 !! optimised this way also.

const arr =['aaa', 'bbb', 'ccc', 'aaa', 'bbb'];
let obj = {};
arr.map((item) => {
obj[item] ? obj[item] +=1 : obj[item] = 1;
});
console.log(obj);

tusharchemate
Автор

Helpful content ✨
Ig the YouTube's algorithm is now on your side, Keep pushing such content

dawnishere
Автор

To be very Genuine I followed the same approach for the first questions Mam.

deepanshugoyal
Автор

for second question my approach was that..randomly
let str1 ="codehelpeee e";
let str2 = "decolhpee eee";
function compareStrCharacters(str1, str2){

for( let i=0; i<str1.length;i++){
char = str1[i];
index =str2.indexOf(char);
if(str2.includes(char)){
str2 = str2.slice(0, index)+str2.slice(index+1);

}else {
return false
}
}
return true;
}
console.log( compareStrCharacters(str1, str2));

I know but as you said I tried thank u.

deepanshugoyal
Автор

I think there are better solutions for the first one, this was mine. It completes in constant time:

function rotate(arr, n){
return [...arr.slice(arr.length - (n % arr.length)), ...arr.slice(0, arr.length - (n % arr.length))];
}

Effectively it's grabbing the back and putting it on the front. It also account for values of n over arr.length using modular.

nicholasleask
Автор

for the last Question my code was
let arr = ["a", "b", "a", "c", "a", "b", "d"];
let obj= {};
for(let x of arr){
if( !obj[x]){
obj[x] =1;
}else{
obj[x]++;
}
}
console.log(obj);

deepanshugoyal