write a loop that will print out the contents of arr2 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

write a loop that will print out the contents of arr2

use this format XXXXX is paying the amount of YYYY and his/her IP address is ZZZZZ. var arr2 = new Array(); arr2[0] = new Array("Jon W.","801.222.9900","$8.50"); arr2[1] = new Array("Ken B.","801.373.1234","$7.50"); arr2[2] = new Array("Ryan P.","801.989.4321","$9.50"); arr2[3] = new Array("Diana E.","801.878.6666","$6.50"); arr2[4] = new Array("Gordon B.","801.555.4343","$5.50"); hope someone can help me about this

30th Jun 2021, 9:30 PM
Ybes Dignaran
Ybes Dignaran - avatar
1 Answer
+ 4
arr2.forEach( e => { console.log( `${e[0]} is paying the amount of ${e[2]} and his/her IP address is ${e[1]}.` ); }); * Reference: https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/foreach https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
30th Jun 2021, 9:59 PM
Ipang