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
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.
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!
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;
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?
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.
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.
@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. "
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
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
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?
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.
@@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.
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.
This is the simplest and very efficient tutorial about map in entire TH-cam. Really appreciate your work
Thanks a lot!
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!
Thanks a lot for great tutorials. God bless you
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;
Your style of presentation is spot on.
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!
useful
Map is the most interesting method i found in JavaScript
its very useful.... thank you...
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?
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.
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.
Thank you very much !!!
@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.
"
🙏🏻
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
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
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
Yes, but dealing with dates is quite complicated.
Thanks a Lot.
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?
map always returns the same number of rows as the original array. You will need to use forEach or reduce methods.
Here's the code used in the video
pastebin.com/WwCV2s6Q
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
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?
.map( return Math.round(x*100)/100);
forgot the callback
.map(function(x){ return Math.round(x*100)/100});
@@ExcelGoogleSheets Thank you!
Hope you receive back as much as you give
What about arrow functions?
What about them? You can use them if you want, works exactly the same way.
So are map and filter function same??
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.
@@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.
Great tutorial! Thank you. Just wondered why not you have used 'column' instead of 'row' as a variable inside function!!! LOL
He just used row , (I think though) for illustration. In my opinion, he could also have used cell[0] for clearer coding.
Actually, just saw that it's a two dimensional array, it's possible to also use column to name them.
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
he mentioned that in one of the previous tutorials in this series
как же это ахуенно! лайк подписка бубенцы