Stand In Line javaScript Exercise ! Stuck!

Stand In Line javaScript Exercise ! Stuck!
0

#81

Hmmmm…now you got me. Somehow I have heard that term (FCC) used somewhere but surely it isn’t Federal Communications Commission. What does FCC mean in computer programming lingo?


#82

function nextInLine(arr, item) {
// Your code here
arr.push(item);
var removed = arr.shift();
return removed; // 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 test
console.log("After: " + JSON.stringify(testArr));


#83

@Owamamwen Hey the arr.shift() should be asigned to one of the parameters of the function. You already have arr using the correct method.


#84

Its because of the wording in the exercise that people get stuck on this one. And because we’re noobs. I think the first thing it says is to write a method but the method is already there so its totally confusing from there on out.


#85

i managed to compete this exercise myself, but only after reading a bunch of explanation in this thread… i think the exercise is poorly designed/thought out for noobies at this stage of javascript/programming knowledge.


#86

Eh. This was a pretty difficult one. There is way too much there that isn’t explained. It assumes way too much. Really recommend updating.


#87

This one breaks if you set the arr.shift() to a variable and then return the variable instead of just returning arr.shift(), even though that obviously outputs the same thing.


#88

Hello World!!!, I’ve been 2 days to make it, but i did it, the problem was that we must to make a variable with arr.shift and then return it. We must to print the number we are taking off, thats our target in this exercise. Here i show you how i did it. I hope it help you, long life to code and i love python :slightly_smiling_face:


#89

Hello what we must to do there is just print the number we are taking off, thats all, it is easier than it’s looks like, here i left my code, i ve been 2 days solving it, hahahahah, but finilly i did it, here i left the code

function nextInLine(arr, item) {
// Your code here
arr.push(item);
var restado=arr.shift();
return restado;// Change this line

}

// Test Setup
var testArr = [5,6,7,8,9];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 10)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));


#90

thanks alot i finally pass this confusing challenge


#91

this is working for mew

function nextInLine(arr, item) {
// Your code here

arr.push(item);
var firstItemDelete = arr.shift(arr);
return firstItemDelete; // 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 test
console.log("After: " + JSON.stringify(testArr));


#92

All of your break downs down thru here were so helpful! I admit…I had to go thru each one before I started making sense of it for sure. The key thing for me on this one? Right to Left! I was looking at the wrong side!! THANKS AGAIN!!


#93

You saved me i had the same error was overseeing! Thank you!


#94

i read your explaination here like 10 times or more lol… finally i was blown and understand, thanks for help much appreciated


#95

I understand so much more after all this! FCC challenges are great but sometimes its lacking clear explanations. Thank you!


#96

No problem at all. I’m so glad that my explanations are still helping people.


#97

Sorry about the long long wait in answering. It’s been a while since I logged in here. Anyhow, as you have probably figured out by now, FCC is short for Free Code Camp. :slight_smile:


#98

LOL lordt I feel silly.

But appreciate your reply. Thank you!


#99

Hi to all …Can any one help me here ?

var myMusic = [
{
“artist”: “Billy Joel”,
“title”: “Piano Man”,
“release_year”: 1973,
“formats”: [
“CS”,
“8T”,
“LP” ],
“gold”: true
},
{
// Add record here
"myMusic[1]": [
“artist”: “daft punk”,
“8T”,
“LP” ],
},
];

Questions are :

myMusic should be an array
myMusic should have at least two elements
myMusic[1] should be an object
myMusic[1] should have at least 4 properties
myMusic[1] should contain an artist property which is a string
myMusic[1] should contain a title property which is a string
myMusic[1] should contain a release_year property which is a number
myMusic[1] should contain a formats property which is an array
formats should be an array of strings with at least two elements


#100

still not working …

var myMusic = [
{
“artist”: “Billy Joel”,
“title”: “Piano Man”,
“release_year”: 1973,
“formats”: [
“CS”,
“8T”,
“LP” ],
“gold”: true
},
// Add record here

ourMusic = [
{
“artist”: “Umair”,
“title”: “Khan”,
“release_year”: 995,
“formats”: [
“DC”,
“SC”,
“SD” ],
“Metal”: true
}
]
];