Hi everyone! Just wanted to introduce myself here. I signed up only a few days ago, but have been hooked on freeCodeCamp. Learning to code has been on my to do list for many years, but other interests, kids, life in general, and procrastination on my part has made me put if off for years.
Anyway I just figured out The Stand in Line Challenge and wanted to offer a little bit of advice to anyone else similar to my situation. I have very basic knowledge of HTML and CSS, I took a C++ class during my college days which was over 10 years ago! I was cruising through the challenges feeling pretty good and able to figure things out pretty quickly right until I got to The Stand in Line Challenge, I was getting frustrated because I really had no idea what I needed to do. I took a break and then decided to look for something to help me grasp the very basics of JavaScript, because I could get through the earlier challenges fine, but I wasn’t really remembering the concepts of arrays and how to manipulate them.
I found a book on Amazon called A Smarter Way to Learn JavaScript by Mark Myers, (In truth I downloaded a book called JAVA Crash Course, then realized that JavaScript and JAVA aren’t the same lol, just goes to show how much of a beginner I am). Anyway I know this book may be way too simplified for others but it helped me a ton and I thought others might be in the same situation as me. The part that really helped me was after each chapter it has really simple, almost seems too easy online exercises but the explanation and repetition helped me greatly grasp the concepts better.
Also here is my code from the challenge, if anyone has any pointers or suggestions on improving I would greatly appreciate it. Thanks, I look forward to meeting everyone here
function nextInLine(arr, item) {
// Your code here
arr.push(item);
var removedNumber = arr.shift();
return removedNumber; // 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));