Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Jonathan Herman
    @lantech19446
    ok cool, I won't be at the meeting because work but I'll post my questions at some point. Most of the array stuff really has me thrown for a loop so maybe i'll hold off until I watch the videos for it too
    Robert Maylie
    @rmaylie9560
    Night
    Jonathan Herman
    @lantech19446
    night mike
    Lily Romano
    @Lilyheart
    I’m going to try to sleep hahahahahaahah so hopefully I won’t feel like a zombie tomorrow.
    Jonathan Herman
    @lantech19446
    ok Lily have a great night
    Robert Maylie
    @rmaylie9560
    .push(); puts an ideam on the front of an array. .pop(): takes it from the back. You can use them in stacks (FILO) and queues(LIFO) (in pretentious programmer talk)
    Lily Romano
    @Lilyheart
    push/pop are both end
    shift/unshift are front
    Robert Maylie
    @rmaylie9560
    Meh, I'm wrong. 😑
    Lily Romano
    @Lilyheart
    shift/unshift are backwards too by what my gut reaction is. what it is is shift removes the first (it shifts the pointer for the first item from the old index 0 to 1 making 1 the new 0.
    I only know @rmaylie9560 because I spent far to much time trying to understand the stupidness that is the names to shift/unshift.
    If I can’t logic it, I can’t remember it.
    Jonathan Herman
    @lantech19446
    yea I mean i get that stuff but some of the orders of it and where the variables are called are confusing me mix that in with tiredness and the fact that suddenly they have all this JSON stuff at the bottom where JSON has not been mentioned once and i'm completely clueless. Think I'm gonna sleep though I'll deal tomorrow
    David Castner
    @davidjcastner
    @lantech19446 feel free to tag me in your questions
    Jonathan Herman
    @lantech19446
    so I got the answer the part that keeps confusing me is seeing something like var testArr = [1,2,3,4,5]; and keeping in mind that I need to use the arguments to manipulate them, like i'm expecting to see somewhere in the code where arr and item are defined
    Jonathan Herman
    @lantech19446
    I'm so screwed up on JS though I think i'm going to finish the intro course and then mess with more of this.
    Lily Romano
    @Lilyheart
    Here is the entire code for reference
    
    function nextInLine(arr, item) {
      // Your code here
      arr.push(item);
      removed = arr.shift();
      return removed;  // Change this line
    }
    
    // Test Setup
    var testArr = [];
    
    // Display Code
    console.log("Before: " + JSON.stringify(testArr));
    console.log(nextInLine(testArr, 1)); // Modify this line to test
    console.log("After: " + JSON.stringify(testArr));
    So on the Stand In Line problem, at the bottom you can see the call nextInLine(testArr, 1)
    And at the top you see a very similar line function nextInLine(arr, item) {
    Even tho those lines are similar (both have nextInLine with two things in parenthesis, the first one in the function definition because it has the function keyword at the start.
    That makes the second one the function call.
    In the function definition, the things inside the () are called parameters. In the call, they are called arguments.
    After the function declaration, testArr was defined (as an empty array).
    That next to last line calls nextInLine and sends two arguments (kinda like a bash command).
    Lily Romano
    @Lilyheart
    The function takes those arguments and assigned their value to it's parameters (still like bash and a bash script). The function keeps them in the same order (kinda like bash script does with $1 and $2).
    So arr gets automatically defined as the first argumentand item is defined at the second argument. In the above code it's the same as if it said
    var arr = testArr; //The first argument and the first parameter.
    var item = 1;//The second argument and the first parameter.
    Jonathan Herman
    @lantech19446
    sorry had to run out real fast to take my wife to work 2hrs early
    Lily Romano
    @Lilyheart
    No worries!
    Jonathan Herman
    @lantech19446
    ok that makes way more sense
    Lily Romano
    @Lilyheart
    I’m glad! It’s a bit tricksey and I had to take a step back the first time I saw that concept.
    Jonathan Herman
    @lantech19446
    I still think I need to finish the JS videos too because there's like no explanation to speak of but at least i'm on 200 finally lol
    Lily Romano
    @Lilyheart
    Yay 200! Back to videos! I’ve gone back to my udemy videos as well.
    Jonathan Herman
    @lantech19446
    it's just so hard to listen to this guy lol
    Lily Romano
    @Lilyheart
    Maybe try Khan academy’s lessons? I think it was @dewhiz that recommened it but I can’t be sure. I’ve done some of the math lessons & videos there.
    Jonathan Herman
    @lantech19446
    that's one of the free ones right?
    Lily Romano
    @Lilyheart
    Yup yup!
    Jonathan Herman
    @lantech19446
    nice, I think I'll go sign up for it I can't stand ben stein much longer
    Lily Romano
    @Lilyheart
    :laughing:
    Jonathan Herman
    @lantech19446
    I wish I could upload my own avatar lol
    Lily Romano
    @Lilyheart
    On KA? Yeah. But I kind came to like my little leaf dude and watching him grow up.
    Jonathan Herman
    @lantech19446
    I didn't realize they grew in that moment I was just thinking because in Hinduism we call the different forms of Krishna avatars lol
    I wonder which JS course i should take
    Jonathan Herman
    @lantech19446
    @Lilyheart any opinions?
    Lily Romano
    @Lilyheart
    Lemme peek
    Intro to JS
    Jonathan Herman
    @lantech19446
    ok, I was thrown off by the fact that it was geared towards like drawing and didn't know what processingJS is.
    Lily Romano
    @Lilyheart
    Announcing a new MontCode Event - http://montco.de/pass-a-pen-rules-1
    Jonathan Herman
    @lantech19446
    I might get in on this, Rob asked me about doing this with him a day or two ago. Maybe by then I'll be able to do JS a little better and make something cool
    Lily Romano
    @Lilyheart
    You can use as little or as much JS as you want!
    Jonathan Herman
    @lantech19446
    yea but I feel like it would be the best challenge and learning exercise for me right now