+ 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
8 Réponses
+ 12
Nikhil I just said that I don't know the answer and you gave me a downvote 😬😤😠😡👹👺☠👎💥💣💢
+ 10
don't know JavaScript sorry 😥
+ 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.
+ 8
No problem now i got it
+ 7
I didn't downvoted your answer @Ekansh
+ 6
I don't get the question. Can you elaborate?
+ 4
@Nikhil : Okay then.
+ 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 🙂