Answer to Question #3228 in AJAX | JavaScript | HTML | PHP for kathryn

Question #3228
Suppose variables are declared and initialised as follows:

var firstArray = ['I','V','X','L','C','D','M'];
var secondArray = [1,5,10,50,100,500,1000];
var myString = 'INVICTUS';

Write down the value of each of the following????

(a) firstArray[2]
(b) firstArray.length
(c) The index of 'M'in firstArray
(d) The index of the first element in secondArray
(e) firstArray.length == myString.length
(f) firstArray[secondArray[1]]
(g) firstArray[2] < firstArray[6]
(h) myString.charAt(3) == firstArray[0]
(i) myString.charAt(myString.indexOf('S'))
(j) myString.indexOf(firstArray[3])
1
Expert's answer
2011-06-25T06:39:10-0400
Let variables be declared and initialised as follows:
&
& var firstArray = ['I','V','X','L','C','D','M'];
& var secondArray = [1,5,10,50,100,500,1000];
& var myString = 'INVICTUS';

Then

(a) firstArray[2] & & & & & & & & & & & & : 'X'
(b) firstArray.length & & & & & & & & & & & & : 7
(c) The index of 'M'in firstArray & & & & & & & : 6
(d) The index of the first element in secondArray & & : 0
(e) firstArray.length == myString.length & & & & : false
(f) firstArray[secondArray[1]] & & & & & & & & : 'D'
(g) firstArray[2] < firstArray[6] & & & & & & & & : false
(h) myString.charAt(3) == firstArray[0] & & & & & : true
(i) myString.charAt(myString.indexOf('S')) & & & & & : 'S'
(j) myString.indexOf(firstArray[3]) & & & & & : -1, since firstArray[3] is 'L' and this char does not occcur in myString

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS