+ 7

Can anyone solve this..please help!!

THESE ARE THE TASKS:- nextInLine([], 1) should return 1 nextInLine([2], 1) should return 2 nextInLine([5,6,7,8,9], 1) should return 5 After nextInLine(testArr, 10), testArr[4] should be 10 THIS IS THE CODE :-IN JS:- ā€‹ function nextInLine(arr, item) { // Your code here return item; // Change this line } ā€‹ // Test Setup var testArr = [1,2,3,4,5]; ā€‹// Display Code console.log("Before: " + JSON.stringify(testArr)); console.log(nextInLine(testArr, 6)); // Modify this line to

4th Apr 2017, 8:17 AM
Nikhil
Nikhil - avatar
8 Answers
+ 12
Nikhil I just said that I don't know the answer and you gave me a downvote šŸ˜¬šŸ˜¤šŸ˜ šŸ˜”šŸ‘¹šŸ‘ŗā˜ šŸ‘ŽšŸ’„šŸ’£šŸ’¢
4th Apr 2017, 4:22 PM
Ekansh
+ 10
don't know JavaScript sorry šŸ˜„
4th Apr 2017, 11:28 AM
Ekansh
+ 8
Sir the most explanation i can give is:- Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.
5th Apr 2017, 9:42 AM
Nikhil
Nikhil - avatar
+ 8
No problem now i got it
5th Apr 2017, 9:48 AM
Nikhil
Nikhil - avatar
+ 7
I didn't downvoted your answer @Ekansh
5th Apr 2017, 9:41 AM
Nikhil
Nikhil - avatar
+ 6
I don't get the question. Can you elaborate?
5th Apr 2017, 1:28 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 4
@Nikhil : Okay then.
5th Apr 2017, 11:06 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 4
Please don't give challenges,homeworks or Assignments here QnA forum is only limited to programming related queries or Sololearn issues Please move this question to your activity feed or show your atttempt for further help Follow our Guidelines:- https://www.sololearn.com/discuss/333866/?ref=app HaPpY CoDiNg šŸ™‚
17th Jun 2020, 4:20 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar