JavaScript Live Coding Interview (Mock) - Javascript interview questions

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024

Комментарии • 118

  • @coderdost
    @coderdost  Год назад +3

    React 2023 MasterClass : bit.ly/3I7MYN7
    React Interviews : bit.ly/3QAjAln
    JavaScript Interview Shorts:
    bit.ly/3XhHRQ1
    React Interview Shorts :
    bit.ly/3VfIrMi
    More REACT Interviews - bit.ly/3QAjAln
    REACT Interview Shorts :
    bit.ly/3VfIrMi
    JAVASCRIPT Interview Shorts:
    bit.ly/3XhHRQ1
    REACT JS Course (Redux & HOOKS) : bit.ly/3iMethN
    Course of JAVASCRIPT : bit.ly/3u049tf
    Course of Modern JS.(ES6) : bit.ly/3DvYCh6

    • @tusharshrivas5798
      @tusharshrivas5798 Год назад

      Sir in react how to do add to cart with out using redux

  • @prakashbanjade4374
    @prakashbanjade4374 Год назад +8

    21:05 Yes, it is possible in Js to create a reverse() method that can reverse any string and it can be done by adding your custom reverse logic to String.prototype

    • @coderdost
      @coderdost  Год назад +1

      Yes I wanted same answer. Thanks

  • @anilraj9877
    @anilraj9877 Год назад +2

    yes, we can do that, first we have to make our function to reverse the string, the add the function to String.prototype, after this we can get that function in any where in the code.

  • @anujadi8366
    @anujadi8366 Год назад +4

    Great content!! Can catch the intensity by putting ourself to that question
    Hoping to expect a shorts video/ 2-4 mins one on various questions in future :)
    Thanks for the Wonderful content!!!

    • @coderdost
      @coderdost  Год назад

      Yes. A video of JavaScript interviews questions is being compiled. After that may be coding questions

  • @sefumies
    @sefumies 23 дня назад

    Fella was missing a really easy implementation for the reverse.
    Just add a reverse function to the String prototype, and use it in the call
    String.prototype.reverse = function(){
    return this.split("").reverse().join("")
    }
    // Then the implemntation is as easy as:_
    const strRev = str.split(" ").map(s=>s.reverse()).join(" ")

  • @sumitpatil7473
    @sumitpatil7473 Год назад +1

    Yes possible three ways
    1) str.split ("").reverse ().join ("")
    2)let result =""
    Inside for(let i=0;i=0;i--) {
    result1 +=Str[i]
    }
    Cl(result1)

    • @chiraglegend2670
      @chiraglegend2670 Год назад +1

      What you did -> if you use the split without a gap it will break the the string into 1 alphabet by alphabet and then if you reverse that it would reverse the whole thing
      Instead if you split it with a gap every element would be in the split and you would get all the element one by one sepeated by a space in the array now use the map function to iterate to all the array element -> at first now you need to split every single element by value now you dont need any space to it ,this will let you reverse each element and join that when you are done and then join the previous splitted array .
      str.split(" ").map(x=> x.split("").reverse().join("")).join(" ")

    • @chiraglegend2670
      @chiraglegend2670 Год назад

      and I am strange that he approached the same way and still you couldnt get it

  • @Its_Abhi_Thakur
    @Its_Abhi_Thakur Год назад +6

    let str = "This is JavaScript Code";
    let result = str.split(" ").map((el) => el.split("").reverse().join("")).join(" ");
    console.log("result: ", result);

  • @suryateja9881
    @suryateja9881 Год назад +2

    My answer to the Sum 1:
    let string = "This is JavaScript Mock Interview";
    let newS = "";
    let stringBreak = string.split(" ");
    for(let i of stringBreak){
    var chars = i.split('');
    var reversedChars = chars.reverse();
    var reversedString = reversedChars.join('');
    newS += " " + reversedString;
    }
    console.log(newS)

  • @devanshbhardwaj4049
    @devanshbhardwaj4049 День назад

    Sir, what about this approach???
    const str = "Devansh Bhardwaj"
    const arr = str.split(" ")
    let result = []
    for(let x of arr){
    let res = x.split("").reverse().join("")
    result.push(res)
    }
    console.log(result.join(" "))

  • @chinmayjain9705
    @chinmayjain9705 7 месяцев назад

    JavaScript, as in many other languages, strings are immutable. This means that once a string is created, its content cannot be directly modified. Therefore, any attempt to "reverse" the string will not alter the original string but instead create a new string that contains the reversed characters

  • @nageshswamii3770
    @nageshswamii3770 Год назад +1

    function reverseString(str) {
    let revArray = [];
    let strlength = str.split(' ');
    for (let i = 0; i < strlength.length; i++) {
    let a = strlength[i].split("").reverse().join("");
    revArray.push(a)
    }
    return revArray.join(" ")
    }
    console.log(reverseString("This is javascript code"))

  • @nitishgupta8393
    @nitishgupta8393 Год назад +1

    1st :
    const rev = (str)=> {
    let lineRev = inp.split(" ").reverse()
    return lineRev.map(word=> word.split('').reverse().join("")).toString()
    }

  • @vikashojhabhojpuriya8396
    @vikashojhabhojpuriya8396 Год назад +1

    const string="This is Javascript code"
    let str1=string.split(""). reverse ().join("")
    let str2=str1.split(" "). reverse ().join(" ")
    Console.log(str2)

  • @tredzVid
    @tredzVid 7 месяцев назад

    Simple solution is
    const a = "This is Javascript Code";
    const reversedWords = a.split(' ').map(word => word.split('').reverse().join('')).join(' ');
    console.log(reversedWords);
    //output - "sihT si tpircsavaJ edoC"

  • @shaikmahaboobjani3655
    @shaikmahaboobjani3655 Год назад +1

    great content sir thank u for making this type of videos

  • @nitishgupta8393
    @nitishgupta8393 Год назад

    2nd:
    const maxChar = (str) => {
    let arr = str.split("");
    let count = 0;
    let res = "";
    arr.forEach((ch) => {
    let innercount = 0;
    arr.forEach((el) => {
    if (el == ch) {
    innercount += 1;
    }
    });
    if (innercount > count) {
    count = innercount;
    res = ch;
    }
    });
    return res;
    };

  • @WebDev970
    @WebDev970 Год назад +2

    Sir it would be better if you tell at the end of the video how much package this person deserves so we can make an idea where we stand.
    Although these interviews are really helpful
    Thank you

    • @coderdost
      @coderdost  Год назад +2

      We will optimise soon👍🏻

  • @divyabalajee
    @divyabalajee Год назад

    const maxWordCount=(str)=>{
    const word = str.split(' ')
    const maxArr = word.map((e)=>e.split('').length)
    const output = Math.max(...maxArr)
    return output
    }
    console.log(maxWordCount("this is javascript code"))

  • @tusharshrivas5798
    @tusharshrivas5798 Год назад

    21:41 answer is yes
    function reverseString(str) {
    return str.split("").reverse().join("");
    }
    const word = reverseString("this is javascriprt code");
    console.log(word);

  • @shaikmahaboobjani3655
    @shaikmahaboobjani3655 Год назад

    let str="mabujani"
    let res=[]
    for(let i=0; itimes)
    {
    times=res[char]
    max=char
    }
    }
    console.log(times,max)

  • @FreeTrial0315
    @FreeTrial0315 Год назад +1

    After solving the many dsa question this question look likes the 1+1

  • @theway_up
    @theway_up Год назад

    const str = "This is Javascript Code!";
    function reverseString(str) {
    const splittedStr = str.split(' ');
    let reversedStr = "";
    for(let elem of splittedStr) {
    reversedStr += elem.split('').reverse().join('') + ' ';
    }
    return reversedStr;
    }
    console.log(reverseString(str));

  • @shivpuje555
    @shivpuje555 Год назад

    I have create word by word Reverse function without loop ;
    var a = 'this is javascript code';

    function reverseWord(a){
    var b = a.split('');
    b.reverse();
    b = b.join('');
    b = b.split(' ').reverse().join(' ');
    console.log(b);
    return b
    }
    reverseWord(a);

  • @himanshuarora9567
    @himanshuarora9567 Год назад

    Please add some difficult questions for person having more than 4+ years of experience.

  • @jaspreetsingh-5259
    @jaspreetsingh-5259 Год назад

    const str='This is a javascript code and you have to find mac char';
    const strArr=str.split(' ');
    let arr=[]
    for (let i in strArr){
    arr.push(strArr[i].split(''));
    }
    let counter={};
    charArr=arr.flat();
    charArr.forEach(item=>{
    if(counter[item]){
    counter[item]+=1;
    }
    else{
    counter[item]=1;
    }
    })
    console.log(counter)

  • @rapper3470
    @rapper3470 10 месяцев назад

    const str = "this is javascript code";
    let ans = str.split(" ").map((elm)=>elm.split('').reverse().join('')).join(" ");
    console.log(ans);

  • @MrAmitbarthwal
    @MrAmitbarthwal 6 месяцев назад

    const A = 'This is javascript code';
    const R = [];
    A.split(' ').forEach(element => {
    R.push(element.split('').reverse().join(''));
    });
    console.log(R.join(' '));

  • @SaurabhSingh-wg1pm
    @SaurabhSingh-wg1pm 27 дней назад

    const str = "This is JavaScript Code";
    const revStr = str.split(' ').map((word) => word.split('').reverse().join('')).join(' ');
    console.log(revStr);

  • @pawansinghrawat7886
    @pawansinghrawat7886 Год назад

    ques1:
    const str="This is JavaScript"
    String.prototype.reverse=function(){
    const newStr=str.split('').reverse().join('').split(' ').reverse().join(' ');
    console.log(newStr)
    }
    str.reverse()

  • @AkashSingh-xf6bd
    @AkashSingh-xf6bd Год назад

    reverse function is apply on the array only, not string or number

  • @lalitsinghnegi1562
    @lalitsinghnegi1562 Год назад +2

    // // question 1
    // let data = "this is javascipt code"
    // let result = ""
    // for(let ele of data.split(" ")){
    // result += " " + ele.split("").reverse().join().replace(/,/g , "")
    // }
    // console.log(result)
    // question 2
    // let data = "this is javascipt code and you to find max char"
    // let result = {}
    // for( let ele of data){
    // if(ele != " ")
    // result[ele] = result[ele]+1 || 1
    // }
    // console.table(result)
    // let maxOccurence = ""
    // let max = 0
    // for(let ele in result){
    // if(result[ele] > max){
    // max = result[ele]
    // maxOccurence = ele
    // }
    // }
    // console.log(maxOccurence + " => " + max)

    • @OctTEN_1010
      @OctTEN_1010 Год назад

      for question 1 , this is enough:
      const str = "This is JavaScript Code"
      console.log(
      str
      .split(" ")
      .map(word => word.split("").reverse().join(""))
      .join(" ")
      )

  • @do_u_dsa
    @do_u_dsa Год назад

    Sir, great content, inspirational

  • @AkashSingh-xf6bd
    @AkashSingh-xf6bd Год назад

    const str = "this is javascript code"
    function isReverse(str){
    let newStr = str.split(" ");
    let result = []
    for(let i =0;i=0;j--){
    tempResult.push(innerStr[j])
    }
    result.push(tempResult.join(''))
    }
    return result.join(' ')
    }
    const res = isReverse(str)
    console.log(res)

  • @rohitroy3198
    @rohitroy3198 Год назад

    let text = "Hello everyone";
    let arr2 = text.split(' ')
    console.log(arr2)
    let arr3 = arr2[0].toString().split('').reverse().join("")
    let arr4 = arr2[1].toString().split('').reverse().join("")
    console.log(arr3)
    console.log(arr4)
    const finalaray = arr3.concat(" "+arr4)
    console.log(finalaray)
    break everything into pieces first, then reverse it and join... easy to think easy to approach.

  • @raghbirsingh8585
    @raghbirsingh8585 Год назад +2

    Sir I also want to give a mock coding interview like this.

    • @coderdost
      @coderdost  Год назад

      form is available on community post

  • @parashyadav9721
    @parashyadav9721 Год назад

    let str ="This is javascript Code ";
    let reverse=(word)=>{
    let out ="";
    for(var i =word.length-1;i>=0 ; i--){
    out+= word.charAt(i);
    }
    return out;
    }
    var revstr="";
    let arrstr = str.split(" ");
    arrstr.forEach(function(splittedword){
    revstr += reverse(splittedword)+ " ";
    });
    console.log(revstr);

  • @pavankumarmantha
    @pavankumarmantha Год назад

    the code for this could as simple as this
    output = []
    input_arr.map((item, index) =>{
    output.push(item.split('').reverse().join(''));
    });
    console.log(output.join(" "));

  • @nizamph2022
    @nizamph2022 Год назад +1

    in the last problem you should have removed the empty string from the array. Otherwise, it would always give empty string has the largest count

    • @swayambadhe
      @swayambadhe 8 месяцев назад

      That's the developers problem to figure out not the interviewer

  • @GargiArtGallery
    @GargiArtGallery Год назад +1

    str.split(" ").map((i) => i.split("").reverse().join("")).join(" "); For the First Question : Reversing String Word wise not whole at once

  • @jyzibzaidi6600
    @jyzibzaidi6600 Год назад

    come-up with single line approach
    let result = str.split('').reverse().join('').split(' ').reverse().join(" ")
    console.log(result)

  • @rajatraj3160
    @rajatraj3160 Год назад +1

    We can create one prototype for it like , String.prototype.reversestring = function ()
    {
    ///// Your logic
    And return string
    }

  • @AkashSingh-xf6bd
    @AkashSingh-xf6bd Год назад

    yes, we can using prototype

  • @prasadjoshi4009
    @prasadjoshi4009 Год назад

    Thanks For This Video

  • @NikhilPatel-bq7ck
    @NikhilPatel-bq7ck Год назад +1

    Add Custom function with String prototype

    • @coderdost
      @coderdost  Год назад +1

      Yes. That answer we needed

  • @gaganbaghel1377
    @gaganbaghel1377 Год назад +1

    As strings are immutable in javascript so it is not possible to mutate the some string by making a reverse function

    • @coderdost
      @coderdost  Год назад +2

      yes. we can't reverse original. but can return a Copy using ProtoType methods.

    • @gaganbaghel1377
      @gaganbaghel1377 Год назад

      @@coderdost i like what you make around web development and js want to work with you

    • @coderdost
      @coderdost  Год назад

      @@gaganbaghel1377 great. if you have time. lets connect at 9PM tonight ?? you can find my email on About section. I will share more details once you email me

    • @gaganbaghel1377
      @gaganbaghel1377 Год назад

      @@coderdost ok we can but i am currently having aligned interviews for a week can we connect after that i will mail you as soon as possible

    • @coderdost
      @coderdost  Год назад +1

      sure

  • @mr.editor7445
    @mr.editor7445 Год назад

    Great Content. Love from Pakistan

  • @RishabhSingh-jh7ij
    @RishabhSingh-jh7ij Год назад

    let reverse=" "
    let text = "This Is Javascript Code";
    const arr = text.split(" ").map((item)=>{
    for(let i=item.length-1;i>=0;i--){
    reverse+=item[i]
    }
    reverse+=" "
    return reverse
    })
    console.log(reverse)

  • @multiverse915
    @multiverse915 Год назад

    Sir i have a question are these mock interviews for the companies which prefer dsa students or the development companies

    • @coderdost
      @coderdost  Год назад

      These are not DSA-based.. they are mostly asked in companies that directly hire for a web role/intern. Mostly some startups or small service companies. Bigger companies may take DSA route

  • @Ayushkumar-il7jy
    @Ayushkumar-il7jy Год назад

    let arr= str.split(' ')
    let out= new Array();
    for(let i=0;i

  • @santoshalimkar2444
    @santoshalimkar2444 Год назад

    const message = "The rain in SPAIN stays mainly in the plain"
    const result=message.toLocaleLowerCase().split(" ").join("")
    console.log(result)
    const maxcount=(result)=>{
    const maxchar=[];
    for(let i=0;i val === result[i]).length
    maxchar.push(char)
    }
    return Math.max.apply(null, maxchar);

    }
    console.log(maxcount(result.split("")))

  • @astokum7
    @astokum7 Год назад

    21:31 Prototype Approch Will Help this scenario.

  • @fancybeing1296
    @fancybeing1296 Год назад

    sir how can i find more interview questions like this ? I want to practice technical interview questions for JS starting from beginning to advance level, from which website you took these questions?

    • @coderdost
      @coderdost  Год назад

      There is not a particular website for JS which I know. You can try - geeks for geeks they have good questions for coding- independent of languages..

  • @aparnas1613
    @aparnas1613 Год назад

    Great

  • @akash_gupta_2090
    @akash_gupta_2090 Год назад

    var reverseWords = function (s) {
    let res = "";
    let word = "";
    for (let c of s) {
    if (c === " ") {
    res += word + c;
    word = "";
    } else {
    word = c + word;
    }
    }
    return res + word;
    };

    • @coderdost
      @coderdost  Год назад

      this reverses whole string (every character), not the word order.

  • @harshvardhan2143
    @harshvardhan2143 Год назад

    //reverse the string
    function reverseString(str){
    let tempAr=str.split(" ");
    let finalAr=[];
    tempAr.forEach(val=>{
    let stringAr=val.split("");
    let string='';
    stringAr.forEach(val=>{
    string=val+string;
    })
    finalAr.push(string);
    })
    return finalAr.join(" ");
    }
    reverseString("This is JavaScript Code")
    // find max occuring char
    function findMaxOccuringChar(str){
    let tempStrAr=str.split("");
    let object={};
    tempStrAr.forEach(val=>{
    if(object.hasOwnProperty(val))
    object[val]++;
    else
    object[val]=1;
    })
    let maxChar=tempStrAr[0];
    for(let i in object){
    if(i!==" "&& object[i]>object[maxChar]){
    maxChar=i;
    }
    }
    return maxChar;
    }
    findMaxOccuringChar("This is JavaScript Code and you to find max char");

  • @akash_gupta_2090
    @akash_gupta_2090 Год назад

    let myStr = "This is javascript code and you to find max char";
    let calculate = {};
    function maxOccurring(str) {
    for (let item of str) {
    calculate[item] = (calculate[item] || 0) + 1;
    }
    let max = 0;
    let finalResults;
    for (let data in calculate) {
    if (calculate[data] > max) {
    max = calculate[data];
    finalResults = {
    [data]: max,
    };
    }
    }
    return finalResults;
    }
    console.log(maxOccurring(myStr.replaceAll(" ", "")));

  • @rushabhdave6648
    @rushabhdave6648 Год назад

    const str = "This is JavaScript"
    const stringReversalByWords = (str) => {
    const newStr = []
    str.split(" ").map((elem) =>{
    return newStr.push(elem.split("").reverse().join(""))
    })
    console.log(newStr.join(" "))
    }
    stringReversalByWords(str)

  • @birdsandwich2174
    @birdsandwich2174 Год назад

    Are there any resource/website where we can find this type of questions of this level?

    • @coderdost
      @coderdost  Год назад

      Not 1 resource but you can search for any coding interview question list. They can be in different languages. Already there are too many such sites. geek for geeks/ hacker rank etc etc..

  • @sourabhlodhi1675
    @sourabhlodhi1675 Год назад

    sir 1 Q tha jab express se routing kar skate hai tou node me HTTP or URL module Ku banye video bana ke bata dijiye ga

    • @coderdost
      @coderdost  Год назад +1

      Because http module lower level hai. Express usi ko use krke API bana easy kr deta h. API banana h to express hi use kro. But HTTP is not just for API - you can make different kind of request , for that HTTP module can be used. But 99% time express hi use kroge real life mein

    • @sourabhlodhi1675
      @sourabhlodhi1675 Год назад

      @@coderdost thanks sir

  • @dg_official96
    @dg_official96 Год назад

    Reverse method not support in str

  • @nibhasingh8882
    @nibhasingh8882 Год назад

    Hello sir.... Kya interview me jinki langwadge english hogi vhi interview de skta hai..?

    • @coderdost
      @coderdost  Год назад

      Most companies take interviews in English only. and thats why we used english.

  • @adarshkhatri993
    @adarshkhatri993 Год назад

    Aapne channel logo change kr dia?
    Mtlb doosre colour ka laga dia..

    • @coderdost
      @coderdost  Год назад

      Yes just for dark mode.any issue you faced after the change ?

    • @adarshkhatri993
      @adarshkhatri993 Год назад

      @@coderdost no, I haven't faced any issue regarding the same.
      And now your channel logo is gaining attraction bcz of its bright colours.💎
      Good decision to change the logo.

  • @Akshay-if5im
    @Akshay-if5im Год назад

    Can't we apply the split method first and then print the array in reverse order

    • @coderdost
      @coderdost  Год назад +1

      But I think question is just to reverse the words in its place not the whole sentence. We can apply split to get words - but then also have to split each word again to reverse it and join

    • @Akshay-if5im
      @Akshay-if5im Год назад

      @@coderdost got it

  • @siddharthroy78
    @siddharthroy78 Год назад

    This interview is for which level of experience or this guy is a fresher?

    • @coderdost
      @coderdost  Год назад

      He had some experience in IT but not from CS background

  • @gaurabgb
    @gaurabgb Год назад

    const ReverseString = (str) => {
    const s = str.split(" ");
    let dats = [];
    for (let i = 0; i < s.length; i++) {
    let dat = s[i].split("");
    dats.push(dat.reverse().join(""));
    }
    const rev = dats.join(" ");
    return rev;
    };

  • @OctTEN_1010
    @OctTEN_1010 Год назад

    Here, we can learn how not to do things , more than how to do things, it's still okay we getting something from this.

    • @coderdost
      @coderdost  Год назад

      Yeah. Main objective is to put yourself in that situation. Once you are used to such situations- stress of interview is lower when its is in real

  • @PIYUSH-lz1zq
    @PIYUSH-lz1zq Год назад

    js coding round ka playlist ka link dedo !!

    • @coderdost
      @coderdost  Год назад

      ruclips.net/p/PL2PkZdv6p7ZniAiKp2TCtJKFna6MCweYr

  • @interuptedgamerz7817
    @interuptedgamerz7817 Год назад

    When will the next video come?

  • @SandeepSingh-ed8qe
    @SandeepSingh-ed8qe Год назад

    i wish u as my interviwer

  • @AmitGupta-lx2ze
    @AmitGupta-lx2ze Год назад

    let str = "NodeJS is a javascript runtime";
    const reverseWord = (str) => {
    let arrStr = str.split(" ");
    console.log(arrStr);
    let newArrStr = arrStr.map((item) => {
    return item.split("").reverse().join("");
    });
    return newArrStr.join(" ");
    }
    let res = reverseWord(str);
    console.log(res);

  • @jhs003
    @jhs003 Год назад

    Aapne jo code likha hai Ryan Dahl bhi dar jaye yaar mere se bada coder kon hai ye...Why you are making simple things complicated .. Here is the short,readable,understandable code const str = "I am the father of Javascript programming"
    const splitText = str.split(' ')
    const reversedSplit = splitText.map((word) => {
    return word.split('').reverse().join('')
    })
    const finalreverse =reversedSplit.join(" ")
    console.log(finalreverse)

    • @coderdost
      @coderdost  Год назад

      Candidate was live , so sometimes pressure makes things complex

  • @froggyy
    @froggyy Год назад +1

    It's painful to watch

    • @coderdost
      @coderdost  Год назад

      Yes. But if you can solve faster. Its okay

    • @notyournormaldev1419
      @notyournormaldev1419 Год назад

      In life not every thing can be fast. So do interview and mocks

  • @jaspreetsingh-5259
    @jaspreetsingh-5259 Год назад

    const str="This is a Javascript code";
    const strArr=str.split(' ');
    let newStr="";
    for(let i in strArr){
    newStr+=strArr[i].split('').reverse().join('') + " "
    }
    console.log(newStr)

  • @user-ld1ub4qq8b
    @user-ld1ub4qq8b 10 месяцев назад

    let wordArray=word.split(" ")
    const reverseWord=wordArray.map(item=>item.split("").reverse().join(""))
    console.log(reverseWord.join(" "))

  • @lmntrix4503
    @lmntrix4503 Год назад

    const str = "harshit rajput"
    const arr = str.split('')
    // console.log(arr)
    function h(arr){
    let l =0;
    let r=0;
    let n = 0;
    for(;r

  • @Rohit-zs7kn
    @Rohit-zs7kn Год назад

    const str = "This is JavaScript Code";
    console.log(
    str
    .split(" ")
    .map((e) => e.split("").reverse().join(""))
    .join(" ")
    );
    const str = "This is JavaScript Code and you to find max char";
    const objMap = new Map();
    let Max = {
    elem: "",
    Count: Number.NEGATIVE_INFINITY
    };
    str.split("").forEach((e) => {
    if (e !== " ") {
    if (objMap.has(e)) {
    let val = objMap.get(e) + 1;
    if (val > Max.Count) Max = { elem: e, Count: val };
    objMap.set(e, val);
    } else {
    objMap.set(e, 1);
    }
    }
    });
    console.log(Max);