25 Mind-Blowing Practice Questions, Master JavaScript, Can You Solve Them All ?

Поділитися
Вставка
  • Опубліковано 31 жов 2024

КОМЕНТАРІ • 325

  • @kuldeepsinghrathore2327
    @kuldeepsinghrathore2327 Рік тому +17

    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
      @CreativKun 11 місяців тому

      can you explain me What return Keyword Do???

    • @urbangaming7334
      @urbangaming7334 9 місяців тому +2

      ​@@CreativKunThe return keyword returns the value where the function is called.

    • @kaushikbora2728
      @kaushikbora2728 9 місяців тому +2

      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

    • @CreativKun
      @CreativKun 9 місяців тому

      @@kaushikbora2728 Thanks a lot

  • @iamtacky832
    @iamtacky832 Рік тому +75

    Hi sir please upload for complete javascript course I like your teaching style.

    • @soulfulmelodies6676
      @soulfulmelodies6676 8 місяців тому +2

      I also feel the same, solving complex problems very easily sir✨

    • @sujaykumar9780
      @sujaykumar9780 7 місяців тому +1

      It's already there. check their playlist it's LIT🔥

  • @Tamatar8263
    @Tamatar8263 Місяць тому +2

    1:22:00 we can also use
    function retrieve(arr, n = 1){
    return arr.slice(0,n);
    }

  • @MohsinKhan-wv3ep
    @MohsinKhan-wv3ep 9 місяців тому +6

    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,])

  • @sheikhsclassic3604
    @sheikhsclassic3604 7 місяців тому +2

    Q5 : => 2 method
    let a = [1,2,3,];
    console.log(a += a)

  • @amitjadhav750
    @amitjadhav750 Рік тому +3

    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);

  • @PriyanshuSaini-x2j
    @PriyanshuSaini-x2j 7 місяців тому +1

    1:12:50
    for(i=0;i

  • @Mr.Zeus11
    @Mr.Zeus11 8 місяців тому

    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(){}))

  • @AkhileshBhatt-d8d
    @AkhileshBhatt-d8d Рік тому +4

    37th question can be done in a single for loop
    for(var i=0; i

    • @sparshsinha6338
      @sparshsinha6338 3 місяці тому

      agar ham ye use karenge to agar do consecutive females aayi to doosra vala object check hi nhi hoga

  • @Mr.Zeus11
    @Mr.Zeus11 8 місяців тому

    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));

  • @vipin143kumar
    @vipin143kumar Рік тому +13

    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.

  • @mukeshnenavath5603
    @mukeshnenavath5603 11 місяців тому

    Q. Loop an array and all all elem in it..
    arr.map((ele) => {
    sum+= ele;
    })
    console.log(sum)

  • @Jedex999
    @Jedex999 10 днів тому

    Are sir please aise videos aur Lao js ki intuition build ho rhi hai meri aj phli bar sare questions aa gye

  • @anastarique6947
    @anastarique6947 2 місяці тому

    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}`);

  • @ashatdaiya4328
    @ashatdaiya4328 5 місяців тому

    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));

  • @MihirMenon-c4u
    @MihirMenon-c4u 2 місяці тому +1

    // 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

  • @yashmalviya9931
    @yashmalviya9931 11 місяців тому

    For male question we can do it in single loop for(let i = arr.length-1 ; i >=0; i--){
    If condition here
    }

  • @darkshadow8414
    @darkshadow8414 Місяць тому

    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)
    }
    }

  • @Viralmems_xyz
    @Viralmems_xyz Рік тому

    retrun values.forEach(function(obj, index, arr) {
    if (obj.gender=== "male") {
    arr.splice(index, 1);
    }

  • @srikarravoori124
    @srikarravoori124 7 місяців тому

    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.

  • @s-qc9ns
    @s-qc9ns 4 місяці тому

    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😊

  • @prajuljain3641
    @prajuljain3641 Рік тому +7

    This is very helpful !!
    Thankyou so much ❤️

  • @onkarshinde7292
    @onkarshinde7292 10 місяців тому +1

    Hi Harsh, Question - program to find frequent number is tough & hard to understand, so how can i solve it.

  • @hellsterkun8764
    @hellsterkun8764 8 місяців тому +1

    Maazaa agaya bhaiyaa!
    Just had a req, that pls avoid any background music henceforth. It becomes irritating at a certain point

  • @animeisshhit2239
    @animeisshhit2239 Місяць тому

    Thanks bro now I have mastered JavaScript as well as Persian 🛐

  • @harikrishnanpandyan5684
    @harikrishnanpandyan5684 Рік тому +3

    It's literally mind-blowing 🤯🤯🤯🤯...
    Please one more video same as it is🔥🔥🔥🔥,
    like a interview problem solving... 😍😍😍

  • @blackwatch2150
    @blackwatch2150 Рік тому +8

    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😁😁

  • @shikari2.044
    @shikari2.044 3 місяці тому

    background me jo music bjta hai ekdum slow me kaafi relaxing lagta hai aapne saare videos me daalo bhaya..

  • @sareh8091
    @sareh8091 10 місяців тому +1

    1:06:14 !!! brilliant answer type

  • @mr.innovation2693
    @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)

  • @MihirMenon-c4u
    @MihirMenon-c4u 2 місяці тому

    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

  • @KULDEEPSINGH-eu8me
    @KULDEEPSINGH-eu8me Рік тому +2

    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)

  • @abdulsamadkarim8249
    @abdulsamadkarim8249 3 місяці тому

    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

  • @aadilshabir2854
    @aadilshabir2854 5 місяців тому

    Problem number 3 solution:
    function emptyArray(arr) {
    return arr.filter((item) => !item);
    }
    console.log(emptyArray([1, 5, 8, 63]));

  • @manishachauhan710
    @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

  • @Mr.Zeus11
    @Mr.Zeus11 8 місяців тому

    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

  • @Jedex999
    @Jedex999 10 днів тому

    Love you sir job lg gyi to phle salary se apka hi course kharidunga

  • @saim4556
    @saim4556 4 місяці тому

    ab ese kehte hai sikhana pura explain karke thank you bhaiya....

  • @Hamza__Sardar_Khan
    @Hamza__Sardar_Khan 4 місяці тому +1

    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++;
    }
    }

  • @ajiteshmishra0005
    @ajiteshmishra0005 7 місяців тому

    Please upload some more videos like this by taking some kor difficult problems using Javascript

  • @ankitavishwakarma4754
    @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

  • @faizalkhan2437
    @faizalkhan2437 10 місяців тому

    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

  • @784saif
    @784saif Рік тому +3

    This is very helpful !!
    Thankyou so much ❤

  • @Minhajul-h1d
    @Minhajul-h1d 10 місяців тому

    // 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
      @Minhajul-h1d 10 місяців тому

      One output is perfectly showing but another is undefined, What is the error?

    • @geek_24
      @geek_24 10 місяців тому

      Why commented the return statement? uncomment it, will work.

  • @ProgrammingWithDataSci
    @ProgrammingWithDataSci Рік тому +1

    var str="hello sreehari how are you"
    var reverseStr=(str.split("").reverse("").join(""));
    console.log(reverseStr);

  • @pure_soul695
    @pure_soul695 11 місяців тому

    Aap boht hi acchese simple language me smjhate ho..Loved it❤️❤️

  • @priyakarn5191
    @priyakarn5191 11 місяців тому

    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

  • @surajgupta5223
    @surajgupta5223 13 днів тому

    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

  • @atul-xt
    @atul-xt 5 місяців тому +2

    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 ❤️

  • @puja-z6c
    @puja-z6c 4 місяці тому

    THANK YOU SO MUCH SIR...... HUGE RESPECT 50% QUESTIONS I DID IT...

  • @bhumikavaishay8580
    @bhumikavaishay8580 11 місяців тому

    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!!!!!!!!!!!

  • @adarshkumarnishad2304
    @adarshkumarnishad2304 4 місяці тому

    harsh bhaiya ki teaching style❤ koi banda ubb hi nhi skta pdhte time😄

  • @sadiakhan5371
    @sadiakhan5371 27 днів тому

    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.

  • @biswaruprana8102
    @biswaruprana8102 13 днів тому

    sir please make this type of videos more it's help lot...... Thank you so much sir😇😇😇😇😇😇😇

  • @atulsharma2734
    @atulsharma2734 7 місяців тому

    What about string
    Ex.- var a ="12"
    Then also its giving integer

  • @sanjaylamba003
    @sanjaylamba003 Рік тому +1

    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?

  • @PriyaSharma-nu8fg
    @PriyaSharma-nu8fg Рік тому +4

    Very well explained, waiting for next 20 questions 🙌🏻🙌🏻

  • @MyTechTipsgrow
    @MyTechTipsgrow Рік тому

    easy and hard at same time . but sara smj agaya bohut achiy sa smjhty hn ap

  • @moviesprokhan1469
    @moviesprokhan1469 3 місяці тому

    well a wonderfull journey of 2 hours come to an end it was worth it to watch and follow u thanks once again

  • @kashmirtechtv2948
    @kashmirtechtv2948 3 місяці тому +1

    have watched complete video

  • @yash_thefame
    @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...

  • @Techinalfamilyinhindi
    @Techinalfamilyinhindi Рік тому

    8:15
    Nimdaaa
    Dosrass Sthelmi
    Hardha-vhush KKRRAAK viku Nim-bhumla
    Mohina ZukOOO...
    Loha -KhuvAAA...

  • @Aman_yadav1419
    @Aman_yadav1419 10 місяців тому +1

    Bhaiya agle questions bhi daldo 👀😊

  • @NeerajYadav-zj5zh
    @NeerajYadav-zj5zh 7 місяців тому

    Please make some more videos,
    It was very help full !important

  • @MuskanS6
    @MuskanS6 2 місяці тому

    Really appreciate your efforts...thankss
    btw part 2 wasn't posted ?

  • @JoinMeInLearning
    @JoinMeInLearning 6 місяців тому

    Thank you for your teaching style-it makes everything much easier to understand. 😊

  • @mansisaw5974
    @mansisaw5974 2 місяці тому

    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...🙇

  • @tashafkhan531
    @tashafkhan531 Місяць тому +1

    19:40 the way he said 'Chauuuda'

  • @surajbhure8870
    @surajbhure8870 8 місяців тому

    Harsh Bhai, the way you teach is awesome, only I am distracted watching you when you adjust your glasses 👓 every15 secondsc.

  • @Mr.Zeus11
    @Mr.Zeus11 8 місяців тому

    Question 1: advanced solution with Palindrome problem.
    const removeSpaceFromString = str => str.replace(/\s/g, '')
    const reverse = str => str.split('').reverse().join('');
    const ispalindrom = str => {
    const isString = (typeof str === 'number') ? str.toString() : str;
    const valueWithoutSpace = removeSpaceFromString(isString)
    return (valueWithoutSpace === (reverse(valueWithoutSpace))) ? 'Palindrome' : 'Not Palindrome'
    }
    console.log(ispalindrom('m a m')) //Palindrome
    console.log(ispalindrom(5.5)) // Palindrome
    console.log(ispalindrom('deified')) // Palindrome

  • @aavezshaikh143
    @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.

  • @ravalprince457
    @ravalprince457 4 місяці тому

    This teach styles and explanation is awesome 😮❤

  • @ajaysasane4674
    @ajaysasane4674 2 місяці тому

    Bro Dot Net development Ka Tutorial Lao Please Project ke sath

  • @sonukam7284
    @sonukam7284 11 місяців тому

    make a path, write in 30 points the interview questions from easy to difficult of the javascripts programming language

  • @Mr.Zeus11
    @Mr.Zeus11 8 місяців тому

    More optimal solution for gender based filter:
    General filter:
    const filterByGender = (users, gendersToFilter) => {
    return users.filter(user => gendersToFilter.includes(user.gender))
    }
    console.log(filterByGender(users, ['male']))
    Solution for Exclude:
    const filterByGenderExcept = (users, gendersToExclude) => {
    return users.filter(user => !gendersToExclude.includes(user.gender))
    }
    const users = [
    { name: 'abc', gender: 'male'},
    { name: 'cc', gender: 'female'},
    { name: 'bb', gender: 'any'},
    { name: 'dd', gender: 'female'}
    ]
    console.log(filterByGenderExcept(users, ['male']))

  • @pushkarsharma1240
    @pushkarsharma1240 Рік тому

    bhaiya ek chota sa suggestion tha plz videos mai background music mat use kiya karo disturbance hota hai

  • @abhijeetanand6862
    @abhijeetanand6862 Рік тому

    53:33 ,1:13:03,1:22:08 ,1:29:15

  • @invisibletricks8563
    @invisibletricks8563 11 місяців тому

    Sir , instead of using object to remove duplicate elements from an array can we convert first into set and then Array.from(set) by this way we got the array with unique numbers

  • @prakashdhamdhere8581
    @prakashdhamdhere8581 Рік тому +1

    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

  • @jigarkumar9073
    @jigarkumar9073 7 місяців тому

    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... 😂😂😂

  • @praneetc1040
    @praneetc1040 11 місяців тому

    Hi Harsh
    Can you please provide the doc which has only questions in it so that we can practice and see the solution
    Thanks

  • @mohammadabbasali2802
    @mohammadabbasali2802 11 місяців тому +1

    Bahi you are amazing ..Love from Hyderabad Please Keep helping us bahi in our web development journey❤

  • @shaileshparekh2607
    @shaileshparekh2607 Рік тому

    33:52

  • @muhammadzaidaziz8552
    @muhammadzaidaziz8552 3 місяці тому

    25:25 agar hum 12340 pass kren then 4321 ata ha " 0 " value ni ati

  • @simplyskandi5973
    @simplyskandi5973 Рік тому +5

    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.

  • @SaGaR-is1jg
    @SaGaR-is1jg 4 місяці тому

    we need more video like this plssss continue

  • @ravibhojani5286
    @ravibhojani5286 3 місяці тому

    awesome questions and teching style.

  • @kumargaurav2207
    @kumargaurav2207 5 місяців тому +1

    aage ke questions konsi video me hai?

  • @Mr.Zeus11
    @Mr.Zeus11 8 місяців тому

    /* 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))

  • @thefourhourtalk
    @thefourhourtalk 10 місяців тому +1

    most amazing question series omg this is just wow ; the explanation of bhaiya was truly amazing loved it bhaiya genuinely loved it

  • @Tamatar8263
    @Tamatar8263 Місяць тому +1

    1:16:10 can't we just use
    return arr;

  • @ajayaadsule
    @ajayaadsule Рік тому

    can you make more video like this for javascript question it's amazing video

  • @afzalguru643
    @afzalguru643 9 місяців тому

    that's great teacher and well teaching method keep it up brother

  • @nusratlines4947
    @nusratlines4947 5 місяців тому

    01:13:03
    For loog Ko arr.length tk chala rahy ho . Per ap bol rahy ye ik object kley code Hy... Ye bat upper sy gai.

  • @Zareena_Iqbal
    @Zareena_Iqbal 5 місяців тому

    Plz Plz Upload more videos like this

  • @rushikeshdhanawade4425
    @rushikeshdhanawade4425 Рік тому +1

    Thankyou For This Lessons Sir

  • @pranavgorad8561
    @pranavgorad8561 2 місяці тому

    Hum Jo html form banate hain usko submit karne ke baad uska data humare email par ana chahiye kaise kar shakte hain

  • @bhaimohsin
    @bhaimohsin Рік тому

    54:35

  • @Bhota4951
    @Bhota4951 Рік тому +2

    20 more questions needed btw amazing video❤‍🔥

  • @rashmidhande6234
    @rashmidhande6234 11 місяців тому

    Thank you so much... amazing and excellent content...