Given the array below, please complete the expression to be alearted with"apple". | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Given the array below, please complete the expression to be alearted with"apple".

var fruits=new array("pear","orange","apple"," grapefruit"); alert(fruits............);

14th Apr 2017, 12:05 PM
Abdelrahim Ismail
Abdelrahim Ismail - avatar
8 Answers
+ 8
fruits[2] You should know how to access elements of an array, so I would suggest going through the tutorial or at least that part of it. Unless I didn't understand what are asking.
14th Apr 2017, 12:30 PM
J.G.
J.G. - avatar
+ 3
alter(fruits[2]);
1st Nov 2017, 7:46 AM
Hassan Shaikh
Hassan Shaikh - avatar
+ 2
var fruits = new Array("pear", "orange", "apple", "grapefruit"); alert(fruits [2] );
23rd Mar 2018, 1:46 PM
Mahnoor Shahzad
Mahnoor Shahzad - avatar
0
yes thank you 👍
14th Apr 2017, 12:55 PM
Abdelrahim Ismail
Abdelrahim Ismail - avatar
0
Given the array below, please complete the expression to be alerted with "apple". var fruits = new Array("pear", "orange", "apple", "grapefruit"); alert(fruits [2] );
13th Jan 2019, 5:43 AM
Shahriar Hossain
Shahriar Hossain - avatar
0
[2]. bcoz of array starts to 0.. [0]-pear [1]-orange [2]-apple [3] grapefruit
20th Nov 2020, 3:41 PM
Ali
Ali - avatar
- 1
12 // number "some text" //............ true // ............
31st Jul 2018, 5:13 AM
Amr Ali Ebrahim El-Dosouky
- 1
[2]
19th Aug 2018, 6:06 AM
Azharo
Azharo - avatar