Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Feb 01 00:26
    @bjorno43 banned @Ndoua
  • Jan 07 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • May 10 2019 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 2019 17:12
    @mstellaluna banned @cmal
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:11
    thecodingaviator labeled #31179
  • Apr 01 2019 18:09
    thecodingaviator commented #31179
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:09
    thecodingaviator labeled #31182
  • Apr 01 2019 18:07
    thecodingaviator commented #31182
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator labeled #31190
  • Apr 01 2019 18:07
    thecodingaviator commented #31190
  • Apr 01 2019 18:05
    thecodingaviator commented #31157
  • Apr 01 2019 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 2019 18:04
    thecodingaviator closed #31157
  • Apr 01 2019 18:04
    thecodingaviator closed #33788
  • Apr 01 2019 18:04
    thecodingaviator commented #33788
Alexander Køpke
@alexanderkopke
@HeebieGeeBee destroyer is the function and it has arr as a parameter... when you call it you can pass arguments like this: destroyer([1, 2, 3, 1, 2, 3], 2, 3); the arr parameter will be [1, 2, 3, 1, 2, 3]
Walid Ashri
@walidashri
@HeebieGeeBee all what is passed between the () when you call the function
HeebieGeeBee
@HeebieGeeBee
so i can just write arguments into code?
instead of arr or whatever the actual argument is called
so in this code would arguments.length do the same things as writing arr.length?
Alexander Køpke
@alexanderkopke
@HeebieGeeBee yes arguments will hold whatever is being passed. It is array like but not an actual array, So if you treat it like a normal array it might cause problems
there are three arguments passed. arr will take the first arguments which is the array
HeebieGeeBee
@HeebieGeeBee
oh ok cool ty @alexanderkopke and @walidashri
CamperBot
@camperbot
heebiegeebee sends brownie points to @alexanderkopke and @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 890 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
:cookie: 772 | @walidashri |http://www.freecodecamp.com/walidashri
Gilbert
@GilTorch
Alexander Køpke
@alexanderkopke
to access the other arguments you can use arguments
Joshua
@jfc246

how do i assign lots of different objects to return different things? i'm stuck on Stand in Line
i think that is the problem
code:


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 test
console.log("After: " + JSON.stringify(testArr));

link: https://www.freecodecamp.com/challenges/stand-in-line#?solution=%0Afunction%20nextInLine(arr%2C%20item)%20%7B%0A%20%20%2F%2F%20Your%20code%20here%0A%0A%20%20return%20item%20%3B%20%20%2F%2F%20Change%20this%20line%0A%7D%0A%0A%2F%2F%20Test%20Setup%0Avar%20testArr%20%3D%20%5B1%2C2%2C3%2C4%2C5%5D%3B%0A%0A%2F%2F%20Display%20Code%0Aconsole.log(%22Before%3A%20%22%20%2B%20JSON.stringify(testArr))%3B%0Aconsole.log(nextInLine(testArr%2C%206))%3B%20%2F%2F%20Modify%20this%20line%20to%20test%0Aconsole.log(%22After%3A%20%22%20%2B%20JSON.stringify(testArr))%3B%0A

ge022
@ge022
Ya'll, what does a sub array look like?
Alexander Køpke
@alexanderkopke
@jfc246 each function can only return one thing. But it can run code before it returns something which is what is needed here. You have to push item to the arr array. And then remove the first element in that array and return it.
RhinoTek
@RhinoTek
Has anyone done the Stand in line challenge?
Alexander Køpke
@alexanderkopke
@ge022 I guess it is an array within an array?! [1, 2, 3, ["a", "b", "c"]] the last one I would call a sub array
@RhinoTek yes
Joshua
@jfc246
how would i do that? @alexanderkopke
Alexander Køpke
@alexanderkopke
@jfc246 what methods have you learned working with arrays? it is ok if you don't remember just asking
@jfc246 I believe you have learned about the push method and the shift method
So push pushes something to the array. Here is an example: array.push("hello"); <-- this would add "hello" to the array named array.
Joshua
@jfc246
@alexanderkopke like this?
ourArray.push(["happy", "joy"]);
Alexander Køpke
@alexanderkopke
@jfc246 exactly! Here you push ["happy", "joy"] to the ourArray array
@jfc246 in the example you're at arr is the array and item is what need to be pushed to that array
Joshua
@jfc246

@alexanderkopke so would i replace the

our Array

with

nextInLine
?
Alexander Køpke
@alexanderkopke
nextInLine is the function. You need to work inside the function and use arr as an array and itemas a variable
Joshua
@jfc246
so replace it with a
arr
Alexander Køpke
@alexanderkopke
arr.push(item); // this is the first task
Braybray54321
@Braybray54321
I need help with the javascript escaping literal quotes in strings
NITEHAWK07
@NITEHAWK07
Can anyone help me with JavaScript Record Collection?

// Setup
var collection = {
    "2548": {
      "album": "Slippery When Wet",
      "artist": "Bon Jovi",
      "tracks": [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    "2468": {
      "album": "1999",
      "artist": "Prince",
      "tracks": [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    "1245": {
      "artist": "Robert Palmer",
      "tracks": [ ]
    },
    "5439": {
      "album": "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
  collection["5439"].artist = collection["5439"].artist.ABBA;

  return collection;
}

// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");
RhinoTek
@RhinoTek
@alexanderkopke so next would be arr.shift(item);
Zane Hewgley
@zhewgley

So I am kind of confused on passing values to functions with arguments.
I am suppose to create a function called functionWithArgs that accepts two arguments and outputs their sum to the dev console. Then call the function.
// Example
function ourFunctionWithArgs(a, b){
console.log(a - b);
}
ourFunctionWithArgs(10, 5); // Output 5

// Only change code below this line.

I am confused as to where and the hell the call for (10, 5) came from. It's saying I need to create a functionWithArgs(1, 2) should output 3 and functionWithArgs(7, 9) should output 16. Then call it. I replaced the code in the example with whats given but what do I call it with...

Alexander Køpke
@alexanderkopke
\ <--this is the Houdini of escaping. Anything after you escape. \" for example @Braybray54321
Braybray54321
@Braybray54321
the instructoons are "Use backslashes to assign a string to the myStr variable so that if you were to print it to the console, you would see:
I am a "double quoted" string inside "double quotes"."
NITEHAWK07
@NITEHAWK07
Brayden is that you?
Braybray54321
@Braybray54321
@NITEHAWK07 erm what do u mean?
Joshua
@jfc246
@NITEHAWK07 @Braybray54321 do you guys know each other?
RhinoTek
@RhinoTek
@alexanderkopke like this
arr.push(item);
arr.shift(item);// Change this line
Braybray54321
@Braybray54321
@jfc246 idk
NITEHAWK07
@NITEHAWK07
I think I may know him... I have a friend at school that everyoe calls Bray Bray
Alexander Køpke
@alexanderkopke
@RhinoTek shift doesn't take an arguments. so arr.shift() is sufficient. However, you'll have to store what it removes. Like in a variable which you can then return
Braybray54321
@Braybray54321
@NITEHAWK07 Well if everyone calls that Brayden that then that's not me
NITEHAWK07
@NITEHAWK07
Do u live in the state of PA?
Alexander Køpke
@alexanderkopke
@RhinoTek var removed = arr.shift(); like this
Braybray54321
@Braybray54321
@NITEHAWK07 no
NITEHAWK07
@NITEHAWK07
ok, then not you