Question about loops
why we use for loops in javascript instead we can access any thing through built-in methods or if we save something in arrays then it could be easily accessed?why we use loops.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Joginder BangerRank #360 · 7K reputationPosted Feb 19, 2015, 10:46 AM EST
var obj = {
"flammable": "inflammable",
"duh": "no duh"
};
$.each( obj, function( key, value ) {
alert( key + ": " + value );
})
Jignesh TrivediRank #16 · 50.3K reputationPosted Feb 19, 2015, 6:09 PM EST
Hi,
Loop is very important feature of any language. As you suggest we can use through built in methods but In some case built in method is also use loop internally...
Nanhe SiddiqueRank #1,103 · 1.7K reputationPosted Feb 19, 2015, 6:14 PM EST
umair mohsinRank #3,092 · 463 reputationPosted Feb 19, 2015, 8:37 PM EST
umair mohsinRank #3,092 · 463 reputationPosted Feb 19, 2015, 8:40 PM EST
var arr1=["a","b","c"];
then i can access this array with
document.write(arr1);
or through index no of an array so what is the use of loop