JavaScript Arrays & Map Method Tutorial - Google Apps Script Part 4

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 ก.ย. 2024
  • Learn how to use JavaScript array map method with one or two dimensional arrays. Google Apps Script Intermediate Tutorial Part 4
    #javascript #arrays #map #method

ความคิดเห็น • 45

  • @Wrynst
    @Wrynst 5 ปีที่แล้ว +26

    This is exactly what I have been wanting since your last Apps Script + Sheets series! Been subscriber since the start and I am always looking forward to your next video.
    You deserve more praises than I can give.
    This channel has changed my life. No joke. These videos got me back to coding, and for that, I cannot thank you enough.

  • @Ancode2
    @Ancode2 3 ปีที่แล้ว +3

    This is the simplest and very efficient tutorial about map in entire TH-cam. Really appreciate your work

  • @giamar3026
    @giamar3026 5 ปีที่แล้ว +5

    Thank you!!!. Could be hours watching your videos, they are superlative on teaching GAS and JS. Not everyone could be a good teacher...you are just perfect!

  • @KhalilYasser
    @KhalilYasser 5 ปีที่แล้ว +5

    Thanks a lot for great tutorials. God bless you

  • @GautamSamant
    @GautamSamant ปีที่แล้ว

    I am coding after 35 year. Seriously, after Qbasic and fortran. Thanks so much for these videos.
    That said, I think a more elegant way of doing the age increment would be
    row[1]++;
    return row;

  • @brighnquisitive6217
    @brighnquisitive6217 3 ปีที่แล้ว

    Your style of presentation is spot on.

  • @rotrose7531
    @rotrose7531 5 ปีที่แล้ว +2

    Thank you very much, exactly the very thing I am looking for either, can express enough thanks for you to share this. Thanks a lot!

  • @Masonman0630
    @Masonman0630 ปีที่แล้ว

    useful

  • @ABsazerNer
    @ABsazerNer 4 ปีที่แล้ว

    Map is the most interesting method i found in JavaScript

  • @rinkukhamari
    @rinkukhamari 5 ปีที่แล้ว +2

    its very useful.... thank you...

  • @jodelo01
    @jodelo01 11 หลายเดือนก่อน

    I have been following the tutorials for a while and they are very helpful. I am now building a script and I am using the map method in a but i noticed it overwrites the data in the original array it is mapping. Is this supposed to happen?

  • @twilightmarauder
    @twilightmarauder 2 หลายเดือนก่อน

    Hello! I’m checking out this video because I only have a loose grasp as to how to make the map method works. I’ve looked all over for an answer about this, but: do you, personally, know how I could do an if statement to check if an element in an array is “null”? As in, the content of an element in the array has that specific falsey value? The problem I’m having is that, no matter what I do, the project thinks I’m testing if the presence of the element is true or false, not the literal content of the element. I’m willing to even get a direction as to proceed. I’m not sure what exact search terms will give me what I want.

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 หลายเดือนก่อน

      I'm guessing you need ISNUMBER(MATCH together, but impossible to tell without seeing your data sample. Spreadsheet "falsey" is probably never going to be the exact same as JaavaScript falsey.

  • @paulloup5210
    @paulloup5210 5 ปีที่แล้ว +2

    Thank you very much !!!

  • @sneijder6148
    @sneijder6148 3 ปีที่แล้ว

    @Learn Google Spreadsheets
    /It's a translator.
    특정 열에서 값들을 각각 정해진 갯수만큼 가져오는 방법이 있습니까?
    (Is there a way to get a certain number of values from a particular column?)
    ex) as-is..
    [A , 1]
    [A , 2]
    [A , 3]
    [B , 4]
    [B , 5]
    [B , 6]
    [C , 7]
    [C , 8]
    [C , 9]
    행렬의 첫번째 열에서 A는 2개, B는 1개, C는 2개 만 가져오고 싶습니다.
    (In the first column of the matrix, I would like to bring 2 for A, 1 for B, and 2 for C.)
    ex) to-be..
    [A , 1]
    [A , 2]
    [B , 4]
    [C , 7]
    [C , 8]
    p.s.
    "I am watching your videos well. I'm very impressed. Thank you.
    "

  • @phoenixempire8886
    @phoenixempire8886 4 ปีที่แล้ว +1

    🙏🏻

  • @markanthonyalipao362
    @markanthonyalipao362 ปีที่แล้ว

    What if I want to append row in this arraw. Is there anyway that It wont overwrite the other existing row? because im trying to figure out how to update and add new data in existing record in my database. can you please help me with this. thanks

  • @giamar3026
    @giamar3026 5 ปีที่แล้ว

    Hi Teacher! Thank you as i always say for your excellent classes. Would you mind to show as how to add a random selection to the map return list? Than you again Erne

  • @pranodanpoudel9089
    @pranodanpoudel9089 3 ปีที่แล้ว

    Can you perform any date operations inside a 2D array using map function?
    Like adding a day, increment a month in google sheets using script

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 ปีที่แล้ว

      Yes, but dealing with dates is quite complicated.

  • @pedroivanmedinareyes8662
    @pedroivanmedinareyes8662 3 ปีที่แล้ว

    Thanks a Lot.

  • @goldyarora7450
    @goldyarora7450 4 ปีที่แล้ว

    Great tutorial as usual, thank you so much, is it possible to remove duplicates in the array with map?
    e.g in your case, let say you have 2 Linda two times, how can you remove the whole row based on the duplicate in cell of the row?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 ปีที่แล้ว +1

      map always returns the same number of rows as the original array. You will need to use forEach or reduce methods.

  • @KhalilYasser
    @KhalilYasser 5 ปีที่แล้ว +2

    Here's the code used in the video
    pastebin.com/WwCV2s6Q

  • @ConsulthinkProgrammer
    @ConsulthinkProgrammer 4 ปีที่แล้ว

    Sir, how I could change array from this?:
    [ ]i
    0: Array(5)
    0: "tes1"
    1: "tes2"
    2: "tes3"
    3: "tes4"
    4: "tes5"
    length: 5
    to this Sir:
    (5) ["tes1", "tes2", "tes3", "tes4", "tes5"]
    0: "tes1"
    1: "tes2"
    2: "tes3"
    3: "tes4"
    4: "tes5"
    length: 5

  • @hikeDiveEat
    @hikeDiveEat 5 ปีที่แล้ว +1

    Thank you. How do you add the "Math.round" function to the map method? For example, what if I want to round Column C to the nearest hundredth?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  5 ปีที่แล้ว

      .map( return Math.round(x*100)/100);

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  5 ปีที่แล้ว +3

      forgot the callback
      .map(function(x){ return Math.round(x*100)/100});

    • @hikeDiveEat
      @hikeDiveEat 5 ปีที่แล้ว

      @@ExcelGoogleSheets Thank you!

  • @gerardfernandez2530
    @gerardfernandez2530 4 ปีที่แล้ว +2

    Hope you receive back as much as you give

  • @yehudagoldberg8577
    @yehudagoldberg8577 2 ปีที่แล้ว

    What about arrow functions?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 ปีที่แล้ว

      What about them? You can use them if you want, works exactly the same way.

  • @AB17s
    @AB17s 3 ปีที่แล้ว

    So are map and filter function same??

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 ปีที่แล้ว +1

      Use map when you want to modify records in your data and get a result with exactly same number of rows as your original data.
      Use filter when you want to get a subset of your data, so instead of all rows it will get you some of them that match a certain criteria.

    • @AB17s
      @AB17s 3 ปีที่แล้ว

      @@ExcelGoogleSheets thank you for replying and that to so fast...👍 I have learned a lot from your videos , i always thought that i knew almost everything in google sheets but every video i watch i learn something new that is very helpful. Thats why i watch all your videos.

  • @khairulbasar2437
    @khairulbasar2437 4 ปีที่แล้ว

    Great tutorial! Thank you. Just wondered why not you have used 'column' instead of 'row' as a variable inside function!!! LOL

    • @pauledozie3325
      @pauledozie3325 2 ปีที่แล้ว

      He just used row , (I think though) for illustration. In my opinion, he could also have used cell[0] for clearer coding.

    • @pauledozie3325
      @pauledozie3325 2 ปีที่แล้ว

      Actually, just saw that it's a two dimensional array, it's possible to also use column to name them.

  • @franzgarden
    @franzgarden 5 ปีที่แล้ว

    you are very good but you should be a little more concise. E.g. on win you can display consolle.log just with ctrl + enter

    • @jarredkalweit5380
      @jarredkalweit5380 ปีที่แล้ว

      he mentioned that in one of the previous tutorials in this series

  • @vladk.6589
    @vladk.6589 4 ปีที่แล้ว

    как же это ахуенно! лайк подписка бубенцы