0
Is there a much better way to write it using loops or a function ?
Heya Everyone and I am once asking for your help. I want to write the name of every single month using array.slice method but as I managed to write it name of every single month. I thought is there a way to write the name of every single month using loops or a function. So, Please help me Everyone. THANKS IN ADVANCE :) https://code.sololearn.com/Wy2EOMoZzhZw
2 Answers
+ 8
//try this
var months = ["January","February",...];
for (i =0;i<months.length;i++){
document.write(months[i]+",");
}
0
Alzy Welzy there is more easiest way to print month array
https://code.sololearn.com/WD607555koy8/?ref=app
What profit u are getting using this ??
1. U can set your own lang without rewriting for each and every lang
For example
En , ar , it ...etc
2. U can get short form for month
For example :
long --> January
short --> jan
Without rewriting it twice
3. U are getting any array as return đ