Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Top World Wide Web Interviews:Action ScriptAJAXBasic InternetBloggingCascading Style Sheet CSSCSS3DHTMLDomain Name System (DNS)EcommerceHTMLHTML5JavaScriptjQueryjQuery KnockoutJSONJSONPUser Interface DesignerVBScriptW3CWeb 2.0 TechnologiesWeb 3.0 TechnologiesWeb BuildingWeb DevelopersWeb QualityWeb SecurityWeb SemanticWebmaster
Copyright © 2018. All Rights Reserved
JavaScript Interview Question:
How to create arrays in JavaScript?
Submitted by: AdministratorWe can declare an array like this
<br>var scripts = new Array()
<br>We can add elements to this array like this
<br>
<br>scripts[0] = " PHP"
<br>scripts[1] = " ASP"
<br>scripts[2] = " JavaScript"
<br>scripts[3] = " HTML"
<br>
<br>Now our array scripts have 4 elements inside it and we can print or access them by using their index number. Note that index number starts from 0. To get the third element of the array we have to use the index number 2. Here is the way to get the third element of an array.
<br>document.write(scripts[2])
<br>We also can create an array like this
<br>var no_array = new Array(21, 22, 23, 24, 25)
<br>
Submitted by: Administrator
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.