20:00 we can also duplicate this array by using spread operators , const duplicate = (arr)=>{ return newArray = [...arr, ...arr] } console.log(duplicate([1, 2, 3])) It will return an new array
@CreativKun Жыл бұрын
can you explain me What return Keyword Do???
@urbangaming733411 ай бұрын
@@CreativKunThe return keyword returns the value where the function is called.
@kaushikbora272811 ай бұрын
i had the same question back then, dont stress it , its pretty simple, when you use return , the data after it can be stored in a variable and can be accessed whenever you want, unlike consolelog , it just prints the data, whereas return stores it@@CreativKun
@CreativKun11 ай бұрын
@@kaushikbora2728 Thanks a lot
@yurTherapiztАй бұрын
@@urbangaming7334in function, if you don't write return, the code will execute but it will execute inside the function only so by returning it, It will go back to where the function was called
@iamtacky832 Жыл бұрын
Hi sir please upload for complete javascript course I like your teaching style.
@soulfulmelodies667610 ай бұрын
I also feel the same, solving complex problems very easily sir✨
@sujaykumar97809 ай бұрын
It's already there. check their playlist it's LIT🔥
@Tamatar82633 ай бұрын
1:22:00 we can also use function retrieve(arr, n = 1){ return arr.slice(0,n); }
@PriyanshuSaini-x2j9 ай бұрын
1:12:50 for(i=0;i
@CartoonWorldHD.9 ай бұрын
@Aakash_Kashyap01Ай бұрын
for (let j = arr.length - 1; j >= 0; j--) { if (arr[j].gender !== 'male') { arr.splice(j, 1); } } -> also we can do like this..
@MohsinKhan-wv3ep11 ай бұрын
1:36:56 for most frequent item of array we can also do it very easily instead of using objects(by your method) use my method : function frequent(arr){ let ans = arr.reduce( (acc,num)=>{ return freq[acc] > freq[num] ? acc : num; }) console.log(ans); } frequent([1,2,3,4,1,4,3,1,3,7,])
@islamicquiz_349 ай бұрын
Q5 : => 2 method let a = [1,2,3,]; console.log(a += a)
@amitjadhav750 Жыл бұрын
very nice video broo ... for question 10 you can use reduce method also ,,,,const string='apple' const result = string.split('').reduce((acc,curr)=>{ if(acc[curr]){ acc[curr]= ++acc[curr]; }else{ acc[curr]=1; } return acc; },{}); console.log(result);
@Mr.Zeus1110 ай бұрын
Array 10: Return data types: check all the corner cases. const returnDataType = (variable) => { if (typeof variable === 'object') { if (Array.isArray(variable)) return 'array'; if (variable === null) return null; return 'object' } return typeof variable; } console.log(returnDataType(function(){}))
@MihirMenon-c4u4 ай бұрын
// shuffle given array function shuffleArray() { let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]; arr.sort((a, b) => Math.random() - 0.5); console.log(arr); } shuffleArray(); this should also work
@vipin143kumar Жыл бұрын
Hi Harsh brother - ur teaching style n the content u've provided hv been incredibly helpful 2 all of us. The way u explain complex concepts with clarity and enthusiasm truly makes a difference in our understanding.
@Mr.Zeus1110 ай бұрын
Loop: add list of all members in array which is number. (ex: 4 or '4') Optimal Solution: Remember check all the edge cases. let members = [1,'fh','4','foo',5, '6']; const addMembers = members => { let count = 0; members.forEach(member => { if (!isNaN(Number(member))) { count += Number(member); } }) return count; } console.log(addMembers(members));
@shahidshaikh610925 күн бұрын
the way of teaching is mind blowing really big fan. from pune....
@yashmalviya9931 Жыл бұрын
For male question we can do it in single loop for(let i = arr.length-1 ; i >=0; i--){ If condition here }
@Aakash_Kashyap01Ай бұрын
1:16:56 We Can also clone like this.. function cloneArr(data){ return data.map((e) => e) } console.log(cloneArr([1,2,3,4,5]));
@anastarique69474 ай бұрын
Shuffle array question answer in more smaller way let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; arr.sort(() => Math.random() - 0.5); console.log(`Shuffled array: ${arr}`);
@ashatdaiya43287 ай бұрын
And i did like this very small change but I understand better in this way: // shuffle an array const array = [1, 2, 3, 4, 5, 6, 7, 8, 9]; const shuffler = (arr) => { for (let i = arr.length - 1; i > 0; i--) { let rendomIndex = Math.floor(Math.random() * arr.length) let temp = arr[i] arr[i] = arr[rendomIndex] arr[rendomIndex] = temp } return arr } console.log(shuffler(array));
1:09:24 we can also use let arr=[ {name:"abcd",gender:"male"}, {name:"hrssfd",gender:"female"}, {name:"fsdfsd",gender:"female"} ] for(let i of arr){ if(i.gender !="male"){ continue; }else{ console.log(i) } }
@sanjaylamba003 Жыл бұрын
1:36:55 in the question to find most frequent item of array, how to solve it if more than one value occurs most time?
@harikrishnanpandyan5684 Жыл бұрын
please replay
@AkhileshBhatt-d8d Жыл бұрын
37th question can be done in a single for loop for(var i=0; i
@sparshsinha63385 ай бұрын
agar ham ye use karenge to agar do consecutive females aayi to doosra vala object check hi nhi hoga
@prajuljain3641 Жыл бұрын
This is very helpful !! Thankyou so much ❤️
@expertwebexperts Жыл бұрын
yes..
@harikrishnanpandyan5684 Жыл бұрын
It's literally mind-blowing 🤯🤯🤯🤯... Please one more video same as it is🔥🔥🔥🔥, like a interview problem solving... 😍😍😍
@s-qc9ns6 ай бұрын
I used arr.splice(0) to empty the array. Got to know today that it's can be done by setting array length to 0 also😊
@srikarravoori1249 ай бұрын
your effors are well appreciated. Practising Javascript is the only way to become an good Frontend or even backend developer. But most of the times we learn ReactJs, Anglular any such frontend libraries is of no use. The more you practice, the better you will become.
@surajgupta52232 ай бұрын
1:02:18 question removing object all object which gender != male another solution let people = [ { name: "John", gender: "Male" }, { name: "deepak", gender: 'undefind'}, { name: "Emma", gender: "Female" }, { name: "Alex", gender: "Male" }, { name: "Sophia", gender: "Female" } ]; for(let i=0; i
@hellsterkun876410 ай бұрын
Maazaa agaya bhaiyaa! Just had a req, that pls avoid any background music henceforth. It becomes irritating at a certain point
@Khamzat_076 ай бұрын
For Genders Question (Using Filter First and then For Loop):::::::::::for (var j = 0; j < arr.length; ) { if (arr[j].gender !== 'male') { arr.splice(j, 1); } else { j++; } }
@sareh8091 Жыл бұрын
1:06:14 !!! brilliant answer type
@PriyaSharma-nu8fg Жыл бұрын
Very well explained, waiting for next 20 questions 🙌🏻🙌🏻
@animeisshhit22393 ай бұрын
Thanks bro now I have mastered JavaScript as well as Persian 🛐
@mr.innovation2693 Жыл бұрын
sir ye sahi hai question no 3=> let arr=[1,2,3,4,5,6,5,6,7,8] let a=arr.splice(0,arr.length) console.log(arr)
@pure_soul695 Жыл бұрын
Aap boht hi acchese simple language me smjhate ho..Loved it❤️❤️
@puja-z6c6 ай бұрын
THANK YOU SO MUCH SIR...... HUGE RESPECT 50% QUESTIONS I DID IT...
@abdulsamadkarim82495 ай бұрын
function retrive(arr, ele = 1) { if (arr.length >= ele) { console.log(arr.slice(-ele)) }else{ console.log(`${ele} Elements nahi hai Arry me `) } } retrive([1, 2, 3, 4, 5, 6, 7], 1) print last elements
@MihirMenon-c4u4 ай бұрын
function shuffleArray() { let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]; for (let i=arr.length-1; i>0; i--) { let random = Math.floor(Math.random() * (i+1)); [arr[i], arr[random]] = [arr[random], arr[i]]; } console.log(arr); } shuffleArray(); this could be more easy & effective
@sumitjhaldiyal91925 ай бұрын
for (let i = 0; i < s.length; i++) { if (s[i].gender!=="male") { s.splice(i,1) i=i-1; } } console.log(s); 1:12:47 for removing male questoin easy approach
@ravalprince4576 ай бұрын
This teach styles and explanation is awesome 😮❤
@biswaruprana81022 ай бұрын
sir please make this type of videos more it's help lot...... Thank you so much sir😇😇😇😇😇😇😇
@Jedex9992 ай бұрын
Are sir please aise videos aur Lao js ki intuition build ho rhi hai meri aj phli bar sare questions aa gye
@aadilshabir28547 ай бұрын
Problem number 3 solution: function emptyArray(arr) { return arr.filter((item) => !item); } console.log(emptyArray([1, 5, 8, 63]));
@bhumikavaishay8580 Жыл бұрын
Sir, Please make more questions like this it really help me a lot to undertstand the concept in so many other ways...................Waiting for more questions like this!!!!!!!!!!!
@yash_thefame Жыл бұрын
That Background Music Make this Much Easier To understand....that is the we want to learn whole Video is Just awosome Great Explaination...
@JoinMeInLearning8 ай бұрын
Thank you for your teaching style-it makes everything much easier to understand. 😊
@moviesprokhan14695 ай бұрын
well a wonderfull journey of 2 hours come to an end it was worth it to watch and follow u thanks once again
@Mr.Zeus1110 ай бұрын
Reverse Number:: Including negative value function reverseNumber(num) { let reversed = 0; let sign = Math.sign(num); num = Math.abs(num); while (num > 0) { reversed = reversed * 10 + num%10; num = Math.floor(num / 10); } return reversed * sign; } console.log(reverseNumber(-12300)); // -321 console.log(reverseNumber(123)); // 321 console.log(reverseNumber(450000)); // 54
@ajiteshmishra00059 ай бұрын
Please upload some more videos like this by taking some kor difficult problems using Javascript
@RazaAnsari-f5d12 күн бұрын
First Question Hum aise bhi solve kr skte hai let a = "Raza Ansari" console.log(a.split('').reverse().join());
@784saif Жыл бұрын
This is very helpful !! Thankyou so much ❤
@tashafkhan5314 ай бұрын
19:40 the way he said 'Chauuuda'
@manishachauhan710 Жыл бұрын
Sir please kuch questions ka solution bhut jada ghumane valla tha specially frequent element and shuffle valla pls sir in 2 programs ka koi simple solution bta dijiye.....baki sb smj a gya h ....and thankyou so much itna acha padane ke lieee
@MuskanS64 ай бұрын
Really appreciate your efforts...thankss btw part 2 wasn't posted ?
easy and hard at same time . but sara smj agaya bohut achiy sa smjhty hn ap
@blackwatch2150 Жыл бұрын
Just a friendly reminder, during interview they expect you to use self made code. You can't use pre defined methods. Like sort, reverse etc. So prepare accordingly. All the best guys😁😁
@let_motivate Жыл бұрын
give me more tips brother
@pankaj8876 Жыл бұрын
That's totally true.
@ProgrammingWithDataSci Жыл бұрын
var str="hello sreehari how are you" var reverseStr=(str.split("").reverse("").join("")); console.log(reverseStr);
@ravibhojani52865 ай бұрын
awesome questions and teching style.
@NeerajYadav-zj5zh10 ай бұрын
Please make some more videos, It was very help full !important
@surajbhure887010 ай бұрын
Harsh Bhai, the way you teach is awesome, only I am distracted watching you when you adjust your glasses 👓 every15 secondsc.
@adarshkumarnishad23046 ай бұрын
harsh bhaiya ki teaching style❤ koi banda ubb hi nhi skta pdhte time😄
@atul-xt7 ай бұрын
Question 4:- if you take number 0.1 it will give you Integer it will be failed in this situation any alternative approach ? If someone knows just drop ur logic ❤️
@faizalkhan2437 Жыл бұрын
Because reverse method is for array it is not operate on string that's why we have to split string into a array then reverse it and join the array elements into string
@onkarshinde7292 Жыл бұрын
Hi Harsh, Question - program to find frequent number is tough & hard to understand, so how can i solve it.
@mohammadabbasali2802 Жыл бұрын
Bahi you are amazing ..Love from Hyderabad Please Keep helping us bahi in our web development journey❤
@shikari2.0445 ай бұрын
background me jo music bjta hai ekdum slow me kaafi relaxing lagta hai aapne saare videos me daalo bhaya..
@saim45566 ай бұрын
ab ese kehte hai sikhana pura explain karke thank you bhaiya....
@simplyskandi5973 Жыл бұрын
Thank you so much Harsh for putting together this important video! Really appreciate the hours of work you and your team put into recording/editing these videos all for free. Would like to support you by buying paid courses.
@Mr.Zeus1110 ай бұрын
/* 11:: Write a JavaScript function to get the first element of an array. Passing a barameter 'n' will return the first 'n' elements of the array. */ const retrieveNthFirstEle = (arr = [], n = 1) => { if (arr.length === 0 || n { if (arr.length === 0 || n = arr.length) return arr return arr.slice(-n); } console.log(retrieveNthLastEle([1,2,3,4,5,6,7], 2))
@afzalguru64311 ай бұрын
that's great teacher and well teaching method keep it up brother
@KULDEEPSINGH-eu8me Жыл бұрын
bhaiya can we do this also var array = [1, 2, 3, 4, 5, 6,7 ,8 ,9, 0]; var emptyArray = array.splice(array.length, array.length) console.log(emptyArray)
most amazing question series omg this is just wow ; the explanation of bhaiya was truly amazing loved it bhaiya genuinely loved it
@mansisaw59744 ай бұрын
Sir please make full course on html ,css, javascript, full stack developer course Please sir I like the way u teach !!! Please sir highly requested...🙇
@rushikeshdhanawade4425 Жыл бұрын
Thankyou For This Lessons Sir
@AhmedBhatti-b5k11 ай бұрын
Thank you So much for providing such a good type of stuff. You and your team have proved to be the best teachers on the KZbin I ever seen on. One Of my little request, please make a video on the Flutter Development For beginners. ❤😊...
@surbhijoshi816210 ай бұрын
Very helpful..thankyou sir🙂
@ankitavishwakarma4754 Жыл бұрын
Sir aap explain bahut achese kar rahe hain but jo background sound hai wo thoda sa disturb kar rhi hai concentrate hoke sunne me... Aapne bahut achi tarah se samjhaye hai problems mujhe saare samjh aaye per sound ne thoda sa problem diya other wise 10/9 .1 marks for sound
@atulsharma27349 ай бұрын
What about string Ex.- var a ="12" Then also its giving integer
@jigarkumar90739 ай бұрын
Your teaching skill is amazing.... explore many things that are easy but never thing on that way...bus aap problem solve karte joke karte ho... usme aisa lagta he k jaise koi lorry driver drive karte karte joke mar raha he... 😂😂😂
@rashmidhande6234 Жыл бұрын
Thank you so much... amazing and excellent content...
@sadiakhan53712 ай бұрын
500 Likes and 150 comments ka target that for the next Questions video ab to Biya 6.3K likes and 318 Comments ho chukay hain so please continue this series ek alag playlist bnayn for Questions and bring more basic to advance JavaScript Questions on all JS topics, Thankyou.
@11deepikarao48 Жыл бұрын
You are teaching very good keep going and make interview questions for experienced also and try to make on every important topic in js and react
@Jedex9992 ай бұрын
Love you sir job lg gyi to phle salary se apka hi course kharidunga
@prakashdhamdhere8581 Жыл бұрын
bhai muze laga Q.5. ka ans mai solve kr sakta hu to maine solve kiya but aapka ans dekhkr meri shakal 😳 . my Ans. - function duplicate(val){ var sampl = []; for(let i=0; i
@priyakarn5191 Жыл бұрын
sir kya is question ko aise bhi kr sakte hain???? // 16. write a javascript function to get the last element of an array. Passing a // parameter 'n' will return the last 'n' element of the array // and should not come undefined value // function arr(e,n=2) // { // const res = e.reverse() // if(n
@sonukam7284 Жыл бұрын
make a path, write in 30 points the interview questions from easy to difficult of the javascripts programming language
it was super informative video please bring part 2
@TechSubhajit Жыл бұрын
Thanks bhai for such awsome content ❣️ from Kolkata
@mdmonis_ Жыл бұрын
54:40 waah waah "bole jo koyal" 😂😂😂😂😂😂😂😂😂😂
@kashmirtechtv29485 ай бұрын
have watched complete video
@ajayaadsule Жыл бұрын
can you make more video like this for javascript question it's amazing video
@ShwetaSingh-rb8hu Жыл бұрын
Tysm bhaiya this is very helpful 😊
@anirudhachakrabarty2050 Жыл бұрын
Awesome harsh bhaiya ... Make more and more videos like this..
@Minhajul-h1d Жыл бұрын
// Write a javascript program to compute the union of two arrays let newArr = [1,2,3,4,5,6,7,8,9,10]; let newArr2 = [9,10,11,12,13,14,15,16,17,18]; function union(arr1, arr2){ console.log([...new Set(arr1.concat(arr2))]); // return [...new Set(arr1.concat(arr2))]; } console.log(union(newArr, newArr2)); //Question : Why is there showing undefined showing in the output?
@Minhajul-h1d Жыл бұрын
One output is perfectly showing but another is undefined, What is the error?
@geek_24 Жыл бұрын
Why commented the return statement? uncomment it, will work.
@aavezshaikh143 Жыл бұрын
Bhaiya JS me chrome k devloper tools me debug functionality kis tarah se use ki jati hai ek video banao. cover what are breakpoints.
@elhamwaheed95298 күн бұрын
// function reverseFunction(num) { // let mod; // let result = ""; // while (num > 0) { // mod = num % 10; // mode 10 return last digit of number // result = result + "" + mod; // num = Math.floor(num / 10); // return the start digit // } // return Number(result); // } // console.log(reverseFunction(123456789));