Welcome to SomaliNet Forums, a friendly and gigantic Somali centric active community. Login to hide this block

You are currently viewing this page as a guest. By joining our community you will have the ability to post topics, ask questions, educate others, use the advanced search, subscribe to threads and access many, many other features. Registration is quick, simple and absolutely free. Join SomaliNet forums today! Please note that registered members with over 50 posts see no ads whatsoever! Are you new to SomaliNet? These forums with millions of posts are just one section of a much larger site. Just visit the front page and use the top links to explore deep into SomaliNet oasis, Somali singles, Somali business directory, Somali job bank and much more. Click here to login. If you need to reset your password, click here. If you have any problems with the registration process or your account login, please contact us.

MODULE3: ARRAYS WITH BABY LOOPY part1

Qaybta Xirfada Sayniska iyo iwm

Moderators: Moderators, Junior Moderators

OUR SPONSOR: LOGIN TO HIDE
User avatar
afisoone
SomaliNet Super
SomaliNet Super
Posts: 5483
Joined: Wed Jul 22, 2009 9:46 pm
Location: We all want to become president even though Amisom controls Mogadishu

MODULE3: ARRAYS WITH BABY LOOPY part1

Postby afisoone » Sat Oct 08, 2016 3:20 pm

The best part of the any language you learning is array. It is every important part.

Every game designer familiar with this loop..

let's have an array first.

let somalistate=['puntland','Somaliland','Jubaland','galmudug'];

now let is loop......
<script type="text/javascript">

let somalistate=['puntland','Somaliland','Jubaland','galmudug'];
for(let i=0; i<somalistate.length;i++)
{
daabac=somalistate;
console.log(daabac);
}



</script>


It will display
puntland Somaliland jubaland


But there is similar way you can do it using..... Foreach and call back function

here is and example..

Somalistate.forEach(sooDaabac);

SooDaabac is a call back function that will display the result. Let's build the the function now..

somalistate.forEach(sooDaabac);
function sooDaabac(daabac){
console.log(daabac);
}


As you can see we can use that call back as template to display many arrays..... you can create another array and that function it will display for you. It is what forEach does..
we will continue with array...

OUR SPONSOR: LOGIN TO HIDE

Hello, Has your question been answered on this page? We hope yes. If not, you can start a new thread and post your question(s). It is free to join. You can also search our over a million pages (just scroll up and use our site-wide search box) or browse the forums.

  • Similar Topics
    Replies
    Views
    Last post

Return to “Careers - Engineering, Science & Computers”

Who is online

Users browsing this forum: No registered users and 3 guests