These are chat archives for FreeCodeCamp/HelpJavaScript

3rd
Mar 2016
OmMinky
@OmMinky
Mar 03 2016 00:00 UTC
js
var myMusic = [
  {
    "artist": ["Billy Joel", "Minky"],
    "title": ["Piano Man", "hi"],
    "release_year": [1973, 1999,]
    "formats": [ 
      "CS", 
      "8T", 
      "LP"],
    "gold": true
  }
  // Add record here
];
William
@apswak
Mar 03 2016 00:00 UTC
@mateusfccp performaticless?
greg
@wearenotgroot
Mar 03 2016 00:00 UTC
@OmMinky `
var myMusic = [
  {
    "artist": ["Billy Joel", "Minky"],
    "title": ["Piano Man", "hi"],
    "release_year": [1973, 1999,], //<------------commas here as well
    "formats": [ 
      "CS", 
      "8T", 
      "LP"],
    "gold": true
  },//<------------------------comma to separte
  // Add record here
{
 "artist": ["AA", "AAA"],
    "title": ["Piano Man", "hi"],
    "release_year": [1973, 1999,],  //<------------commas here as well
    "formats": [ 
      "CS", 
      "8T", 
      "LP"],
    "gold": true
  }
];
Mateus Felipe C. C. Pinto
@mateusfccp
Mar 03 2016 00:00 UTC
largestOfFour = (arr) => arr.map(v => Math.max.apply(v));
@kreitzo Yes, it's slow.
@kreitzo Try the solution above.
Jeff
@adzam5
Mar 03 2016 00:02 UTC
@erdaltaskesen You dont want to return count after each if statement and the second if statement isnt needed
OmMinky
@OmMinky
Mar 03 2016 00:03 UTC
thanks @wearenotgroot, will try
CamperBot
@camperbot
Mar 03 2016 00:03 UTC
omminky sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star: 947 | @wearenotgroot | http://www.freecodecamp.com/wearenotgroot
Rsnizzle
@Rsnizzle
Mar 03 2016 00:04 UTC
a
Jeff
@adzam5
Mar 03 2016 00:06 UTC
@erdaltaskesen you are missing "10" from your if statement as well
William
@apswak
Mar 03 2016 00:06 UTC
@mateusfccp it returns [null,null,null,null]
Mateus Felipe C. C. Pinto
@mateusfccp
Mar 03 2016 00:09 UTC
Sorry.
@kreitzo
largestOfFour = (arr) => arr.map(v => Math.max.apply(null, v));
Now this will work.
OmMinky
@OmMinky
Mar 03 2016 00:09 UTC
@wearenotgroot, got it thanks, the commas and { helped
CamperBot
@camperbot
Mar 03 2016 00:09 UTC
omminky sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:warning: omminky already gave wearenotgroot points
greg
@wearenotgroot
Mar 03 2016 00:10 UTC
@OmMinky np
Moisés Man
@moigithub
Mar 03 2016 00:14 UTC
if u already using es6 syntax.. why not use spread operator too ? :) @mateusfccp @kreitzo
Mateus Felipe C. C. Pinto
@mateusfccp
Mar 03 2016 00:15 UTC
@moigithub Don't think it would help in this example. How would you use it?
Moisés Man
@moigithub
Mar 03 2016 00:16 UTC
largestOfFour = (arr) => arr.map(v => Math.max(...v));
should be like that i think
Mateus Felipe C. C. Pinto
@mateusfccp
Mar 03 2016 00:17 UTC
@moigithub I think it doesn't work.
Moisés Man
@moigithub
Mar 03 2016 00:19 UTC
https://repl.it/BsVY works fine here
Mateus Felipe C. C. Pinto
@mateusfccp
Mar 03 2016 00:20 UTC
@moigithub Can you explain me?
I didn't know spread could be used as pure arg.
Oh, just got it.
In MDN.
Moisés Man
@moigithub
Mar 03 2016 00:21 UTC

v is a subArray...

using apply is the same as using spread operator

Mateus Felipe C. C. Pinto
@mateusfccp
Mar 03 2016 00:23 UTC
Ok, so @kreitzo largestOfFour = (arr) => arr.map(v => Math.max(...v)); would do better.
Moisés Man
@moigithub
Mar 03 2016 00:23 UTC
spread operator "feeds" each element to the function.. just like apply does
Pedro Abel Díaz Sánchez
@coderHook
Mar 03 2016 00:23 UTC
Can someone explain me in the bonfire: Arguments Optional
What does it mean this entry: add(2)(3)
Moisés Man
@moigithub
Mar 03 2016 00:24 UTC
This message was deleted
Mateus Felipe C. C. Pinto
@mateusfccp
Mar 03 2016 00:24 UTC
@moigithub Yeah, typo.
greg
@wearenotgroot
Mar 03 2016 00:24 UTC
@Abel1987 it just execute the function add twice
Pedro Abel Díaz Sánchez
@coderHook
Mar 03 2016 00:24 UTC
Does it mean that first I enter two and then after I enter three? How do I enter, in that case, the second number?
greg
@wearenotgroot
Mar 03 2016 00:24 UTC
@Abel1987 because the first add call will return a function
Pedro Abel Díaz Sánchez
@coderHook
Mar 03 2016 00:25 UTC
could you give me an example?
greg
@wearenotgroot
Mar 03 2016 00:25 UTC

@Abel1987 then that function is then executed

add(2); //------>should return a function that accepts a single parameter(a number) and use it to add to this parameter
add(3);
answer: 5

Mateus Felipe C. C. Pinto
@mateusfccp
Mar 03 2016 00:28 UTC
wiki arguments optional
CamperBot
@camperbot
Mar 03 2016 00:28 UTC

:point_right: algorithm arguments optional [wiki]

Explanation:

It can be quite complicated to understand what needs to be done. There are always many ways to do something when coding but regardless of the algorithm used, we have to create a program that does the following:

  • It has to add two numbers passed as parameters and return the sum.
  • It has to check if any of the numbers are actual numbers, otherwise return undefined and stop the program right there.
  • It has to check if it has one or two arguments passed. More are ignored.
  • If it has only one argument then it has to return a function that uses that number and expects another one, to then add it.

:pencil: read more about algorithm arguments optional on the FCC Wiki

jre08
@jre08
Mar 03 2016 00:57 UTC
help profile lookup
CamperBot
@camperbot
Mar 03 2016 00:57 UTC

:point_right: checkpoint profile lookup [wiki]

Checkpoint: Profile Lookup

Instructions

We have an array of objects representing different people in our contacts lists.

A lookUp function that takes firstName and a property (prop) as arguments has been pre-written for you.

The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact.

If both are true, then return the "value" of that property.

If firstName does not correspond to any contacts then return "No such contact"

If prop does not correspond to any valid properties then return "No such property"

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about checkpoint profile lookup on the FCC Wiki

Chris Davis
@chrisdav6
Mar 03 2016 00:58 UTC
quick question, can anyone help me understand how to optimize this with a nested if statement...
function update(id, prop, value) {
  if (value !== "" && prop === "tracks") {
    collection[id][prop].push(value);
  }else if(value !== "") {
    collection[id][prop] = value;
  }else {
    delete collection[id][prop];
  }
This message was deleted
the !== in both conditions seems redundent
Greg D
@mosaic-greg
Mar 03 2016 01:13 UTC
@chrisdav6 do you want to optimise it or just make it work? i think the solution on the wiki is pretty optimal
Chris Davis
@chrisdav6
Mar 03 2016 01:19 UTC
figured it out! Was looking for optimization. Thank you @mosaic-greg
if(value !== "") {
    if(prop === "tracks") {
      collection[id][prop].push(value);
    } else {
      collection[id][prop] = value;
    }
  } else {
    delete collection[id][prop];
  }
CamperBot
@camperbot
Mar 03 2016 01:19 UTC
chrisdav6 sends brownie points to @mosaic-greg :sparkles: :thumbsup: :sparkles:
:star: 312 | @mosaic-greg | http://www.freecodecamp.com/mosaic-greg
JackeL
@jackel27
Mar 03 2016 01:26 UTC
Here is something I made earlier to help understand for loops with nested arrays
https://www.lucidchart.com/publicSegments/view/2bcf4f9e-74d1-491a-9d17-a00f292f3200/image.png
Norman Dela Cruz
@dcnr
Mar 03 2016 01:28 UTC
thank you @jackel27
CamperBot
@camperbot
Mar 03 2016 01:28 UTC
dcnr sends brownie points to @jackel27 :sparkles: :thumbsup: :sparkles:
:star: 367 | @jackel27 | http://www.freecodecamp.com/jackel27
JackeL
@jackel27
Mar 03 2016 01:30 UTC
@dcnr yw :smile:
oscar
@oscarg91
Mar 03 2016 01:33 UTC
hey folks need help with concatenating
var myStr = \"This is the start.\" + \"This is the end.\";
Moisés Man
@moigithub
Mar 03 2016 01:35 UTC
no need \
Norman Dela Cruz
@dcnr
Mar 03 2016 01:35 UTC
@oscarg91 Hi, you don't have to escape the outer quotes, you only escape them if you are going to use them inside another quotes of the same kind.

@oscarg91

"The \"quick\" brown fox."

Here we escaped the inner double quotes because the outer quotes are the same (double) quotes. Alternatively, we can use single quotes instead so we don't have to escape it.

'The "quick" brown fox.'
It also works the other way around.
'The \'quick\' brown fox.'
// to
"The 'quick' brown fox."
blackbuddha88
@blackbuddha88
Mar 03 2016 01:41 UTC
hi
im working on a challenge that involves use of regex
this code puzzles me:
/\(\d{3}\)( ){2}?\d{3}-\d{4}/.test('(555)  555-5555');
Moisés Man
@moigithub
Mar 03 2016 01:42 UTC
regexone.com
blackbuddha88
@blackbuddha88
Mar 03 2016 01:42 UTC
mm ill check it out
i understand the basics
but im trying to permit up to two spaces in this phoen number
the code i pasted above returns true
but
/\(\d{3}\)( ){,2}?\d{3}-\d{4}/.test('(555)  555-5555');
returns false
and i thought that {,2} would mean at least 0, at most 2 instances of spaces?
Norman Dela Cruz
@dcnr
Mar 03 2016 01:45 UTC
@blackbuddha88 you have to use {0, 2}, you need to set a lower bound
@blackbuddha88 the upper bound is the optional one {2,} (at least two or more)
blackbuddha88
@blackbuddha88
Mar 03 2016 01:46 UTC
@dcnr thanks, now it works; seems my notes are wrong.
CamperBot
@camperbot
Mar 03 2016 01:46 UTC
blackbuddha88 sends brownie points to @dcnr :sparkles: :thumbsup: :sparkles:
:star: 749 | @dcnr | http://www.freecodecamp.com/dcnr
Norman Dela Cruz
@dcnr
Mar 03 2016 01:46 UTC
you're welcome, thanks too @blackbuddha88 .
Are you building one pattern per phone number "type"?
CamperBot
@camperbot
Mar 03 2016 01:46 UTC
dcnr sends brownie points to @blackbuddha88 :sparkles: :thumbsup: :sparkles:
:star: 291 | @blackbuddha88 | http://www.freecodecamp.com/blackbuddha88
blackbuddha88
@blackbuddha88
Mar 03 2016 01:49 UTC
@dcnr well, so far yes, but ive only gotten to the second pattern
@dcnr is there a shorter way?
Norman Dela Cruz
@dcnr
Mar 03 2016 01:49 UTC
@blackbuddha88 yeah you can pass all test with just one pattern
@blackbuddha88 but if you can't build it that way, it's ok, just do what you think you can, then just come back to it when you've gotten more experienced.
blackbuddha88
@blackbuddha88
Mar 03 2016 01:50 UTC
i think i know what youre getting at
Kevin Wang
@ACW101
Mar 03 2016 01:50 UTC
Hello guys!
Norman Dela Cruz
@dcnr
Mar 03 2016 01:50 UTC
@blackbuddha88 I first did it by making I think 6 different patterns, and matching the input string to those.
@blackbuddha88 one for each "passing" case :P
hi @ACW101
Moisés Man
@moigithub
Mar 03 2016 01:51 UTC
https://regex101.com/ u can also use this to test ur pattern
blackbuddha88
@blackbuddha88
Mar 03 2016 01:51 UTC
@moigithub thanks
CamperBot
@camperbot
Mar 03 2016 01:51 UTC
blackbuddha88 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
Kevin Wang
@ACW101
Mar 03 2016 01:51 UTC
Can someone help me with my seek & destroy. I can't see why my code aren't working...
function destroyer(arr) {
  // Remove all the values
  var argLength = arguments.length;
  var arrNew = arr.filter(function(element){
    for (var i = 1; i < argLength; i++) {
      if ( element === arguments[i]) {
        return false;
      }
      return true;
    }
  });
  return arrNew;
}
CamperBot
@camperbot
Mar 03 2016 01:51 UTC
:star: 698 | @moigithub | http://www.freecodecamp.com/moigithub
Norman Dela Cruz
@dcnr
Mar 03 2016 01:53 UTC
@ACW101 the arguments objectis different for every function, destroyer's arguments is different from your filter's callback
Moisés Man
@moigithub
Mar 03 2016 01:53 UTC
@ACW101 every funciton have its OWN COPY of arguments object...
means if u call arguments inside destroyer function....
its NOT the same as u call arguments inside ur filter callback..
@dcnr u type faster than me :P
Kevin Wang
@ACW101
Mar 03 2016 01:53 UTC
totally make sense! thanks guys!!!
that was fast lol
Norman Dela Cruz
@dcnr
Mar 03 2016 01:53 UTC
@moigithub nah :P I just type shorter :P
Moisés Man
@moigithub
Mar 03 2016 01:54 UTC
ya english is sometimes a limitation,, sometimes hard to pick the correct/shorter words :)
Norman Dela Cruz
@dcnr
Mar 03 2016 01:55 UTC
"Yes, English can be weird. It can be understood through tough thorough thought, though."
lol
Patrick Black
@Mortiferr
Mar 03 2016 02:00 UTC
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber[testObj];       // Change this Line
var player = testObj[16];   // Change this Line
Why will those code not work?
this*
I am supposed to be selecting the property 16 through bracket notation but it wont let me
Norman Dela Cruz
@dcnr
Mar 03 2016 02:03 UTC
@Mortiferr you're supposed to put the player number you want to var playerNumber, and then use playerNumber to access your testObject to get the player
Moisés Man
@moigithub
Mar 03 2016 02:03 UTC
playerNumber should be = something
and use that variable below
Chris Davis
@chrisdav6
Mar 03 2016 02:03 UTC
they want you to assign an object property to a variable
Patrick Black
@Mortiferr
Mar 03 2016 02:03 UTC
so something like:
Chris Davis
@chrisdav6
Mar 03 2016 02:03 UTC
then call the object value with the variable
Norman Dela Cruz
@dcnr
Mar 03 2016 02:04 UTC
@Mortiferr
var myObj = {
  thePropertyName: "the Value";
};
  • Using . you are directly using the property name itself
    var result = myObj.thePropertyName; // the Value
  • Using [] there are two ways:
    1. Directly access by quoting the property name:
      var result = myObj["thePropertyName"]; // the Value
    2. Using a variable as property name by not quoting
      var prop = "thePropertyName";
      var result = myObj[prop]; // the Value
      here prop is the variable that holds the name of your object property
You want the last one.
Daniel Drasdo
@danieldrasdo
Mar 03 2016 02:05 UTC
Very nice explanation @dcnr
Patrick Black
@Mortiferr
Mar 03 2016 02:05 UTC
var playerNumber = 16;
var player = testObj[16]
Norman Dela Cruz
@dcnr
Mar 03 2016 02:05 UTC
thanks! @danieldrasdo
CamperBot
@camperbot
Mar 03 2016 02:05 UTC
dcnr sends brownie points to @danieldrasdo :sparkles: :thumbsup: :sparkles:
:star: 389 | @danieldrasdo | http://www.freecodecamp.com/danieldrasdo
Patrick Black
@Mortiferr
Mar 03 2016 02:06 UTC
thanks @dcnr @chrisdav6 and @moigithub
CamperBot
@camperbot
Mar 03 2016 02:06 UTC
mortiferr sends brownie points to @dcnr and @chrisdav6 and @moigithub :sparkles: :thumbsup: :sparkles:
:star: 699 | @moigithub | http://www.freecodecamp.com/moigithub
:star: 750 | @dcnr | http://www.freecodecamp.com/dcnr
:star: 318 | @chrisdav6 | http://www.freecodecamp.com/chrisdav6
Norman Dela Cruz
@dcnr
Mar 03 2016 02:06 UTC
@Mortiferr almost got it, but look at my example again :D
Patrick Black
@Mortiferr
Mar 03 2016 02:06 UTC
do I need to add quotes on var playerNumber = "16"?
no
that's not right
hmm
Chris Davis
@chrisdav6
Mar 03 2016 02:07 UTC
not a string
Jeremy Roe
@jeremyroe
Mar 03 2016 02:07 UTC
This message was deleted
Norman Dela Cruz
@dcnr
Mar 03 2016 02:07 UTC
@Mortiferr you can but not necessary
Patrick Black
@Mortiferr
Mar 03 2016 02:08 UTC
All the tests pass except for use bracket notation so something in my syntax is off
Norman Dela Cruz
@dcnr
Mar 03 2016 02:08 UTC
@jeremyroe hi try the front end room and the dedicated codereview room too! :D
Jeremy Roe
@jeremyroe
Mar 03 2016 02:08 UTC
This message was deleted
This message was deleted
Norman Dela Cruz
@dcnr
Mar 03 2016 02:08 UTC
@Mortiferr yeah you're supposed to used playerNumber to look up your player name, not directly use 16
@jeremyroe oh slow day eh :(
Patrick Black
@Mortiferr
Mar 03 2016 02:09 UTC
@dcnr It says that it should be a number
playerNumber should be a number
Norman Dela Cruz
@dcnr
Mar 03 2016 02:09 UTC
@Mortiferr oh remove the quotes then!
Chris Davis
@chrisdav6
Mar 03 2016 02:09 UTC
right, but you assigned a number to your variable
Alexandrix Ikechukwu
@SpaghettiThots
Mar 03 2016 02:10 UTC
Hello. Has anyone been thru the Blackjack challenge?
Patrick Black
@Mortiferr
Mar 03 2016 02:10 UTC
GOT IT
var playerNumber = 16;
var player = testObj[playerNumber];
Chris Davis
@chrisdav6
Mar 03 2016 02:10 UTC
:)
Patrick Black
@Mortiferr
Mar 03 2016 02:10 UTC
that was dumb lol I was blind
thanks @chrisdav6 and @dcnr once again
CamperBot
@camperbot
Mar 03 2016 02:10 UTC
mortiferr sends brownie points to @chrisdav6 and @dcnr :sparkles: :thumbsup: :sparkles:
:warning: mortiferr already gave chrisdav6 points
:warning: mortiferr already gave dcnr points
Norman Dela Cruz
@dcnr
Mar 03 2016 02:10 UTC
NICE! :D @Mortiferr
you're welcome, and thanks too @Mortiferr
CamperBot
@camperbot
Mar 03 2016 02:11 UTC
dcnr sends brownie points to @mortiferr :sparkles: :thumbsup: :sparkles:
:star: 122 | @mortiferr | http://www.freecodecamp.com/mortiferr
Greg D
@mosaic-greg
Mar 03 2016 02:11 UTC
@SpaghettiThots yep
Patrick Black
@Mortiferr
Mar 03 2016 02:11 UTC
the . notation is much easier lol
But I could see how [] notation could be quite useful
Alexandrix Ikechukwu
@SpaghettiThots
Mar 03 2016 02:12 UTC
Oh! Great @mosaic-greg . How did you manage?
Greg D
@mosaic-greg
Mar 03 2016 02:12 UTC
seemed pretty straightforward are you stuck?
Alexandrix Ikechukwu
@SpaghettiThots
Mar 03 2016 02:13 UTC
Sure. Never played blackjack. And tried to read up counting. Made little sense.
Norman Dela Cruz
@dcnr
Mar 03 2016 02:13 UTC
@Mortiferr you can't use . with numbers though :P (and other illegal variable names, having spaces for example), if you're using a variable, you also need to use []. The . is really just for literally using the property name
Patrick Black
@Mortiferr
Mar 03 2016 02:13 UTC
makes sense
Chris Davis
@chrisdav6
Mar 03 2016 02:13 UTC
@Mortiferr you are welcome sir :) objects are kind of tricky, especially when variables and function parameters are involved :worried:
Norman Dela Cruz
@dcnr
Mar 03 2016 02:14 UTC

@Mortiferr

var myObj = {
  "my key" : "the value";
}

Can't do myObj.my key :D

but can do myObj["my key"]
or
var key = "my key";
myObj[key];
Patrick Black
@Mortiferr
Mar 03 2016 02:14 UTC
yeah makes sense
Norman Dela Cruz
@dcnr
Mar 03 2016 02:15 UTC
having improper key names are awful though
Greg D
@mosaic-greg
Mar 03 2016 02:15 UTC
@SpaghettiThots you can skip that challenge if you don't want to learn how to play blackjack
Chris Davis
@chrisdav6
Mar 03 2016 02:16 UTC
@Mortiferr @dcnr speaks the truth! You have to use bracket notation if your object properties include spaces
Alexandrix Ikechukwu
@SpaghettiThots
Mar 03 2016 02:16 UTC
Don't kid me. If you can teach me, I'm game.
Alexandrix Ikechukwu
@SpaghettiThots
Mar 03 2016 02:18 UTC
Oh! Ok
Thank you.
Jeff
@adzam5
Mar 03 2016 02:20 UTC
Anyone do the Diff Two Arrays challenge yet? I just completed it and passed, but I didn't use .concat() like they suggested cause I'm not really seeing where it would fit in
Norman Dela Cruz
@dcnr
Mar 03 2016 02:30 UTC
@adzam5 it's alright if you solved it another way, but you should take it as a challenge on why you need a concat :D
Marek Slabicki
@thaniri
Mar 03 2016 02:44 UTC

hello, i'm trying to sort an array from smallest to largest number and my script breaks if i use two digit numbers:

function smallestCommons(arr) {
  arr = arr.sort();//sorts inputted array for the loop to work
  var holderArray = [];

  for (var i = arr[0]; i <= (arr[arr.length-1]); i++){
    //loop starts at smallest arrray value, ends at highest
    holderArray.push(i);
    //pushes every number between small and large into a new arr
  }

  return holderArray;

}

smallestCommons([9,3]);//doesn't work with 2+ digit numbers

anyone have a clue why this is happening? nothing shows up in my console log

Norman Dela Cruz
@dcnr
Mar 03 2016 02:46 UTC
@thaniri you need to use a custom sort to sort numbers, otherwise the default sort would treat your numbers as strings
so you can get [1, 10, 2, 20, 3, 30] sorting
Well I'm not sure if they're technically sorted as strings, but it ends up that way
Marek Slabicki
@thaniri
Mar 03 2016 02:47 UTC
huh, didnt know that
when i tried return arr.sort(); i got a result as an array
Norman Dela Cruz
@dcnr
Mar 03 2016 02:48 UTC
@thaniri always look at the docs! You need your own compare function, look at the examples.
Garrett
@grrttmrtn
Mar 03 2016 02:49 UTC
I'm having some issues with the nesting for loops challenge
Marek Slabicki
@thaniri
Mar 03 2016 02:49 UTC
well for the first line in that document "The sort() method sorts the elements of an array in place and returns the array."
returns the array
Norman Dela Cruz
@dcnr
Mar 03 2016 02:50 UTC

@thaniri oh here's the relevant bit:

If compareFunction is not supplied, elements are sorted by converting them to strings and comparing strings in Unicode code point order. For example, "Cherry" comes before "banana". In a numeric sort, 9 comes before 80, but because numbers are converted to strings, "80" comes before "9" in Unicode order.

Marek Slabicki
@thaniri
Mar 03 2016 02:51 UTC
thanks @dcnr
bitgrower
@bitgrower
Mar 03 2016 02:51 UTC
^^^^^^^ agree with @dcnr ... always look at the docs ! They are your friends ...
CamperBot
@camperbot
Mar 03 2016 02:51 UTC
thaniri sends brownie points to @dcnr :sparkles: :thumbsup: :sparkles:
:star: 751 | @dcnr | http://www.freecodecamp.com/dcnr
Norman Dela Cruz
@dcnr
Mar 03 2016 02:51 UTC
heya @bitgrower :cake:
bitgrower
@bitgrower
Mar 03 2016 02:51 UTC
how ya doin', my friends ? @thaniri, @dcnr ... anyone else I'm missing ...
Marek Slabicki
@thaniri
Mar 03 2016 02:52 UTC
still learning :) and you?
Norman Dela Cruz
@dcnr
Mar 03 2016 02:52 UTC
thanks for the link btw @bitgrower
CamperBot
@camperbot
Mar 03 2016 02:52 UTC
dcnr sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 694 | @bitgrower | http://www.freecodecamp.com/bitgrower
Garrett
@grrttmrtn
Mar 03 2016 02:52 UTC
Could someone explain the relevance of "i < arr.length;" in a for loop? What is the purpose of checking the length of the array
Marek Slabicki
@thaniri
Mar 03 2016 02:53 UTC
in a for loop you have 3 components, idk the proper terminology
counter start point
counter end point
count increment per loop
i < arr.length means that your loop ends when i gets to arr.length in numeric value
bitgrower
@bitgrower
Mar 03 2016 02:54 UTC
@grrttmrtn -- so you can look at all the elements in an array ... called "iteration"
I think it's something like ... initializers (you can have more than one); loop termination condition; iteration expressions (you can have more than one)
still learning :) and you?
ever learning ... the day I stop learning is the day they put in me in the ground ...
Brian
@sludge256
Mar 03 2016 02:59 UTC
Marek Slabicki
@thaniri
Mar 03 2016 02:59 UTC
i saw the news thats pretty cool
bitgrower
@bitgrower
Mar 03 2016 03:00 UTC
LOL ... I saw, @sludge256 -- saw the link in the DS room this morning ... about dropped out of my chair ... still, didn't see anything about php ... LOL
Brian
@sludge256
Mar 03 2016 03:00 UTC
There's a PHP room too
bitgrower
@bitgrower
Mar 03 2016 03:00 UTC
ahhh...okay ...
Brian
@sludge256
Mar 03 2016 03:00 UTC
I think the Python tutorials will be the first set of things to go live
bitgrower @bitgrower isn't particularly fanatical about php ... just know many peeps seem to want it ...
Brian
@sludge256
Mar 03 2016 03:01 UTC
We're trying expand to the big langauges at least
bitgrower
@bitgrower
Mar 03 2016 03:01 UTC
ah good ... I can refresh my python lambdas (? -- oh well, python's functional programming stuffs) and give the semicolons a bit of a rest ... :)
Sumeet Batheja
@bathejasumeet
Mar 03 2016 03:03 UTC
Morning
bitgrower
@bitgrower
Mar 03 2016 03:03 UTC
evening ...
I discovered the leaderboard, @sludge256 ... I'm 218 (or at least y'day, when I looked ... )
Jett C
@jettcrowson
Mar 03 2016 03:11 UTC
could someone explain the arguments object to me?
Norman Dela Cruz
@dcnr
Mar 03 2016 03:12 UTC
@jettcrowson try MDN or this one
bitgrower
@bitgrower
Mar 03 2016 03:19 UTC
no fair @dcnr -- your mdn link goes to devdocs!
This message was deleted
Norman Dela Cruz
@dcnr
Mar 03 2016 03:20 UTC
@bitgrower ahah why not :P
I mean devdocs's just an aggregate :P
Brian
@sludge256
Mar 03 2016 03:20 UTC
Pft DevDocs employee has been exposed
Norman Dela Cruz
@dcnr
Mar 03 2016 03:20 UTC
and I already have it open
lool
Sidharth Kriplani
@sidkrip
Mar 03 2016 03:21 UTC
anyone done with the bonfire binary agents?
Brian
@sludge256
Mar 03 2016 03:21 UTC
We don't take kindly to people pushing free educational material around these here parts.
bitgrower
@bitgrower
Mar 03 2016 03:21 UTC
well call it docs then ... it's not actually MDN ... you'll have newbs running around passing this link called "MDN" and be out of sync with the rest of the world cause they think it's another name for devdocs ... :)
Brian
@sludge256
Mar 03 2016 03:21 UTC
:cop:
bitgrower
@bitgrower
Mar 03 2016 03:21 UTC
LOL @sludge256
Norman Dela Cruz
@dcnr
Mar 03 2016 03:21 UTC
@sludge256 that's why we need microtransactions, and a propriety codebase!
bitgrower
@bitgrower
Mar 03 2016 03:22 UTC
@sidkrip -- absolutely ...
that's how I get "bit" in my name ... LOL
Sidharth Kriplani
@sidkrip
Mar 03 2016 03:22 UTC
haha okay so here is my code uptil now:
stringerfunction binaryAgent(str) {
  var stringo=[];
  var ret=[];
  stringo=str.split(" ");
  ret=stringo.filter(function(value) {
    return value!=" ";
  });
  var stringer="";
  for(var i=0; i<ret.length; i++)
   {
     stringer+=ret[i];
   }
  var retstring;
  for(var j=0; j<stringer.length; j+=8) {
    retstring=String.fromCharCode(stringer[j]*Math.pow(2, i));
  }

  return stringer;
}
Norman Dela Cruz
@dcnr
Mar 03 2016 03:22 UTC
@bitgrower I thought you just kept your Tamagotchi till now, and your avatar looks like a bad pixel art plant
:D
bitgrower
@bitgrower
Mar 03 2016 03:23 UTC
oh I gotta remember that cop icon ... yeah, my avatar needs updating for sure ... a pixel cactus
Sidharth Kriplani
@sidkrip
Mar 03 2016 03:23 UTC
@bitgrower sorry, this one:
function binaryAgent(str) {
  var stringo=[];
  var ret=[];
  stringo=str.split(" ");
  ret=stringo.filter(function(value) {
    return value!=" ";
  });
  var stringer="";
  for(var i=0; i<ret.length; i++)
   {
     stringer+=ret[i];
   }
  var retstring;
  for(var j=0; j<stringer.length; j+=8) {
    retstring=String.fromCharCode(stringer[j]*Math.pow(2, i));
  }

  return stringer;
}
bitgrower
@bitgrower
Mar 03 2016 03:24 UTC
help binary agents
CamperBot
@camperbot
Mar 03 2016 03:24 UTC

:point_right: algorithm binary agents [wiki]

Explanation:

This problem is very straight forward, you will get a string that will represent a sentence in binary code, and you need to translate that into words. There is not direct way to do this so you will have to translate twice.

:pencil: read more about algorithm binary agents on the FCC Wiki

Sidharth Kriplani
@sidkrip
Mar 03 2016 03:24 UTC
so the thing is, the output is the same binary string without the spaces and I want to String.fromCharCode() all of it by looping 8 digits at a time
Chris Davis
@chrisdav6
Mar 03 2016 03:24 UTC
dang, i just got yelled at for being what i thought was pretty vague. Im going to resort to binary hints!
Sidharth Kriplani
@sidkrip
Mar 03 2016 03:24 UTC
@bitgrower
bitgrower
@bitgrower
Mar 03 2016 03:24 UTC
sometimes it's just the right about of explanation ... and other times, not enough ...
I like that idea ...
blackbuddha88
@blackbuddha88
Mar 03 2016 03:25 UTC
hi
ive got another question about the regex challenge im working on
var str = "1 (555555-5555";

/(1 {0,2}?)?([(\({1}\d{3}\){1})(\d{3})])([ -])?(\d{3})([ -])?(\d{4})/.test(str);
bitgrower
@bitgrower
Mar 03 2016 03:26 UTC
@sidrip -- you did caesar's cipher, right ?
blackbuddha88
@blackbuddha88
Mar 03 2016 03:26 UTC
this returns true, though i cant seem to figure out why
Sidharth Kriplani
@sidkrip
Mar 03 2016 03:27 UTC
@bitgrower No I didnt. I will be doing it later though
Norman Dela Cruz
@dcnr
Mar 03 2016 03:27 UTC

@sidkrip you don't have to implement your own uhh whatever that's called, you can use parseInt(x, 2) where 2 is your base (binary is 2). But if I understood you correctly and you want to do something like:

128 64 32 16 8 4 2 1
  0  1  0  0 0 0 0 1 = `A`

then you might need some more work

Sidharth Kriplani
@sidkrip
Mar 03 2016 03:28 UTC
yes I was going to do exactly that
bitgrower
@bitgrower
Mar 03 2016 03:28 UTC
ahh ... same kind of principles ... same players ... charCodeAt, fromCharCode ... except I skipped the first one and used a cool option in ParseInt ... :)
MuSanKitty
@MuSanKitty
Mar 03 2016 03:28 UTC
function largestOfFour(arr) {
var largestArr = [];
for (i=0; i < arr.length; i++) {
var largestNum = 0;
for (j=0; j < 4; j++)
{
if (arr[i][j] > largestNum) {
largestNum=arr[i][j];
}
}
largestArr.push(largestNum);
}
return largestArr;
bitgrower
@bitgrower
Mar 03 2016 03:28 UTC
snap, @dcnr
MuSanKitty
@MuSanKitty
Mar 03 2016 03:29 UTC
someone explain why that works/
?
Sidharth Kriplani
@sidkrip
Mar 03 2016 03:29 UTC
@dcnr how exactly does parseInt work?
bitgrower
@bitgrower
Mar 03 2016 03:29 UTC
okay @dcnr ... whip out your handy, ahem, "MDN" link ...
Norman Dela Cruz
@dcnr
Mar 03 2016 03:29 UTC
ahah
@sidkrip parseInt almost like cheating
bitgrower
@bitgrower
Mar 03 2016 03:30 UTC
@MuSanKitty -- does it work ...
MuSanKitty
@MuSanKitty
Mar 03 2016 03:30 UTC
I know
explain why? lol
CamperBot
@camperbot
Mar 03 2016 03:30 UTC
no wiki entry for: why lol
Moisés Man
@moigithub
Mar 03 2016 03:30 UTC
will be a nice command for bot... MDN keyword n pop a link :)
bitgrower
@bitgrower
Mar 03 2016 03:30 UTC
uhhhhhhh.....where would you like me to start ?
it would indeed, @moigithub
could also be a cool way to collect some more #s for the DS folks ...
Norman Dela Cruz
@dcnr
Mar 03 2016 03:31 UTC
wiki parseInt
CamperBot
@camperbot
Mar 03 2016 03:31 UTC

:point_right: parseint [wiki]

parseInt()

The parseInt() function parses a string argument and returns an integer of the specified radix (the base in mathematical numeral systems).

:pencil: read more about parseint on the FCC Wiki

Norman Dela Cruz
@dcnr
Mar 03 2016 03:31 UTC
:D
MuSanKitty
@MuSanKitty
Mar 03 2016 03:31 UTC
I get the first part of the for loop, I understand the push... its the second peice of the for loop I'm a little confused about..
maybe it is just a little too late for me to be coding -_-
bitgrower
@bitgrower
Mar 03 2016 03:32 UTC
well ... let me turn the tables on you a bit ... if you were to describe how to solve this challenge in words, how would you describe the solution ?
can you copy the line(s) of code specifically that are causing the question marks ?
Sidharth Kriplani
@sidkrip
Mar 03 2016 03:34 UTC
@dcnr @bitgrower can anyone explain this solution to the bonfire binary agents?
function binaryAgent(str) {

  return str.split(' ').map( function (each){
    return String.fromCharCode(parseInt(each,2));
  }).join("");
 // return converted.join(" ")
}
MuSanKitty
@MuSanKitty
Mar 03 2016 03:34 UTC
var largestNum = 0;
for (j=0; j < 4; j++)
{
if (arr[i][j] > largestNum) {
largestNum=arr[i][j];
}
I know what it is doing.. I just don't quite get why it is written this way is all
bitgrower
@bitgrower
Mar 03 2016 03:34 UTC
how would you write it ?
MuSanKitty
@MuSanKitty
Mar 03 2016 03:35 UTC
I don't know to be honest.. I've been sitting here trying to figure it out and eventually just went searching the web because I just couldn't for the life of me put it together
i really might just be burnt out
bitgrower
@bitgrower
Mar 03 2016 03:35 UTC
@sidkrip -- doesn't get much more succinct ...
MuSanKitty
@MuSanKitty
Mar 03 2016 03:35 UTC
maybe I should look at it in the morning
Sidharth Kriplani
@sidkrip
Mar 03 2016 03:36 UTC
I guess it first splits them
them maps a function to every array element
and then oh okoay got it
such an easy solution
bitgrower
@bitgrower
Mar 03 2016 03:36 UTC
I will give your unconscious brain some fodder to feed upon while you sleep ... so you can wake up with an aha experience ... :)
Sidharth Kriplani
@sidkrip
Mar 03 2016 03:36 UTC
thanks @dcnr @bitgrower
CamperBot
@camperbot
Mar 03 2016 03:36 UTC
sidkrip sends brownie points to @dcnr and @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 752 | @dcnr | http://www.freecodecamp.com/dcnr
:star: 695 | @bitgrower | http://www.freecodecamp.com/bitgrower
Norman Dela Cruz
@dcnr
Mar 03 2016 03:36 UTC
@sidkrip
1) the str is split into an array of [10111010, 10010001... etc]
2) each element is mapped with parseInt, as is parsed as binary
3) converts each parsed item to characters
4) the array is then joined together without spaces
5) return!
bitgrower
@bitgrower
Mar 03 2016 03:37 UTC

that part of the loop is the loop which is processing the each inner array ... since the problem is to find the largest number in EACH sub-array, you need to start the search off by initializing largest to 0 ...

then you look at each element within the sub array and see if it's larger than "largest" -- if it is, you set largest to the new number ...

are you having trouble with the addressing @MuSanKitty ? the arr[i][j] part ?
that seems to cause a number of folks problems ...
you forgot the part where it converts the ParseInt'd value into a character, @dcnr ...
Norman Dela Cruz
@dcnr
Mar 03 2016 03:40 UTC
@bitgrower oh yeah fromcharcode
bitgrower
@bitgrower
Mar 03 2016 03:40 UTC
yup
MuSanKitty
@MuSanKitty
Mar 03 2016 03:41 UTC
ok.. so my gf helped out and suggested this instead
function largestOfFour(arr) {
var largestArr = [];
for (i=0; i < arr.length; i++) {
var largestNum = 0;
var subarr = arr[i];
for (j=0; j < subarr.length; j++)
{
if (subarr[j] > largestNum) {
largestNum=subarr[j];
}
}
largestArr.push(largestNum);
}
return largestArr;
}
works much better and actually makes sense
bitgrower
@bitgrower
Mar 03 2016 03:41 UTC
yeah, you could do it that way ...
"works much better" ?
MuSanKitty
@MuSanKitty
Mar 03 2016 03:41 UTC
note to self.. ask the person next to me that gets PAID to program :P
bitgrower @bitgrower feels slightly insulted now ...
Norman Dela Cruz
@dcnr
Mar 03 2016 03:42 UTC
@jackel27 posted something about this nested for loop bit earlier :point_up: March 3, 2016 9:26 AM
@MuSanKitty
bitgrower
@bitgrower
Mar 03 2016 03:43 UTC
LOL ... or just throw it into pythontutor ... :)
MuSanKitty
@MuSanKitty
Mar 03 2016 03:45 UTC
i do appreciate the help @bitgrower ..
bitgrower
@bitgrower
Mar 03 2016 03:45 UTC
LOL, not to worry @MuSanKitty ... it's all good ...
it's probably a matter of experience ... because creating another variable like that is certainly reasonable ... but after a while using the double indexing seems a bit more direct ...
you're in for some exciting times with the object addressing ... :)
MuSanKitty
@MuSanKitty
Mar 03 2016 03:49 UTC
java script isn't her thing, she codes in C and Python mostly, not that I know anything about those languages.. I did like three days of python and noped the f* out of there :P
Jonah Barreto
@JBarreto1
Mar 03 2016 03:51 UTC
Hey! I'm wokring on sorted Union in the intermediate section. I got to test three and the test passes only two arguments. I can't deal. What happens to array3? Is it null? I tried to just put an if statement that says only continue for arr3 if it is not null or []. Still continued. what does a third argument look like if you pass it nothing?
Marek Slabicki
@thaniri
Mar 03 2016 03:55 UTC
and then the 11th commandment was written, when thou must ask for coding help, thou shalst post your code within ``` tags
Norman Dela Cruz
@dcnr
Mar 03 2016 03:55 UTC
@JBarreto1 it would be undefined
bitgrower
@bitgrower
Mar 03 2016 03:58 UTC
@MuSanKitty -- yes, I'm not surprised ... the tactics programmers use in JS are not always the same what folks use in compiled languages (eg c) ... haven't done enough python in a community environment to see how peeps do things typically in python ...
cute @thaniri ...
Sidharth Kriplani
@sidkrip
Mar 03 2016 03:59 UTC
help bonfire everything be true
CamperBot
@camperbot
Mar 03 2016 03:59 UTC
no wiki entry for: bonfire everything be true
Sidharth Kriplani
@sidkrip
Mar 03 2016 04:00 UTC
bonfire Everything Be True
CamperBot
@camperbot
Mar 03 2016 04:00 UTC

:fire:Bonfire: Everything Be True :link:

function every(collection, pre) {
  // Does everyone have one of these?
  return pre;
}

every([{'user': 'Tinky-Winky', 'sex': 'male'}, {'user': 'Dipsy', 'sex': 'male'}, {'user': 'Laa-Laa', 'sex': 'female'}, {'user': 'Po', 'sex': 'female'}], 'sex');

Check if the predicate (second argument) returns truthy (defined) for all elements of a collection (first argument).

more info:  bf details | bf links | hint

Sidharth Kriplani
@sidkrip
Mar 03 2016 04:01 UTC
hint bonfire Everything Be True
CamperBot
@camperbot
Mar 03 2016 04:01 UTC
:construction: Spoilers are only in the Bonfire's Custom Room :point_right:
bitgrower
@bitgrower
Mar 03 2016 04:01 UTC
another great exercise in object addressing ... :)
Sidharth Kriplani
@sidkrip
Mar 03 2016 04:01 UTC
@bitgrower I didnt get it. What has to be done here.
bitgrower
@bitgrower
Mar 03 2016 04:02 UTC
let me go pull up my (not wonderfully coded) solution (as well as the challenge instructions)
oh wait... this one's coded okay, it's a different one I wanted to completely re-write ...
Danny McCollins
@dmccollins
Mar 03 2016 04:04 UTC

I'm stuck on 'Stand in Line'.....

Write a function queue 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 queue function should then return the element that was removed.

function queue(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(queue(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
bitgrower
@bitgrower
Mar 03 2016 04:05 UTC
@droymac ... go read up on the various array functions ... things like pop, shift, unshift, push ...
Danny McCollins
@dmccollins
Mar 03 2016 04:05 UTC
I changed return item; to return arr.push(item) but can't figure what to do next...
Sidharth Kriplani
@sidkrip
Mar 03 2016 04:05 UTC
@droymac
you just have to push every element using push at the end of the array and shift one element from the start
bitgrower
@bitgrower
Mar 03 2016 04:05 UTC
I need a sliver platter icon ... :)
Sidharth Kriplani
@sidkrip
Mar 03 2016 04:05 UTC
you have to shift as well
@droymac
arr.push(item);
  item=arr.shift();
  return item;  // Change this line
Danny McCollins
@dmccollins
Mar 03 2016 04:06 UTC
Give me a break @bitgrower
bitgrower
@bitgrower
Mar 03 2016 04:06 UTC
wasn't really talking to you @droymac, no offense meant ...
Danny McCollins
@dmccollins
Mar 03 2016 04:07 UTC
None taken, sorry for misinterpreting
Sidharth Kriplani
@sidkrip
Mar 03 2016 04:08 UTC
@bitgrower still dont know what to do exactly in the bonfire Everything Be true. Do I just have to write a code which will check if the values match and I dont have to do anything about the matching? I mean, how does it know which values match?
I really hope you get all that gibberish
@droymac are you clear with your challenge now?
bitgrower
@bitgrower
Mar 03 2016 04:09 UTC
@sidkrip the parameter pre (a "key") exists in the various objects, and if it does, look at the value and determine if the value is truthy ... if neither is true, you can just return false ... but you need to check all elements before you can return true
Ken Haduch
@khaduch
Mar 03 2016 04:10 UTC
:train::train::train::train: - just wanted to see if that works... how's everyone doing here?
Danny McCollins
@dmccollins
Mar 03 2016 04:10 UTC
@sidkrip Yes, sir. Thanks for your help.
CamperBot
@camperbot
Mar 03 2016 04:10 UTC
droymac sends brownie points to @sidkrip :sparkles: :thumbsup: :sparkles:
:star: 289 | @sidkrip | http://www.freecodecamp.com/sidkrip
bitgrower
@bitgrower
Mar 03 2016 04:10 UTC
hey hey @khaduch ...
Ken Haduch
@khaduch
Mar 03 2016 04:11 UTC
howdy @bitgrower :wave:
Sidharth Kriplani
@sidkrip
Mar 03 2016 04:11 UTC
@bitgrower how do I know if the value is "truthy"? I mean, does "it" know which values match?
Marek Slabicki
@thaniri
Mar 03 2016 04:12 UTC
truthyness was gone over in the false bouncer problem
bitgrower
@bitgrower
Mar 03 2016 04:12 UTC
opposite of falsy ... :) .. and I really don't mean that to be snarky ... but, it kinda is ... most things evaluate as "true"
Marek Slabicki
@thaniri
Mar 03 2016 04:12 UTC
this link might help
bitgrower
@bitgrower
Mar 03 2016 04:12 UTC
except for those things that are falsy ...
Marek Slabicki
@thaniri
Mar 03 2016 04:12 UTC
if you solved false bouncer you can solce this
bitgrower
@bitgrower
Mar 03 2016 04:12 UTC
and like @thaniri said ... falsy bouncer is the reference previous challenge
Sidharth Kriplani
@sidkrip
Mar 03 2016 04:13 UTC
thanks @thaniri @bitgrower
CamperBot
@camperbot
Mar 03 2016 04:13 UTC
sidkrip sends brownie points to @thaniri and @bitgrower :sparkles: :thumbsup: :sparkles:
:warning: sidkrip already gave bitgrower points
:star: 183 | @thaniri | http://www.freecodecamp.com/thaniri
bitgrower
@bitgrower
Mar 03 2016 04:13 UTC
basically, it's truthy if it isn't falsy ...
yw @sikdrip ...
Sidharth Kriplani
@sidkrip
Mar 03 2016 04:14 UTC
alright. Got it
Marek Slabicki
@thaniri
Mar 03 2016 04:16 UTC

i've got a question for how javascript works:

function smallestCommons(arr) {
  var holderArray = [];

  arr.sort(function(x , y){//sort the array from smallest to largest
       return x - y;                     
  });

  for (var i = arr[0]; i <= (arr[arr.length-1]); i++){
    holderArray.push(i);//push the range of the inputted array into a new array
  }

  function lcm(x, y) { //find the lowest common multiple between 2 nums
    return (x * y) / gcd (x, y);
  }

  function gcd(x, y) {//find the greatest common denominator between 2 nums
    if (y === 0){
         return x; //if y is 0 you lose
      } else {
         return gcd(y, x % y);//y and remainder of x/y
      }
  }

  return holderArray.reduce(lcm);
}

smallestCommons([13,1]);

How does the compiler know for function lcm/gcd(x,y) where x and y are coming from? and how does it know to perform those actions 13 times in this example

I ran it through pythontutor to get a better understanding, but i don't know

Arya
@beingmojo
Mar 03 2016 04:16 UTC
Hi Guys, I am trying to do the Caesars Cipher problem, I am facing an issue.
All my tests pass expects the "FREE CODE CAMP" one.
can some one please help identify what I am doing wrong:
below is my code:
function rot13(str) { // LBH QVQ VG!
    var arr = str.split('');
    //console.log(arr+ " "+ arr.length);
    var arr_code=[];
    var str_code=[];
    var exp= /[-[\]{}()*+?.,\\^$|#\s]/g;
    for(var i=0; i<arr.length; i++){
        arr_code[i]= arr[i].charCodeAt();
        if(!arr[i].match(exp)){
            arr_code[i]=arr_code[i]-13;
        }
        str_code[i]=String.fromCharCode(arr_code[i]);
    }
    //console.log(arr_code);
    //console.log(str_code.join(''));
    return str_code.join('');
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
DJ
@qualitymanifest
Mar 03 2016 04:18 UTC
@CodeVeni are you sure that's your current code? when i copy and paste that, nothing passes
Marek Slabicki
@thaniri
Mar 03 2016 04:18 UTC
same for me, nothing passes
Arya
@beingmojo
Mar 03 2016 04:19 UTC
oh wait.. let me check if I gave you right code
oops sorry guys
bitgrower
@bitgrower
Mar 03 2016 04:20 UTC
@thaniri ... you might want to read up on Array.reduce and look at the implicit parameters ...
DJ
@qualitymanifest
Mar 03 2016 04:21 UTC
@thaniri it knows where x and y come from because x and y are whatever gets passed into the particular function thats using it at the time
Arya
@beingmojo
Mar 03 2016 04:21 UTC
well I accidentally overwrote the entire code, I'll have to re do it.. sorry to bother you campers..
Marek Slabicki
@thaniri
Mar 03 2016 04:22 UTC
thanks @bitgrower @qualitymanifest
CamperBot
@camperbot
Mar 03 2016 04:22 UTC
thaniri sends brownie points to @bitgrower and @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star: 1048 | @qualitymanifest | http://www.freecodecamp.com/qualitymanifest
:star: 696 | @bitgrower | http://www.freecodecamp.com/bitgrower
bitgrower
@bitgrower
Mar 03 2016 04:24 UTC

for (var i = arr[0]; i <= (arr[arr.length-1]); i++)

this for loop condition is WEIRD

you get an array of 2 elements ... so arr.length-1 = 1 ... so why not just say arr[1] ?
Marek Slabicki
@thaniri
Mar 03 2016 04:25 UTC
dunno im a bad coder
i was just messing around with different end points until i got my holderArray to show the range of the 2 inputted numbers
bitgrower
@bitgrower
Mar 03 2016 04:26 UTC
didn't know it was your code ... we all have our moment ...
Marek Slabicki
@thaniri
Mar 03 2016 04:26 UTC
i just hope things work
haha, i KNOW i'm a bad coder
please dont look at my other solutions!
bitgrower
@bitgrower
Mar 03 2016 04:27 UTC
yeah I mean, they give you 2 numbers -- stated in the problem ... so you have to iterate from whatever is in array[0] to whatever is in array[1] ..
if I'm remembering the problem correctly ...
LOL @thaniri .. I was looking at a solution I did where I used reduce and either filter or map ... within a for loop ... I'm not even sure why I bothered ... one or the other should have done the trick ...
...but that's sort of a measure of growth ... if you can look at your own code ... and know you can code it better now ... (or could with a little effort) ... then you're growing ! getting better !
Marek Slabicki
@thaniri
Mar 03 2016 04:30 UTC
haha yeah i know
i just power through the problems i know the more i do the better i get
bitgrower
@bitgrower
Mar 03 2016 04:32 UTC
at the same time, you may code something, look back at it and say ... "is this my beautiful code? How did I get here?"
bitgrower @bitgrower is a bit of a talking heads fan
Patrick Mulvihill
@PatMulvihill
Mar 03 2016 04:43 UTC
https://gist.github.com/PatMulvihill/709b903910f7ba2ce183 What's wrong with this code? It's from the "Using Objects as Lookups" exercise in the vanilla javascript section
BendersBender
@BendersBender
Mar 03 2016 04:44 UTC
help record collection
CamperBot
@camperbot
Mar 03 2016 04:44 UTC

:point_right: checkpoint record collection [wiki]

Checkpoint: Record Collection

Instructions

You are given a JSON object representing (a small part of) your record collection. Each album is identified by a unique id number and has several properties. Not all albums have complete information.

Write a function which takes an id, a property (prop), and a value.

For the given id in collection:

If value is non-blank (value !== ""), then update or set the value for the prop.

If the prop is "tracks" and value is non-blank, push the value onto the end of the tracks array.

If value is blank, delete that prop.

Always return the entire collection object.

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about checkpoint record collection on the FCC Wiki

Bartek
@dyczol
Mar 03 2016 04:47 UTC
@BendersBender lets see your code !
bitgrower
@bitgrower
Mar 03 2016 04:52 UTC
@PatMulvihill -- don't change the lookup data structure ... all you have to do is "index" into the object using the object name followed by the "key" ... that will give you the value of the object's key/value pairs ...
Patrick Mulvihill
@PatMulvihill
Mar 03 2016 04:53 UTC
yea i figured it out thank you for your response
Lovepreet Singh
@lovepreetkaul
Mar 03 2016 05:01 UTC
Hey guys having a problem in doing Falsy Bouncer.

function bouncer(arr) {
// Don't show a false ID to this bouncer.
result = arr.filter(isFalsy);
return arr;
}

function isFalsy(x) {
var x = Boolean(x);
return x;
}

bouncer([7, "ate", "", false, 9]);

uriznik
@uriznik
Mar 03 2016 05:03 UTC
@lovepreetkaul what are you returning from your bouncer function?
Lovepreet Singh
@lovepreetkaul
Mar 03 2016 05:03 UTC
Ohhh..that was a silly one
Thanks @uriznik
CamperBot
@camperbot
Mar 03 2016 05:03 UTC
lovepreetkaul sends brownie points to @uriznik :sparkles: :thumbsup: :sparkles:
uriznik
@uriznik
Mar 03 2016 05:03 UTC
:)
CamperBot
@camperbot
Mar 03 2016 05:03 UTC
:star: 331 | @uriznik | http://www.freecodecamp.com/uriznik
bitgrower
@bitgrower
Mar 03 2016 05:04 UTC
@lovepreetkaul -- silly if you don't read the docs ... :)
Lovepreet Singh
@lovepreetkaul
Mar 03 2016 05:04 UTC
Yeah true that @bitgrower
apklip
@apklip
Mar 03 2016 05:29 UTC

@DarkPigeons
Hello I am doing Make Object Properties Private Challenge. My code works yet isn't accepted.
var Bike = function() {

// Only change code below this line.
var gear = 0;

this.setGear = function(gearNum) {
gear += gearNum;
}

this.getGear = function() {
return gear;
}

};

var myCar = new Car();

var myBike = new Bike();

myBike.setGear(4);

myBike.getGear();

Kyle Morton
@kmorton1988
Mar 03 2016 05:37 UTC
hey guys. I'm stuck on a nested array if/elseif statement. Specifically trying to change a specific value a few tiers into a nested array.
HaiderJaan
@HaiderJaan
Mar 03 2016 05:37 UTC

function golfScore(par, strokes) {
// Only change code below this line

if (strokes === 1) {

return "Hole-in-one!";

} else if (strokes<=(par-2)) {

return "Eagle";

} else if (strokes==(par - 1)) {

return "Birdie";

} else if (strokes === par) {

return "par";

} else if (strokes==(par + 1)) {

return "Bogey";

} else if (strokes==(par + 2)) {

return "Double Bogey";

} else if (strokes>= (par + 3)) {

return "Go Home!";

}

// Only change code above this line
}

// Change these values to test
golfScore(5, 4);
<!--Guys the problem in my above code in strokes===par session -->

Kyle Morton
@kmorton1988
Mar 03 2016 05:38 UTC
@HaiderJaan I don't think you need the parenthases inside the else if definition parenthesis.
so like...you can just use
...
else if (strokes == par + 1) {
...
HaiderJaan
@HaiderJaan
Mar 03 2016 05:40 UTC
@kmorton1988 without parenthesis it is showing error ......................i'm asking you just in strokes===par session
Kyle Morton
@kmorton1988
Mar 03 2016 05:40 UTC
oh ok. @HaiderJaan , is Par supposed to be capitolized?
in the "return" portion of the action?
function update(id, prop, value) {

  if (value !== "" && prop !== "tracks") {
    collection[id[prop[value]]] = value;
  } else if (prop == "tracks" && value !== "") {
    collection.push([collection[id[prop[value]]]]);
  } else if (value !== "") {
    delete collection[id[prop]];
  }


  return collection;
}
now, I don't want an aswer.
but I want to know if I"m on the right track.
HaiderJaan
@HaiderJaan
Mar 03 2016 05:42 UTC
@kmorton1988 yes in return statement it is string in double quotes but in arguments it is small
Kyle Morton
@kmorton1988
Mar 03 2016 05:43 UTC
@HaiderJaan have you tried with
```
else if (strokes == par) {
```
HaiderJaan
@HaiderJaan
Mar 03 2016 05:44 UTC
@kmorton1988 yes i've tried it
Kyle Morton
@kmorton1988
Mar 03 2016 05:45 UTC
@HaiderJaan hmm. I don't see any issues in your code, then. Not immediately. What's the error?
HaiderJaan
@HaiderJaan
Mar 03 2016 05:46 UTC
@kmorton1988 requirement no 5 & 7 (for par) is not fullfil
Kyle Morton
@kmorton1988
Mar 03 2016 05:46 UTC
what are the requirements?
SuhasHosamani
@SuhasHosamani
Mar 03 2016 05:48 UTC
Hi All,
Im not able to print results on html page
http://codepen.io/suhashc/pen/ONVvWY?editors=1010
HaiderJaan
@HaiderJaan
Mar 03 2016 05:49 UTC
@kmorton1988 golf score(4,4) should return "Par"...................................... golfScore (5,5) should return "Par"
Jesus Vega
@ParagonChuy
Mar 03 2016 05:49 UTC
Help Everything Be True
CamperBot
@camperbot
Mar 03 2016 05:49 UTC

:point_right: algorithm everything be true [wiki]

Explanation:

The program needs to check if the second argument is a truthy element, and it must check this for each object in the first argument.

Hint: 1

Remember to iterate through the first argument to check each object.

Hint: 2

Only if all of them are truth will we return true, so make sure all of them check.

Hint: 3

You could use loops or callbacks functions, there are multiple ways to solve this problem.

Spoiler Alert!

687474703a2f2f7777772e796f75726472756d2e636f6d2f796f75726472756d2f696d616765732f323030372f31302f31302f7265645f7761726e696e675f7369676e5f322e676966.gif

Solutions ahead!

:pencil: read more about algorithm everything be true on the FCC Wiki

Kyle Morton
@kmorton1988
Mar 03 2016 05:50 UTC
capitolize the p @HaiderJaan
HaiderJaan
@HaiderJaan
Mar 03 2016 05:51 UTC
@kmorton1988 No dear its not the issue
Kyle Morton
@kmorton1988
Mar 03 2016 05:51 UTC
@HaiderJaan but the prompt specifically tells you hitting par should return "Par" not "par"
SuhasHosamani
@SuhasHosamani
Mar 03 2016 05:51 UTC
Hi All,
Im not able to print results on html page
http://codepen.io/suhashc/pen/ONVvWY?editors=1010
HaiderJaan
@HaiderJaan
Mar 03 2016 05:53 UTC
Hahaha @kmorton1988 yeah you are right and thanks for help
CamperBot
@camperbot
Mar 03 2016 05:53 UTC
haiderjaan sends brownie points to @kmorton1988 :sparkles: :thumbsup: :sparkles:
:star: 223 | @kmorton1988 | http://www.freecodecamp.com/kmorton1988
Kyle Morton
@kmorton1988
Mar 03 2016 05:54 UTC
You're welcome, @HaiderJaan lol. Silly things make you fail. the capitalization is always what I check first :P
HaiderJaan
@HaiderJaan
Mar 03 2016 05:54 UTC
ok ok
Kevin Myrick
@aphextwin234
Mar 03 2016 05:54 UTC
anyone want to try and answer a php question
Kyle Morton
@kmorton1988
Mar 03 2016 05:55 UTC
I know nothing about PHP except that it does stuff. >.>
Kevin Myrick
@aphextwin234
Mar 03 2016 05:56 UTC
@kmorton1988 it's not to bad at all to learn, fairly easy and human readable. Loosely typed like JavaScript as well.
Kyle Morton
@kmorton1988
Mar 03 2016 05:56 UTC
Well I don't particularly know javascript that well yet, either lol.
Having trouble with nested arrays and calling specific values to change them.
Kevin Myrick
@aphextwin234
Mar 03 2016 05:56 UTC
<body>
<p>
<?php
$Days =  array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
echo "<p>The days in the week in English are:</p>";
foreach($Days as $Day){
    echo $Day."<br />";

$Days =  array("Lundi","Mardi","Mecredi","Jeudi","Vendredi","Samedi","Dimanche");
echo "<p>The days in the week in French are:</p>";
foreach($Days as $Day){
    echo $Day."<br />";

}?>
</p>

</body>
I would think this would work, the first part does print an array with the days in english. However, I would think doing this assigns new values to the array so I can then print them in french
Kyle Morton
@kmorton1988
Mar 03 2016 05:58 UTC
why not just make a separate array with $frDays = array("Lundi,...etc
second one displays English again?
Kevin Myrick
@aphextwin234
Mar 03 2016 05:59 UTC
You would think, but for this exercise new values must be assign to the array, then printed out.
with the new assigned elements.
@kmorton1988 question, did you make your website? Are you not using onmouseover onmouseout when the mouse is hovered over the certain texts to get the drop down?
Kyle Morton
@kmorton1988
Mar 03 2016 06:02 UTC
which website?
oh, mine.
got it.
I designed it, but the php bits were essentialy copy/pasted and tweaked to my needs.
Rami
@RNwebdk
Mar 03 2016 06:03 UTC
@rexler thanks for takeing the time to help :thumbsup:
CamperBot
@camperbot
Mar 03 2016 06:03 UTC
rnwebdk sends brownie points to @rexler :sparkles: :thumbsup: :sparkles:
:star: 227 | @rexler | http://www.freecodecamp.com/rexler
Kevin Myrick
@aphextwin234
Mar 03 2016 06:04 UTC
yea the services provided part, how it drops down, I was wondering how you did that. @kmorton1988 I don't have any created websites stashed somewhere or applications yet.
Kyle Morton
@kmorton1988
Mar 03 2016 06:05 UTC
the dropdown menu that expands? I'd be happy to send you source.
Kevin Myrick
@aphextwin234
Mar 03 2016 06:05 UTC
@kmorton1988 would love to make some real responsive beautiful pages in BootStrap tho.
Kyle Morton
@kmorton1988
Mar 03 2016 06:05 UTC
I'd just have to...dig it up. lol.
Kevin Myrick
@aphextwin234
Mar 03 2016 06:05 UTC
eh sure sometime.
Kyle Morton
@kmorton1988
Mar 03 2016 06:05 UTC
yeah, I made that website before I knew about bootstrap or other CSS frameworks.
that whole page (minus the "Do Stuff" code) was coded by hand.
just...with tweaking and playing.
oh, and @aphextwin234, that dropdown menu is javascript powered.
Kevin Myrick
@aphextwin234
Mar 03 2016 06:08 UTC
really I need to get down a strong base of html and css. I am just getting back into it. Took Android last semester, and this Open Sources class now which has some Javascript and going through some PHP now.
Kyle Morton
@kmorton1988
Mar 03 2016 06:08 UTC
nice. You might consider the first bit of freecodecamp. Goes into massive detail about html and CSS. learned a lot.
Kevin Myrick
@aphextwin234
Mar 03 2016 06:09 UTC
Java I really would like to get down this summer. So I can get back into Android programming. I like JavaScript however, alot. Just need to practice.
some cool stuff we've done.
Kevin Myrick
@aphextwin234
Mar 03 2016 06:10 UTC
nice. Work for yourself?
Kyle Morton
@kmorton1988
Mar 03 2016 06:10 UTC
Not yet.
that's the eventual plan.
Kevin Myrick
@aphextwin234
Mar 03 2016 06:13 UTC
ya same, sent you a dm. @kmorton1988
Kyle Morton
@kmorton1988
Mar 03 2016 06:13 UTC
trying to figure out how to get back to it.
Jesus Vega
@ParagonChuy
Mar 03 2016 06:21 UTC
function binaryAgent(str) {
  var binToDec = str.split(" ");
  var arr = [];
  var result;
  for(i = 0 ; i < binToDec.length ; i++ ){
    arr[i] = parseInt(binToDec[i], 2);
    result += String.fromCharCode(arr[i]);
  }
  return result;
}

binaryAgent("01001001 00100000 01101100 01101111 01110110 01100101 00100000 01000110 01110010 01100101 01100101 01000011 01101111 01100100 01100101 01000011 01100001 01101101 01110000 00100001");
I keep getting an undefined value attached to the first letter
Salvatore Santamaria
@ssroman
Mar 03 2016 06:23 UTC
welp, this is a noob question. currently im in full screen chat mode. how can i make it go back to a side scroll?
This message was deleted
This message was deleted
Salvatore Santamaria
@ssroman
Mar 03 2016 06:28 UTC
This message was deleted
Additionally, if you type three backticks followed by alt+enter, we will automagically toggle compose mode (as well as close your backticks for you) so you can easily type in code. When you send the message, compose mode will get toggled back off. Neat, huh?
i cant get code compose mode to work. what am i doing wrong? backtick is `
Salvatore Santamaria
@ssroman
Mar 03 2016 06:33 UTC
my real question is why doesnt this work?
function truncate(str, num) {
// Clear out that junk in your trunk
if (num <= 3){
return str.substr(0, num);}
else if
(num > 3){
return str.substr(0, num) + "...";}
}
return str;
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 06:35 UTC
@ParagonChuy try var string="";
Jesus Vega
@ParagonChuy
Mar 03 2016 06:37 UTC
<3 @abhishekKumar1
Thanks @abhishekKumar1
CamperBot
@camperbot
Mar 03 2016 06:37 UTC
paragonchuy sends brownie points to @abhishekkumar1 :sparkles: :thumbsup: :sparkles:
:star: 367 | @abhishekkumar1 | http://www.freecodecamp.com/abhishekkumar1
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 06:38 UTC
@ssroman your last return str; is outside the function
Zach
@Moose1551
Mar 03 2016 06:42 UTC
Is there any way to find the answers for "Stand in Line" in the Basic JavaScript? I'm completely lost.
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 06:43 UTC
@Moose1551 post what have you tried so far
bot Stand in line
CamperBot
@camperbot
Mar 03 2016 06:43 UTC

:point_right: checkpoint stand in line [wiki]

Checkpoint: Stand In Line

About queues

In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.

Instructions

Write a function queue which takes an "array" and an "item" as arguments.

Add the item onto the end of the array, then remove the first element of the array.

The queue function should return the element that was removed.

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.

:pencil: read more about checkpoint stand in line on the FCC Wiki

Zach
@Moose1551
Mar 03 2016 06:45 UTC
@abhishekKumar1 , that's the thing. I don't even know where to start.
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 06:46 UTC
@Moose1551 read about .shift() and .push() in js
Zach
@Moose1551
Mar 03 2016 06:48 UTC
@abhishekKumar1 , thank you.
CamperBot
@camperbot
Mar 03 2016 06:48 UTC
moose1551 sends brownie points to @abhishekkumar1 :sparkles: :thumbsup: :sparkles:
:star: 368 | @abhishekkumar1 | http://www.freecodecamp.com/abhishekkumar1
Matthew Stettner
@mstettner
Mar 03 2016 07:00 UTC
anybody know what I am supposed to do for "Storing Values with the Equal Operator"
I have no idea what the lesson wants me to do. any guidance would be appreciated.
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 07:01 UTC
@mstettner it wants you to store a value of 7 in a and then store the value of a in b try it out
Ankit Panwar
@coderNoob
Mar 03 2016 07:02 UTC
@mstettner the = is an assignment operator and the exercise wants you to assign the value of 7 to a and then assign the value of a to b.
Matthew Stettner
@mstettner
Mar 03 2016 07:03 UTC
@abhishekKumar1 see I have absolutly no idea what that means. when did I learn that/
so this is wrong var a = 7; @coderNoob
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 07:03 UTC
@mstettner try reading about arithmetic operators
Matthew Stettner
@mstettner
Mar 03 2016 07:03 UTC
I need you user name btw.
I am the coder noob
@abhishekKumar1 where do i read the arithmetic operators lol
what is going on?
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 07:04 UTC
google it
Matthew Stettner
@mstettner
Mar 03 2016 07:04 UTC
googling
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 07:06 UTC
btw var a=7; is correct but since a has been initialized earlier as you can see it was written var a in the code provided to you so you can use a=7 no need of var
think similarly to assign the value of a to b
Matthew Stettner
@mstettner
Mar 03 2016 07:07 UTC
var a = 7;
var a = b;
is this looking right? did I miss a lesson or something? I mean is there some sort of walk through. I couldnt be more lost.
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 07:07 UTC
you have to put value of a into b
Matthew Stettner
@mstettner
Mar 03 2016 07:08 UTC
how do i put the value of a into b?
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 07:08 UTC
you are doing the other way you are putting value of b into a
Ankit Panwar
@coderNoob
Mar 03 2016 07:08 UTC
@mstettner By doing b = a
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 07:08 UTC
equal sign puts the RHS value to LHS
Ankit Panwar
@coderNoob
Mar 03 2016 07:09 UTC
You really need to walk through the arithmetic operators and how they work. Operators
Matthew Stettner
@mstettner
Mar 03 2016 07:09 UTC
thanks i passed the lesson lol @coderNoob @abhishekKumar1
CamperBot
@camperbot
Mar 03 2016 07:09 UTC
mstettner sends brownie points to @codernoob and @abhishekkumar1 :sparkles: :thumbsup: :sparkles:
:star: 343 | @codernoob | http://www.freecodecamp.com/codernoob
:star: 369 | @abhishekkumar1 | http://www.freecodecamp.com/abhishekkumar1
Matthew Stettner
@mstettner
Mar 03 2016 07:10 UTC
Is JS like learning algebra?
why didnt the lesson walk me through arithemtic operators?
kirbyedy
@kirbyedy
Mar 03 2016 07:10 UTC
well that is the first step :)
Matthew Stettner
@mstettner
Mar 03 2016 07:12 UTC
I'm three lessons into JS and couldnt be more lost
I mean what is going on
Zach
@Moose1551
Mar 03 2016 07:14 UTC

@mstettner , I understand how you feel compltely. I don't see how this:

// Setup
function myTest(val) {
  if (val == 12) { // Change this line
    return "Equal";
  }
  return "Not Equal";
}

// Change this value to test
myTest(12);

enabled me to pass if the number "10" isn't even present.

Matthew Stettner
@mstettner
Mar 03 2016 07:15 UTC
@Moose1551 holy hell
Zach
@Moose1551
Mar 03 2016 07:15 UTC
It's frustrating doing all of this when I can't even see how this would be applicable in a real world situation.
Matthew Stettner
@mstettner
Mar 03 2016 07:16 UTC
you passed the lesson though?
@Moose1551 exactly! what is this pertaining to?
kirbyedy
@kirbyedy
Mar 03 2016 07:16 UTC
guys it is normal, I felt the same, we all went through the shit storm
Matthew Stettner
@mstettner
Mar 03 2016 07:16 UTC
im trying to wrap my head around what this means.
Initialize a to a value of 9
like what am i supposed to do with that. so far I have just been staring at it
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:17 UTC
when you initialize something, you are declaring and setting the value
Ankit Panwar
@coderNoob
Mar 03 2016 07:17 UTC
The first time I read some code was "Hello World" and I was lost. I had no clue what was happening. Even when the teacher tried changing the values so that I could understand but I coudln't.
Zach
@Moose1551
Mar 03 2016 07:17 UTC
@mstettner , This was actually relatively easy. You'd be able to do this part. Some of the challenges are very confusing, but so far most are relatively straight forward. The one your on drove me a little crazy. But, once you figure it out, you'll be annoyed with how simple it is.
@dpurdy1113 , I'm glad to hear that.
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:18 UTC
so you have to tell Javascript that you are making a variable called a, and telling javascript that a is holding the value of 9
Matthew Stettner
@mstettner
Mar 03 2016 07:18 UTC
this is what i put
myVar = a;
a = 9;
lol
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:19 UTC
that's not working
Ankit Panwar
@coderNoob
Mar 03 2016 07:19 UTC
a has no value in it. So you can't assign it to myVar @mstettner
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:19 UTC
because what you are doing
Matthew Stettner
@mstettner
Mar 03 2016 07:19 UTC
how do i declare the value to nine
Liviu Tudor
@enzime4u
Mar 03 2016 07:19 UTC
var myVar = 9;
Matthew Stettner
@mstettner
Mar 03 2016 07:19 UTC
okay so
what does var mean and what does myVar mean
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:20 UTC
is creating a variable called myVar and giving it a value of a...then creating a new variable called a and giving it a value of 9
Ankit Panwar
@coderNoob
Mar 03 2016 07:20 UTC
@mstettner You declare a variable called a by doing this var a;. Currently it has no value. By default it contains null. Now assign it a value by a = 9;.
kirbyedy
@kirbyedy
Mar 03 2016 07:20 UTC
@mstettner just remember this... = sign means... I am assigning some value to something
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:20 UTC
var is the declaration that you are making a variable - var a means you are telling javascript that there will now be a variable called a
var a = 9 is the same thing, but instead of not assigning a value, you are telling Javascript that there is a variable a and the value is 9
Ankit Panwar
@coderNoob
Mar 03 2016 07:21 UTC
@mstettner Declaring a variable means that you are taking a memory reference where you will be storing the values that you will assign to that variable.
A variable is taking an actual physical space in your computer's memory when you declare it.
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:22 UTC
think of var a = 9 as you literally telling Javascript " There will now be a variable called a that has a value of 9"
Zach
@Moose1551
Mar 03 2016 07:22 UTC
@mstettner , in the example (var ourVar = 19;),
ourVar is just a name. You could call it "var myFart" if you wanted do. So, they just want you to make a var named "a".
@dpurdy1113 and @coderNoob are speaking truth, though. Thanks, you two.
CamperBot
@camperbot
Mar 03 2016 07:23 UTC
moose1551 sends brownie points to @dpurdy1113 and @codernoob :sparkles: :thumbsup: :sparkles:
:star: 292 | @dpurdy1113 | http://www.freecodecamp.com/dpurdy1113
:star: 344 | @codernoob | http://www.freecodecamp.com/codernoob
Matthew Stettner
@mstettner
Mar 03 2016 07:24 UTC
okay I put this:Var = a;
a = 9;
Var = a;
a = 9;
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:24 UTC
no
Matthew Stettner
@mstettner
Mar 03 2016 07:24 UTC
and it wrong and I am lost
Ankit Panwar
@coderNoob
Mar 03 2016 07:24 UTC
@mstettner var has to start with a small v like var. It's a grammatical rule in JS.
Matthew Stettner
@mstettner
Mar 03 2016 07:25 UTC
okay
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:25 UTC
you'll confuse yourself doing it that way
Zach
@Moose1551
Mar 03 2016 07:25 UTC
@mstettner , copy the example and just change the var name and the number.
Coy Sanders
@coymeetsworld
Mar 03 2016 07:25 UTC
but if you don't assign the variable does it allocate memory?
Ankit Panwar
@coderNoob
Mar 03 2016 07:25 UTC
Like any other language has it's own grammatical rules.
Coy Sanders
@coymeetsworld
Mar 03 2016 07:25 UTC
if you just declare var myVar for example, how does it know how much memory to allocate?
for instance it would be different if you assign it to a string or an int, or a float right?
Matthew Stettner
@mstettner
Mar 03 2016 07:26 UTC
what part of the name do I change?
var myVar = 9;
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:26 UTC
that is perfect
Ankit Panwar
@coderNoob
Mar 03 2016 07:26 UTC
@coymeetsworld Yes. Every primitive data type, i.e. int, byte, float, string, char, require different amounts of memory.
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:27 UTC
that means you have made a variable called myVar and the value is the integer 9
Matthew Stettner
@mstettner
Mar 03 2016 07:27 UTC
@dpurdy1113 okay so what else do I need to move on to the next lesson?
Ankit Panwar
@coderNoob
Mar 03 2016 07:27 UTC
@mstettner var myVar = 9; is correct.
Coy Sanders
@coymeetsworld
Mar 03 2016 07:27 UTC
right, so if you just did var myVar; but didn't assign anything, it wouldn't allocate memory right? @coderNoob ?
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:28 UTC
which lesson are you and what is it saying you need to do @mstettner
Matthew Stettner
@mstettner
Mar 03 2016 07:28 UTC
there is still a red x next to this - Initialize a to a value of 9
@dpurdy1113 Initialize a to a value of 9
Coy Sanders
@coymeetsworld
Mar 03 2016 07:28 UTC
is 'a' the variable name?
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:28 UTC
use that same text you wrote earlier, but instead of myVar , change it to a
Coy Sanders
@coymeetsworld
Mar 03 2016 07:28 UTC
var a = 9?
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:29 UTC
@coymeetsworld is right without the question mark of course
Coy Sanders
@coymeetsworld
Mar 03 2016 07:29 UTC
that is kind of confusing, they probably shouldn't call the variable a lol
yeah no question mark lol
Matthew Stettner
@mstettner
Mar 03 2016 07:29 UTC
sooooooo confusing
Zach
@Moose1551
Mar 03 2016 07:29 UTC
@mstettner , that's all you need to do. Frustratingly simple, isn't it?
Matthew Stettner
@mstettner
Mar 03 2016 07:29 UTC
@coymeetsworld are you on the same lesson as me?
@Moose1551 i got it now. I PASSED!!!!
Ankit Panwar
@coderNoob
Mar 03 2016 07:30 UTC
@coymeetsworld That's a good question you asked and I do not know the answer to that. I will search for it.
Coy Sanders
@coymeetsworld
Mar 03 2016 07:30 UTC
no I just finished the Wiki zipline
Matthew Stettner
@mstettner
Mar 03 2016 07:30 UTC
@Moose1551 @dpurdy1113 thanks
CamperBot
@camperbot
Mar 03 2016 07:30 UTC
mstettner sends brownie points to @moose1551 and @dpurdy1113 :sparkles: :thumbsup: :sparkles:
:star: 293 | @dpurdy1113 | http://www.freecodecamp.com/dpurdy1113
:star: 187 | @moose1551 | http://www.freecodecamp.com/moose1551
Coy Sanders
@coymeetsworld
Mar 03 2016 07:30 UTC
starting Twitch at some point idk, Im contemplating either starting that or doing work for my job lol
Zach
@Moose1551
Mar 03 2016 07:30 UTC
Keep going, you two. Y'all will get the hang of it for a while. At least until "Stand in Line"...
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:30 UTC
it can get pretty frustrating , but stick with it, it's basically like learning a new language ( like Japanese) , so give it time :)
Matthew Stettner
@mstettner
Mar 03 2016 07:30 UTC
@coymeetsworld sounds scary
Coy Sanders
@coymeetsworld
Mar 03 2016 07:31 UTC
ok just wondering @coderNoob, no idea either and didn't find an answer off the bat
Matthew Stettner
@mstettner
Mar 03 2016 07:31 UTC
"it's basically like learning a new language ( like Japanese)" OH GOD
Coy Sanders
@coymeetsworld
Mar 03 2016 07:31 UTC
@mstettner what sounds scary? the Twitch challenge?
Ankit Panwar
@coderNoob
Mar 03 2016 07:31 UTC
I do this at work too. :P But I'm usually done with my work pretty early.
Matthew Stettner
@mstettner
Mar 03 2016 07:31 UTC
wiki zipline
CamperBot
@camperbot
Mar 03 2016 07:31 UTC
no wiki entry for: zipline
Matthew Stettner
@mstettner
Mar 03 2016 07:31 UTC
sounds exotic. I have no idea what it is
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:31 UTC
I work overnights at a hotel, I have nothing better to do lol
Coy Sanders
@coymeetsworld
Mar 03 2016 07:32 UTC
well im not technically on the clock at work lol, but i do have stuff i can have done now so I don't have to do in the morning
Matthew Stettner
@mstettner
Mar 03 2016 07:32 UTC
okay so eventually you guys think Ill get the hang of this?
Ankit Panwar
@coderNoob
Mar 03 2016 07:32 UTC
@mstettner Without a doubt.
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:32 UTC
you will get it
and once it clicks you
Zach
@Moose1551
Mar 03 2016 07:33 UTC
Yes. Keep pushing through it.
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:33 UTC
will feel that lightbulb go off
Matthew Stettner
@mstettner
Mar 03 2016 07:33 UTC
concatenate - new word
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:33 UTC
concatenate is just a fancy way to say combine
Kevin Myrick
@aphextwin234
Mar 03 2016 07:33 UTC
does anyone know how to put float numbers into an array in php. Like .08284 or something of this type.
Matthew Stettner
@mstettner
Mar 03 2016 07:33 UTC
yep
Zach
@Moose1551
Mar 03 2016 07:33 UTC
If you get frustrated, take a break and conmasturbate
Matthew Stettner
@mstettner
Mar 03 2016 07:34 UTC
hahahahahahahahah @Moose1551
Zach
@Moose1551
Mar 03 2016 07:34 UTC
lol
I'm signing off. Godspeed, @mstettner and @coymeetsworld
Coy Sanders
@coymeetsworld
Mar 03 2016 07:36 UTC
later @Moose1551
Matthew Stettner
@mstettner
Mar 03 2016 07:36 UTC
brb
Coy Sanders
@coymeetsworld
Mar 03 2016 07:36 UTC
oh and @mstettner yeah it was a little challenging but interesting
the wiki zipline
Matthew Stettner
@mstettner
Mar 03 2016 07:37 UTC
@coymeetsworld ill let you what I think when I get there
so why is this incorrect?
var a; 5;
var b; 10;
var c; "I am a";
isnt that what I am supposed to do
Coy Sanders
@coymeetsworld
Mar 03 2016 07:37 UTC
key there is just to know how the wiki apis work, seems like that and the weather apis i used for another zipline have their own quirks, im sure twitch will too
Ankit Panwar
@coderNoob
Mar 03 2016 07:37 UTC
@mstettner ; is like a full stop or period in a JS language.
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:37 UTC
it's asking you to concatenate right?
Matthew Stettner
@mstettner
Mar 03 2016 07:37 UTC
Initialize the three variables a, b, and c with 5, 10, and "I am a" respectively so that they will not be undefined.
@dpurdy1113 yes
Ankit Panwar
@coderNoob
Mar 03 2016 07:38 UTC
@mstettner You need to put = instead of ; to assign the variables some value.
Coy Sanders
@coymeetsworld
Mar 03 2016 07:38 UTC
yeah ; is like the end of a sentence or line in Javascript essentially
only should have one of those per line and at the end
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:38 UTC
initialize your variables like you did on the last one with a = 5, etc
Coy Sanders
@coymeetsworld
Mar 03 2016 07:39 UTC
as everyone is saying, = is what is called the assignment operator, it gives whatever you declare on the left the value of what you declare on the right
think algebra
Matthew Stettner
@mstettner
Mar 03 2016 07:39 UTC
yeah Im trying to think algebra
Coy Sanders
@coymeetsworld
Mar 03 2016 07:39 UTC
x = 2, you're saying that the variable x is equal to 2
Matthew Stettner
@mstettner
Mar 03 2016 07:39 UTC
var a; 5=
var b; 10=
var c; "I am a";
i dont know what I am doing
Coy Sanders
@coymeetsworld
Mar 03 2016 07:40 UTC
no remember the semicolon is the end of a sentence
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:40 UTC
semicolon is end of sentence
Coy Sanders
@coymeetsworld
Mar 03 2016 07:40 UTC
and the equals sign needs to have something on both sides
Matthew Stettner
@mstettner
Mar 03 2016 07:40 UTC
var a; 5=
var b; 10=
var c; "I am a"=
am i even close
Coy Sanders
@coymeetsworld
Mar 03 2016 07:40 UTC
like in algebra x =2, not x 2 = right?
Matthew Stettner
@mstettner
Mar 03 2016 07:41 UTC
hmmm soooo
Coy Sanders
@coymeetsworld
Mar 03 2016 07:41 UTC
only difference in javascript is you put a semicolon at the end, which tells the interpreter "hey im done with this sentence go to the next one"
kirbyedy
@kirbyedy
Mar 03 2016 07:41 UTC
semicolon, always at the end of statement, with a semicolon you are telling the computer that you finished with a statement
Ankit Panwar
@coderNoob
Mar 03 2016 07:41 UTC
@mstettner What you did was finish the sentence at var a;. 5= has no meaning.
Matthew Stettner
@mstettner
Mar 03 2016 07:42 UTC
holy shit guys look at this
var a=5;
var b=10;
var c="I am a";
Coy Sanders
@coymeetsworld
Mar 03 2016 07:42 UTC
bingo
Ankit Panwar
@coderNoob
Mar 03 2016 07:42 UTC
@mstettner You got it.
Matthew Stettner
@mstettner
Mar 03 2016 07:42 UTC
@coymeetsworld thanks
CamperBot
@camperbot
Mar 03 2016 07:42 UTC
mstettner sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:42 UTC
@mstettner perfect
CamperBot
@camperbot
Mar 03 2016 07:42 UTC
:star: 324 | @coymeetsworld | http://www.freecodecamp.com/coymeetsworld
Matthew Stettner
@mstettner
Mar 03 2016 07:42 UTC
@coderNoob thanks
CamperBot
@camperbot
Mar 03 2016 07:42 UTC
mstettner sends brownie points to @codernoob :sparkles: :thumbsup: :sparkles:
:warning: mstettner already gave codernoob points
Matthew Stettner
@mstettner
Mar 03 2016 07:42 UTC
it wont let me give you brownie points @coderNoob
how long is the wait time on that?
Ankit Panwar
@coderNoob
Mar 03 2016 07:43 UTC
@mstettner It's no problem. You already gvae me some brownie points.
Coy Sanders
@coymeetsworld
Mar 03 2016 07:43 UTC
lol thats a good question
Ankit Panwar
@coderNoob
Mar 03 2016 07:43 UTC
No idea about the time.
Matthew Stettner
@mstettner
Mar 03 2016 07:43 UTC
whats easier? lesrning japanese or learning JS?
Ankit Panwar
@coderNoob
Mar 03 2016 07:43 UTC
Keep at it and other people will be giving you some brownies.
Coy Sanders
@coymeetsworld
Mar 03 2016 07:43 UTC
they should do like what facebook does and you can give thumbs up a smiley face or a high five or something maybe
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:44 UTC
Javascript
Matthew Stettner
@mstettner
Mar 03 2016 07:44 UTC
what can you do with brwonie points?
Ankit Panwar
@coderNoob
Mar 03 2016 07:44 UTC
Don't know really.
Coy Sanders
@coymeetsworld
Mar 03 2016 07:44 UTC
nothing I don't think
Ankit Panwar
@coderNoob
Mar 03 2016 07:44 UTC
They're just points to me.
Matthew Stettner
@mstettner
Mar 03 2016 07:44 UTC
blob
Coy Sanders
@coymeetsworld
Mar 03 2016 07:44 UTC
it just shows how much you're doing, you get points for completing challenges and ziplines, here in the chat, and i think if you post articles or something
Matthew Stettner
@mstettner
Mar 03 2016 07:44 UTC
@coderNoob
Emil Aasa
@emilaasa
Mar 03 2016 07:45 UTC
epeen
Ankit Panwar
@coderNoob
Mar 03 2016 07:45 UTC
Maybe they mean something when you are done with course and you try to do a non-profit project. They check out your work and maybe your reputation points too.
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:45 UTC
they are both rough starting off, but once you learn the basics, Javascript is a lot simpler than it seems.
kirbyedy
@kirbyedy
Mar 03 2016 07:45 UTC
it makes you feel awesome having those virtual brownies :D
I come here everyday to get those brownies
Coy Sanders
@coymeetsworld
Mar 03 2016 07:45 UTC
i guess you can use it to gauge how helpful a person is, like if they have over 1000 they had to have helped out alot of people
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:45 UTC
I wish they were physical brownies =( I'm hungry lol
kirbyedy
@kirbyedy
Mar 03 2016 07:45 UTC
maybe one day they will convert them :D
Matthew Stettner
@mstettner
Mar 03 2016 07:45 UTC
yeah Ive seen you here before @kirbyedy here have some brownie points. thanks
CamperBot
@camperbot
Mar 03 2016 07:45 UTC
mstettner sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star: 589 | @kirbyedy | http://www.freecodecamp.com/kirbyedy
kirbyedy
@kirbyedy
Mar 03 2016 07:46 UTC
to analog brownies :D
wooohooo thanks @mstettner
CamperBot
@camperbot
Mar 03 2016 07:46 UTC
kirbyedy sends brownie points to @mstettner :sparkles: :thumbsup: :sparkles:
:star: 137 | @mstettner | http://www.freecodecamp.com/mstettner
Matthew Stettner
@mstettner
Mar 03 2016 07:46 UTC
YIPPEEE! my first brownie points lol
Coy Sanders
@coymeetsworld
Mar 03 2016 07:46 UTC
haha well you already get some for completing challenges and stuff
Matthew Stettner
@mstettner
Mar 03 2016 07:47 UTC
@coymeetsworld oh, didnt know that
Coy Sanders
@coymeetsworld
Mar 03 2016 07:47 UTC
but since there's only so many challenges when you see people have more like in the thousands range then they must've been active in the community
and yeah its not really checked like, maybe he's just a nice guy or whatever
but odds are you get brownie points for helping someone, presumably with the coding
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:48 UTC
oh and don't worry if you feel lost, there are still moments like that every week that I still get stuck
Coy Sanders
@coymeetsworld
Mar 03 2016 07:48 UTC
oh yeah one dude i was trying to help last week was throwing out f bombs lol
f this been stuck on this 2 weeks s doesn't work haha
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:49 UTC
the basic algorithms took me forever for it to click
Coy Sanders
@coymeetsworld
Mar 03 2016 07:49 UTC
i'm like i know that feel bro lol
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:49 UTC
I probably spent 8-10 hours on just one of them when I first did it
Matthew Stettner
@mstettner
Mar 03 2016 07:50 UTC
Fix the variable declarations and assignments so their names use camelCase.
what is camelCase?
is that just a made up word?
Coy Sanders
@coymeetsworld
Mar 03 2016 07:50 UTC
no its a format
whenYouCapitalizeEachWordInOneStringWithNoSpaces
Matthew Stettner
@mstettner
Mar 03 2016 07:50 UTC
ohhhhhhhhh
interesting
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:50 UTC
no it's not made up, it's a format where the first letter of the name is lowercase but the first letter of other words in the name are uppercase
Coy Sanders
@coymeetsworld
Mar 03 2016 07:50 UTC
the capital letters look like humps, hence camelCase
you don't need to do it that way per say, its just a standard
Matthew Stettner
@mstettner
Mar 03 2016 07:51 UTC
very interesting
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:51 UTC
like myVar is camel case
Coy Sanders
@coymeetsworld
Mar 03 2016 07:51 UTC
ruby for instance, uses underscores instead to separate words in a variable as a standard
Trevor Baker
@noizehack
Mar 03 2016 07:51 UTC
anyone know how its possible that I create a new object with a constructor and then instanceof says that it is not an instance of that consturctor?
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:51 UTC
mStettner would be camelcase
Coy Sanders
@coymeetsworld
Mar 03 2016 07:51 UTC
so like you would call a variable my_var or some_string
which you could also do in JavaScript, both are valid names for a variable
but better to stick to a standard because people that would read your code in JavaScript would expect it
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:52 UTC
ruby is a lot cleaner language imo, but if you learn Javascript picking up any language will be way way easier
Coy Sanders
@coymeetsworld
Mar 03 2016 07:53 UTC
yeah ruby did away with alot of the programming syntax to make it look more like English
but yeah JavaScript has syntax similar to languages like C, Java, C++ etc
not that that makes it better or anything
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:54 UTC
don't worry too much about the actual language, just learn the ideas behind it - if you know variable declaration and initialization in Javascript , it's a lot easier to pick up in Java , Ruby, Python...any language really
Matthew Stettner
@mstettner
Mar 03 2016 07:55 UTC
@dpurdy1113 how many laguages do you know?
how many languages do most good programers know?
studlyCapVar = 10;
properCamelCase = "A String";
titleCaseOver
why isnt the first letter capped in camelCase?
Coy Sanders
@coymeetsworld
Mar 03 2016 07:57 UTC
i would say typically letters aren't capitalized in programming languages
so they capitalize as a necessity only to distinguish words, but I honestly don't know
HaiderJaan
@HaiderJaan
Mar 03 2016 07:57 UTC

function isLess(a, b) {
// Fix this code
switch (a,b) {
case a<b : {
return true;
}

default: {
return true;
}
}
}
// Change these values to test
isLess(10, 15);
<!--Guys whats the problem in my above code --> <!--why it is not fulfilling the 2nd requirement -->

Coy Sanders
@coymeetsworld
Mar 03 2016 07:57 UTC
i think it looks better not capitalizing first word in a variable
Matthew Stettner
@mstettner
Mar 03 2016 07:58 UTC
so much stuff to learn
Trevor Baker
@noizehack
Mar 03 2016 07:58 UTC
@mstettner it is easier to find thing in bash or other command lines if the first letter is lowercase as well
Coy Sanders
@coymeetsworld
Mar 03 2016 07:58 UTC
@HaiderJaan what happens when a > b?
Matthew Stettner
@mstettner
Mar 03 2016 07:58 UTC
so camelCase just breaks things up and makes it easier to read?
Trevor Baker
@noizehack
Mar 03 2016 07:58 UTC
since you don't have to hit the shift key, you just start typing lowercase and then hit tab
Coy Sanders
@coymeetsworld
Mar 03 2016 07:58 UTC
how will your switch statement handle that?
yeah pretty much @mstettner
again you don't HAVE to do it, but you SHOULD :)
Ankit Panwar
@coderNoob
Mar 03 2016 07:59 UTC
@mstettner In my opinion a good programmer is great at any one language. It can be any language. There is no superior and inferior language.
Matthew Stettner
@mstettner
Mar 03 2016 07:59 UTC
illDoIt
Coy Sanders
@coymeetsworld
Mar 03 2016 07:59 UTC
:thumbsup:
yeah and as far as languages it depends
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:59 UTC
by not capitalizing it, it also helps to root out what is your variables and what are standard words in javascript imo - if you see a line of code like var myDogIsHappy = 12 (which literally makes no sense) it's easier to spot variable names
Matthew Stettner
@mstettner
Mar 03 2016 07:59 UTC
what languages have to most job demand? what languages are the most fun? what languages pay the best?
Coy Sanders
@coymeetsworld
Mar 03 2016 07:59 UTC
in web development things can change rapidly, so you may need to learn new languages as they become relevant
Douglas Purdy
@dpurdy1113
Mar 03 2016 07:59 UTC
Javascript is probably the most in demand
since there are so many things you can do with it
Matthew Stettner
@mstettner
Mar 03 2016 08:00 UTC
can you build games with JS?
HaiderJaan
@HaiderJaan
Mar 03 2016 08:00 UTC
@coymeetsworld in every conditiin (a<b or b<a) it print out the result of default
Coy Sanders
@coymeetsworld
Mar 03 2016 08:00 UTC
one day Ruby is killing it, then all of a sudden JavaScript gets their own backend libraries,
Douglas Purdy
@dpurdy1113
Mar 03 2016 08:00 UTC
yes
kirbyedy
@kirbyedy
Mar 03 2016 08:00 UTC
@HaiderJaan wait why are you using switch ?
Matthew Stettner
@mstettner
Mar 03 2016 08:00 UTC
did JS just recenlty get backend libraries?
Coy Sanders
@coymeetsworld
Mar 03 2016 08:00 UTC
how do you know if both return true @HaiderJaan ?
Douglas Purdy
@dpurdy1113
Mar 03 2016 08:01 UTC
getting all the various libraries is what makes it so good to learn imo, having Ajax, Node, Ember, etc
Coy Sanders
@coymeetsworld
Mar 03 2016 08:01 UTC
also @kirbyedy has a point, switch probably not the right way to do this exercise since you only expect 2 cases
switch you would use if you have multiple cases you would need to process
Ankit Panwar
@coderNoob
Mar 03 2016 08:01 UTC
@mstettner You should follow Quincy Larsen on quora and read blogs on medium.com too.
Coy Sanders
@coymeetsworld
Mar 03 2016 08:01 UTC
an if/else statement would probably be better to use
Ankit Panwar
@coderNoob
Mar 03 2016 08:01 UTC
It's helpful
Matthew Stettner
@mstettner
Mar 03 2016 08:01 UTC
okay Quicy Larsen
Quincy
*
kirbyedy
@kirbyedy
Mar 03 2016 08:02 UTC
the instruction for that task says: Fix the function isLess to remove the if/else statements.
Matthew Stettner
@mstettner
Mar 03 2016 08:02 UTC
and code camp made me sign up for medium
I have barely checked out medium
kirbyedy
@kirbyedy
Mar 03 2016 08:02 UTC
and gitter, and github
Douglas Purdy
@dpurdy1113
Mar 03 2016 08:02 UTC
as for me I'm comfortable with about 3 languages
Coy Sanders
@coymeetsworld
Mar 03 2016 08:02 UTC
ah ok lol @kirbyedy
HaiderJaan
@HaiderJaan
Mar 03 2016 08:02 UTC
@kirbyedy because it is the requirement to remove if else and add switch
kirbyedy
@kirbyedy
Mar 03 2016 08:02 UTC
ist just a simple > <
Matthew Stettner
@mstettner
Mar 03 2016 08:03 UTC
wait Quincy Larsen started code camp?
kirbyedy
@kirbyedy
Mar 03 2016 08:03 UTC
wait are we talking about this: Returning Boolean Values from Functions ?
Coy Sanders
@coymeetsworld
Mar 03 2016 08:03 UTC
well just remember you have two expected outputs for isLess, either the result is true, or false
HaiderJaan
@HaiderJaan
Mar 03 2016 08:03 UTC
@kirbyedy yes
Douglas Purdy
@dpurdy1113
Mar 03 2016 08:03 UTC
immerse yourself in code and it is amazing how easy it becomes - I watch Twitch streams, I get emails from Quora, Medium, everything I do is centered around learning to code
kirbyedy
@kirbyedy
Mar 03 2016 08:04 UTC
@HaiderJaan then I am pretty sure you just have to use < > signs and thats it
not complicated really
HaiderJaan
@HaiderJaan
Mar 03 2016 08:04 UTC
@kirbyedy bro im using it
Douglas Purdy
@dpurdy1113
Mar 03 2016 08:04 UTC
if you live in a city with a meetup for coding - go to it, nothing beats meeting people
Coy Sanders
@coymeetsworld
Mar 03 2016 08:04 UTC
actually easier than that @kirbyedy @HaiderJaan
or wait no nvm i misunderstood what you wrote
kirbyedy
@kirbyedy
Mar 03 2016 08:05 UTC
@HaiderJaan can I see your code please
Coy Sanders
@coymeetsworld
Mar 03 2016 08:05 UTC
thought you meant using < and > lol
kirbyedy
@kirbyedy
Mar 03 2016 08:05 UTC
:D
Coy Sanders
@coymeetsworld
Mar 03 2016 08:05 UTC
yeah it should take one line
Matthew Stettner
@mstettner
Mar 03 2016 08:06 UTC
@dpurdy1113 where has learning code led you? what road am i going down? I just started this camp out of curiosity and bc I felt like I was falling behind with technology. I wanted to learn what coding was all about.
HaiderJaan
@HaiderJaan
Mar 03 2016 08:06 UTC

@kirbyedy here is my code function isLess(a, b) {
// Fix this code
switch (a,b) {
case a<b : {
return true;
}

  default : {
    return false;
  }      

}
}
// Change these values to test
isLess(10, 15);

kirbyedy
@kirbyedy
Mar 03 2016 08:06 UTC
how about erasing everything and just leave this line: a<b
because if a is less than be it will return true, if its not it will return false
and that it your task
no matter whats in the brackets in the last line
so even if you put any random number in those brackets in the last line it should work
HaiderJaan
@HaiderJaan
Mar 03 2016 08:08 UTC
@kirbyedy nope
Coy Sanders
@coymeetsworld
Mar 03 2016 08:08 UTC
wow @mstettner lol this was the most recent post on devopsreactions.tumblr lol http://devopsreactions.tumblr.com/post/140324458371/when-someone-doesnt-follow-the-coding-style
kirbyedy
@kirbyedy
Mar 03 2016 08:08 UTC
nope what ?
Douglas Purdy
@dpurdy1113
Mar 03 2016 08:09 UTC
I started learning this as a hobby, but now it's my goal to do a career change. for me it's not just learning to code that I love it's learning to think like a computer to solve problems
Matthew Stettner
@mstettner
Mar 03 2016 08:09 UTC
@coymeetsworld hahaha yeah so its super frowned upon
Finesse Rucker
@Finesse315
Mar 03 2016 08:09 UTC
I am so lost on this challenge, I am not even sure what they are asking me to do, can someone lend me a hand? http://www.freecodecamp.com/challenges/stand-in-line
kirbyedy
@kirbyedy
Mar 03 2016 08:10 UTC
@Finesse315 you should use:
Matthew Stettner
@mstettner
Mar 03 2016 08:10 UTC
@dpurdy1113 how much done one need to know to be able to make a career out of coding? I would Imagine that is years away for me
Coy Sanders
@coymeetsworld
Mar 03 2016 08:11 UTC
yes @mstettner like masturbating on an airplane
HaiderJaan
@HaiderJaan
Mar 03 2016 08:11 UTC
@Finesse315 write this arr.push(item);
var num = arr[0];
arr.shift();
return num; // Change this line
Matthew Stettner
@mstettner
Mar 03 2016 08:11 UTC
@coymeetsworld hahaha
I thought that that was what those little red blankets were for? @coymeetsworld
Coy Sanders
@coymeetsworld
Mar 03 2016 08:12 UTC
no they took those away people got all sensitive, thanks alot Bin Laden
Matthew Stettner
@mstettner
Mar 03 2016 08:13 UTC
yeah for real Bin Laden way to go asshole
Finesse Rucker
@Finesse315
Mar 03 2016 08:15 UTC
Thanks Haider, I see what they was asking now..
Matthew Stettner
@mstettner
Mar 03 2016 08:15 UTC
I got bumped up top first class the other day and they still had the red blankets. ;)
@coymeetsworld
Coy Sanders
@coymeetsworld
Mar 03 2016 08:16 UTC
lol
Matthew Stettner
@mstettner
Mar 03 2016 08:16 UTC
hey guys how often am i going to be using this i++;
?
Fabian
@carbonbased7
Mar 03 2016 08:16 UTC
@mstettner all the time.
Matthew Stettner
@mstettner
Mar 03 2016 08:17 UTC
and how is it the equilivant of i = i + 1;?
Finesse Rucker
@Finesse315
Mar 03 2016 08:17 UTC
returns the same answer
Matthew Stettner
@mstettner
Mar 03 2016 08:17 UTC
@carbonbased7 okay Im making a mental note of it
Fabian
@carbonbased7
Mar 03 2016 08:18 UTC
@mstettner in that both mean 'i is equal to i + 1'
Douglas Purdy
@dpurdy1113
Mar 03 2016 08:19 UTC
Honestly, it depends how much time you dedicate to it, I'd say if you pushed hard, you could be applying to jr / entry level developer positions in 8-12 monthes
Markus Kiili
@Masd925
Mar 03 2016 08:19 UTC
@mstettner i++ increments after returning the value and ++i before:
var i=0;
console.log(i++); // 0

i=0;
console.log(++i); // 1
kirbyedy
@kirbyedy
Mar 03 2016 08:19 UTC
@dpurdy1113 did you finish the fcc curriculum ?
Matthew Stettner
@mstettner
Mar 03 2016 08:20 UTC
@dpurdy1113 that would be very cool
Douglas Purdy
@dpurdy1113
Mar 03 2016 08:20 UTC
not yet, that's what I'm working on now ;)
Matthew Stettner
@mstettner
Mar 03 2016 08:20 UTC
@Masd925 trying to wrap my head around that...
@dpurdy1113 keep at it
kirbyedy
@kirbyedy
Mar 03 2016 08:21 UTC
@dpurdy1113 what are you working on at the moment ?
Douglas Purdy
@dpurdy1113
Mar 03 2016 08:22 UTC
I plan too ;) I'm uping it from a couple hours a day to at least 40 hours a week working on it
I'm a lowly customer service agent at a hotel :(
hence the need to career change :)
kirbyedy
@kirbyedy
Mar 03 2016 08:22 UTC
ok that, I meant in the fcc
change is always good, keep it up
Marina
@chandra90
Mar 03 2016 08:23 UTC
This message was deleted
Douglas Purdy
@dpurdy1113
Mar 03 2016 08:25 UTC
I'm working through the advanced algorithms right now, Symmetric Difference to be specific
Caleb Martin
@caleb272
Mar 03 2016 08:25 UTC
^ thats a fun one
Matthew Stettner
@mstettner
Mar 03 2016 08:26 UTC

what does this mean?

Create a variable myDecimal and give it a decimal value with a fractional part
e.g. 5.7

Caleb Martin
@caleb272
Mar 03 2016 08:26 UTC
var myDecimal = 5.7;
sorry va myDecimal = 5.7;
Matthew Stettner
@mstettner
Mar 03 2016 08:27 UTC
it still passed me jst using myDecimal = 5.7;
should I always have var
so like var myDecimal = 5.7?
Caleb Martin
@caleb272
Mar 03 2016 08:28 UTC
yes
its best too
Matthew Stettner
@mstettner
Mar 03 2016 08:28 UTC
var stands for variable? and myDecimal is the name of the variable?
Douglas Purdy
@dpurdy1113
Mar 03 2016 08:31 UTC
yes
and it's another one of those best practices and standards thing, to use var myDecimal =5.7
Matthew Stettner
@mstettner
Mar 03 2016 08:32 UTC
gotcha @dpurdy1113
Shipra Rawat
@rwt-shipra
Mar 03 2016 08:32 UTC
got Stuck plz anybody can help me ```

```function rot13(str) { // LBH QVQ VG!
var CeserStr="";
for(var i=0;i<=str.length;i++)
{
var digiStr = str.charCodeAt(i);
CeserStr += digiStr.fromCharCode(digiStr);

  }

return CeserStr;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
```


function rot13(str) { // LBH QVQ VG!
  var CeserStr="";
  for(var i=0;i<=str.length;i++)
      {
        var digiStr = str.charCodeAt(i);
        CeserStr += digiStr.fromCharCode(digiStr);

      }

  return CeserStr;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Markus Kiili
@Masd925
Mar 03 2016 08:33 UTC
@mstettner Without var you are creating a global variable seen on the whole script. With var it is seen on particular function.
Matthew Stettner
@mstettner
Mar 03 2016 08:34 UTC
@Masd925 okay so are there times when you dont use var. or do you always use var?
is it sometimes okay to create a global variable?
Shipra Rawat
@rwt-shipra
Mar 03 2016 08:36 UTC
need help in this
function rot13(str) { // LBH QVQ VG!
  var CeserStr="";
  for(var i=0;i<=str.length;i++)
      {
        var digiStr = str.charCodeAt(i);

        CeserStr += digiStr.fromCharCode( digiStr+13);

      }

  return CeserStr;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Markus Kiili
@Masd925
Mar 03 2016 08:37 UTC
@mstettner Some variables are needed in many places, so they are generated global. Usually you try to avoid them.
Matthew Stettner
@mstettner
Mar 03 2016 08:38 UTC
okay
why is code camp free?
Irina Sokolovskaja
@ierhyna
Mar 03 2016 08:43 UTC
wiki Sum All Odd Fibonacci Numbers
CamperBot
@camperbot
Mar 03 2016 08:43 UTC

:point_right: algorithm sum all odd fibonacci numbers [wiki]

Explanation:

You will need to gather all the Fibonacci numbers and then check for the odd ones. Once you get the odd ones then you will add them all. The last number should be the number given as a parameter if it actually happens to be an off Fibonacci number.

:pencil: read more about algorithm sum all odd fibonacci numbers on the FCC Wiki

kirbyedy
@kirbyedy
Mar 03 2016 08:44 UTC
@mstettner why not to be free ?
would you prefer paying 20k like for example on viking?
knowledge should be free, if you ask me, and its only up to you if you are going to learn it or not
Matthew Stettner
@mstettner
Mar 03 2016 08:45 UTC
@kirbyedy yes I believe this too. But what motivated someone to create this entire site for people to learn?
kirbyedy
@kirbyedy
Mar 03 2016 08:46 UTC
even if you pay, they will just guide you through the material they think you should know, but at the end of the day its up to you to understand it and use it in the real life
maybe the same idea
free knowledge for everyone
Quincy posted lots of articles, and if I remember well one of them said, that in the next 10 year, there will be a massive shortage in programmers
somehow that gap has to be filled
and not everyone is willing, or can afford the expensive education
me included
Matthew Stettner
@mstettner
Mar 03 2016 08:48 UTC
So basically, this being free is a must. It is benefitting everyone. Is there a major company like google behind this? where did they get the funding to build this site?
myVar += 5;
a = a + 12;
b = 9 + b;
c = c + 7;
You should use the += operator for each variable
what is wrong?
Coy Sanders
@coymeetsworld
Mar 03 2016 08:50 UTC
you're not using the += operator @mstettner :)
Matthew Stettner
@mstettner
Mar 03 2016 08:50 UTC
im not?
Coy Sanders
@coymeetsworld
Mar 03 2016 08:51 UTC
no you're just using +
you're using += for myVar
Matthew Stettner
@mstettner
Mar 03 2016 08:51 UTC
for a b and c?
Coy Sanders
@coymeetsworld
Mar 03 2016 08:51 UTC
myVar += 5
which without += would be
myVar = myVar + 5;
see how that conversion works?
kirbyedy
@kirbyedy
Mar 03 2016 08:51 UTC
@mstettner no google is behind the udacity I think
Matthew Stettner
@mstettner
Mar 03 2016 08:51 UTC
kind of
@kirbyedy is udacity better?
Coy Sanders
@coymeetsworld
Mar 03 2016 08:52 UTC
myVar += 5 means myVar now equals myVar plus 5
Matthew Stettner
@mstettner
Mar 03 2016 08:52 UTC
@coymeetsworld is this where the i++ comes in?
Coy Sanders
@coymeetsworld
Mar 03 2016 08:52 UTC
kindof
kirbyedy
@kirbyedy
Mar 03 2016 08:52 UTC
did not finished it, so I am not relevant to respond
Coy Sanders
@coymeetsworld
Mar 03 2016 08:52 UTC
i++ means increment i by one
kirbyedy
@kirbyedy
Mar 03 2016 08:53 UTC
their nanodegree has to be paid
Coy Sanders
@coymeetsworld
Mar 03 2016 08:53 UTC
you could alternatively do i+=1
but if you wanted to do 2, you wouldn't do i+++ or something like that
you would do i+=2
Matthew Stettner
@mstettner
Mar 03 2016 08:53 UTC
@coymeetsworld this is algebra
okay
Coy Sanders
@coymeetsworld
Mar 03 2016 08:53 UTC
yeah but the syntax isn't algebra like here lol, before it was
doing i+=2 instead of i = i+2 just makes it cleaner
Matthew Stettner
@mstettner
Mar 03 2016 08:54 UTC
@coymeetsworld i hope to one day understant this like you do
Coy Sanders
@coymeetsworld
Mar 03 2016 08:54 UTC
you only have to reference the i variable once
Matthew Stettner
@mstettner
Mar 03 2016 08:54 UTC
yes
Coy Sanders
@coymeetsworld
Mar 03 2016 08:54 UTC
it may not look like much there, but if you have longer variables its noticeable
kirbyedy
@kirbyedy
Mar 03 2016 08:54 UTC
I am also going through this course and its helping me a lot: udemy javascript understanding the weird parts
Coy Sanders
@coymeetsworld
Mar 03 2016 08:54 UTC
think of it kind of as making your sentences more succinct
Matthew Stettner
@mstettner
Mar 03 2016 08:54 UTC
@kirbyedy ill check it out
Coy Sanders
@coymeetsworld
Mar 03 2016 08:54 UTC
@mstettner just takes practice :)
kirbyedy
@kirbyedy
Mar 03 2016 08:54 UTC
look for coupon codes, it will be like 10$
Coy Sanders
@coymeetsworld
Mar 03 2016 08:54 UTC
just like anything else
kirbyedy
@kirbyedy
Mar 03 2016 08:54 UTC
well worth it
Matthew Stettner
@mstettner
Mar 03 2016 08:55 UTC
@coymeetsworld so what I am missing from waht I did
kirbyedy
@kirbyedy
Mar 03 2016 08:55 UTC
and explains this things that you are stuck on
Matthew Stettner
@mstettner
Mar 03 2016 08:55 UTC
myVar += 5;
a = a + 12;
b = 9 + b;
c = c + 7;
Coy Sanders
@coymeetsworld
Mar 03 2016 08:55 UTC
@mstettner they want you to essentially reword how you're reassigning the variables a b and c
Matthew Stettner
@mstettner
Mar 03 2016 08:55 UTC
@coymeetsworld
Coy Sanders
@coymeetsworld
Mar 03 2016 08:55 UTC
logically, all of those will do what the challenge is asking
they're just asking you to write it differently
Matthew Stettner
@mstettner
Mar 03 2016 08:56 UTC
so i need to make chages to tis?
a = a + 12;
b = 9 + b;
c = c + 7;
Coy Sanders
@coymeetsworld
Mar 03 2016 08:56 UTC
correct
using += together
Matthew Stettner
@mstettner
Mar 03 2016 08:56 UTC
i tried doing this
a += a + 12;
b += 9 + b;
c += c + 7;
i thought that maybe that what i was uspposed to do
Coy Sanders
@coymeetsworld
Mar 03 2016 08:56 UTC
partially
Matthew Stettner
@mstettner
Mar 03 2016 08:57 UTC
okay how about this
Coy Sanders
@coymeetsworld
Mar 03 2016 08:57 UTC
what you're saying there is a is equal to a + a + 12
but you don't want that
Matthew Stettner
@mstettner
Mar 03 2016 08:57 UTC
a = a + 12;
b = 9 + b;
c = c + 7;
my head is spinning
Coy Sanders
@coymeetsworld
Mar 03 2016 08:57 UTC
actually a better way to say it is you are saying a is equal to itself plus a plus 12
ok well you were on the right track before
a += a + 12;
here give me a second
Matthew Stettner
@mstettner
Mar 03 2016 08:58 UTC
a += a += 12;
b += 9 + b;
c += c + 7;
??
hahahaha yeah i dunno what I am doing
Coy Sanders
@coymeetsworld
Mar 03 2016 08:59 UTC
var a = 5;
console.log("a=" + a);
console.log("a += a + 12");
a += a + 12;
console.log("now a=" + a);
var a = 5;
console.log("a=" + a);
console.log("a += a + 12");
a += a + 12;
console.log("now a=" + a);

this would output

a=5
a += a + 12
now a=22

Matthew Stettner
@mstettner
Mar 03 2016 09:00 UTC
how does a=22
?
Coy Sanders
@coymeetsworld
Mar 03 2016 09:01 UTC
think about it
Matthew Stettner
@mstettner
Mar 03 2016 09:01 UTC
i see
5=5=12
ooop
5+5+12
Coy Sanders
@coymeetsworld
Mar 03 2016 09:01 UTC
basically, you're saying 5 is now equal to 5 + 5 + 12 yeah
what you want to say is 5 is now equal to 5 + 12
5 being the value for variable a here
Matthew Stettner
@mstettner
Mar 03 2016 09:02 UTC
why do I want just 5+12?
Coy Sanders
@coymeetsworld
Mar 03 2016 09:03 UTC
because that's what its telling you
Matthew Stettner
@mstettner
Mar 03 2016 09:03 UTC
oh okay i see
yeah I just looked back
Coy Sanders
@coymeetsworld
Mar 03 2016 09:03 UTC
a = a + 12 right? a = 5
Matthew Stettner
@mstettner
Mar 03 2016 09:03 UTC
yes
Coy Sanders
@coymeetsworld
Mar 03 2016 09:03 UTC
5 = 5 + 12, the number doesn't change just how you express it
if it helps
you still use one + and one = symbol in your new solution
Matthew Stettner
@mstettner
Mar 03 2016 09:04 UTC
so Im still confused onhow it wants me to change it
Coy Sanders
@coymeetsworld
Mar 03 2016 09:04 UTC
you just have to put them together and remove one of the variable's a
Matthew Stettner
@mstettner
Mar 03 2016 09:04 UTC
myVar += 5;
a = a + 12;
b = 9 + b;
c = c + 7;
okay let me think
Coy Sanders
@coymeetsworld
Mar 03 2016 09:05 UTC
so a += ?
Matthew Stettner
@mstettner
Mar 03 2016 09:05 UTC
22
?
Coy Sanders
@coymeetsworld
Mar 03 2016 09:06 UTC
well the way you wrote it, if a=5 a += a + 12 yeah its 22
but you want it to be 17
Matthew Stettner
@mstettner
Mar 03 2016 09:06 UTC
okay
Coy Sanders
@coymeetsworld
Mar 03 2016 09:06 UTC
idk maybe im not explaining it better lol, haven't really taught anyone programming so maybe there's a better way to explain it
Matthew Stettner
@mstettner
Mar 03 2016 09:06 UTC
i want it to be 17 but right now its 12?
so a = 5
?
Coy Sanders
@coymeetsworld
Mar 03 2016 09:07 UTC
yeah
Matthew Stettner
@mstettner
Mar 03 2016 09:07 UTC
myVar += 5;
a = a + 12;
b = 9 + b;
c = c + 7;
so then what does b =
Coy Sanders
@coymeetsworld
Mar 03 2016 09:08 UTC
here maybe just referring to this will help: http://www.w3schools.com/js/js_operators.asp
go down to JavaScript Assignment Operators
maybe im just overcomplicating it
basically using += makes you write less code and do the same thing logically
alpox
@alpox
Mar 03 2016 09:09 UTC
@mstettner b = 9 + b;is not valid here since b is not yet defined
Matthew Stettner
@mstettner
Mar 03 2016 09:09 UTC
let me check the link out.
Coy Sanders
@coymeetsworld
Mar 03 2016 09:09 UTC
no that's not the issue @alpox
alpox
@alpox
Mar 03 2016 09:10 UTC
@coymeetsworld He asked what b = does in that code so i answered :D
Coy Sanders
@coymeetsworld
Mar 03 2016 09:10 UTC
well in that code in a vacuum yes @alpox
but b is assigned something
in the challenge
alpox
@alpox
Mar 03 2016 09:11 UTC
@coymeetsworld Sry didn't know that there is more, i just came in ;-)
Coy Sanders
@coymeetsworld
Mar 03 2016 09:11 UTC
yeah no i understand where you're coming from :)
normally yeah you're right
Matthew Stettner
@mstettner
Mar 03 2016 09:11 UTC
okay Im looking at assignment operators and wow. Yeah I'd have to study that all day to wrap my head around it
Coy Sanders
@coymeetsworld
Mar 03 2016 09:11 UTC
no it's simple, its just shorthand
Operator Example Same As
= x = y x = y
+= x += y x = x +
Matthew Stettner
@mstettner
Mar 03 2016 09:11 UTC
myVar += 5;
a = a + 12;
b = 9 + b;
c = c + 7;
Coy Sanders
@coymeetsworld
Mar 03 2016 09:12 UTC
oh that didn't format the way i wanted it to
Matthew Stettner
@mstettner
Mar 03 2016 09:12 UTC
so i do need to change some +
Coy Sanders
@coymeetsworld
Mar 03 2016 09:12 UTC
basically
Matthew Stettner
@mstettner
Mar 03 2016 09:12 UTC
and =
Coy Sanders
@coymeetsworld
Mar 03 2016 09:12 UTC
x = x+y is the same as x += y
the second way to do it is more preferable, because its less code you have to write and thus cleaner
Matthew Stettner
@mstettner
Mar 03 2016 09:12 UTC
hahaha wow whyis this so hard to wrap my head around
Coy Sanders
@coymeetsworld
Mar 03 2016 09:12 UTC
you only have to mention the variable x once
Matthew Stettner
@mstettner
Mar 03 2016 09:13 UTC
oh i see
alpox
@alpox
Mar 03 2016 09:13 UTC
@mstettner Just think of that the left handside gets increased by the value of the right handside of the +=operator
Coy Sanders
@coymeetsworld
Mar 03 2016 09:13 UTC
x = x+y is same as x += y
so
a = a+12 is the same as...
Matthew Stettner
@mstettner
Mar 03 2016 09:14 UTC
my computer is freaking out one sec
Im was lagging
im back
a+=12?
@coymeetsworld
Coy Sanders
@coymeetsworld
Mar 03 2016 09:15 UTC
try it :)
Matthew Stettner
@mstettner
Mar 03 2016 09:16 UTC
what about this one?
b = 9 + b;
myVar += 5;
a += 12;
b = 9 + b;
c += 7;
Coy Sanders
@coymeetsworld
Mar 03 2016 09:17 UTC
same idea
do what you did with a
and myVar
and c
remember this is like math, order of operations and all that
Matthew Stettner
@mstettner
Mar 03 2016 09:18 UTC
YEAH
Coy Sanders
@coymeetsworld
Mar 03 2016 09:18 UTC
b = 9 + b is the same as b = b + 9
associative principle? something like that? idk been like 15 years since i did algebra lol
Matthew Stettner
@mstettner
Mar 03 2016 09:18 UTC
ME TOO
sorry didnt mean to caps
myVar += 5;
a += 12;
b = b + 9;
c += 7;
I dunno thats what I though was correct
Coy Sanders
@coymeetsworld
Mar 03 2016 09:21 UTC
well you changed a and c
you didn't change b
i was only pointing out b = b + 9 so that you would do similar change with a = a + 12
maybe you were confused when it was written as b = 9 + b, but that order doesn't matter
Matthew Stettner
@mstettner
Mar 03 2016 09:23 UTC
is anything about this correct?
myVar += 5;
a += 12;
b = b + 9;
c += 7;
Coy Sanders
@coymeetsworld
Mar 03 2016 09:23 UTC
myVar, a and c are all right
Matthew Stettner
@mstettner
Mar 03 2016 09:23 UTC
okay but b is incorrect?
Coy Sanders
@coymeetsworld
Mar 03 2016 09:23 UTC
remember what I said before?
x = x+y is same as x += ?
yes b is wrong in the way they want you to write it
Matthew Stettner
@mstettner
Mar 03 2016 09:24 UTC
b += 9; i tried this
Coy Sanders
@coymeetsworld
Mar 03 2016 09:24 UTC
yeah that's right
didn't work?
Matthew Stettner
@mstettner
Mar 03 2016 09:24 UTC
nope
Coy Sanders
@coymeetsworld
Mar 03 2016 09:24 UTC
hmm what is the challenge?
Matthew Stettner
@mstettner
Mar 03 2016 09:24 UTC
it say myvar is not defined
Assignment with Plus Equals
Coy Sanders
@coymeetsworld
Mar 03 2016 09:25 UTC
oh just remove the myVar line
its not needed
or alternatively i guess you could declare myVar
no wait, nevermind that last part
Matthew Stettner
@mstettner
Mar 03 2016 09:25 UTC
wait why is it not needed?
Coy Sanders
@coymeetsworld
Mar 03 2016 09:25 UTC
just remove the line
myVar was just an example
Matthew Stettner
@mstettner
Mar 03 2016 09:26 UTC
@coymeetsworld thanks thanks thanks
CamperBot
@camperbot
Mar 03 2016 09:26 UTC
mstettner sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star: 327 | @coymeetsworld | http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Mar 03 2016 09:26 UTC
explaining to you how the += works
slygordon
@slygordon
Mar 03 2016 09:26 UTC
I am completely stuck on how to convert celsius to fahrenheit...
Coy Sanders
@coymeetsworld
Mar 03 2016 09:26 UTC
if you look at the tests it doesn't specify you need to do anything with a variable named myVar
Matthew Stettner
@mstettner
Mar 03 2016 09:26 UTC
@coymeetsworld this is true
Coy Sanders
@coymeetsworld
Mar 03 2016 09:26 UTC
°C x 9/5 + 32 = °F. @slygordon
may need to use Math.round functions to format the numbers
slygordon
@slygordon
Mar 03 2016 09:27 UTC
ahh ok
thanks
Matthew Stettner
@mstettner
Mar 03 2016 09:28 UTC
oh man i gotta do more of this
Coy Sanders
@coymeetsworld
Mar 03 2016 09:28 UTC
np
Matthew Stettner
@mstettner
Mar 03 2016 09:28 UTC
a = a - 6;
b = b - 15;
c = c - 1;
Coy Sanders
@coymeetsworld
Mar 03 2016 09:28 UTC
same idea @mstettner
instead of += you're using -= instead, and then later /= and *=
look at that webpage i sent you
Matthew Stettner
@mstettner
Mar 03 2016 09:28 UTC
okay
Coy Sanders
@coymeetsworld
Mar 03 2016 09:29 UTC
specifically JavaScript Assignment Operators
ill be back in a bit
Matthew Stettner
@mstettner
Mar 03 2016 09:31 UTC
holy crap i looked at the assignment operaters and passed the test
thanks @coymeetsworld
CamperBot
@camperbot
Mar 03 2016 09:31 UTC
mstettner sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:warning: mstettner already gave coymeetsworld points
Arvilyn Ong
@arvilyn
Mar 03 2016 09:32 UTC
i need help with "Storing Values with the Equal Operator" assignment!!!
Finesse Rucker
@Finesse315
Mar 03 2016 09:37 UTC
@arvilyn link
?
Aleksander Gębicki
@Takumar
Mar 03 2016 09:38 UTC
@arvilyn describe what is your problem with that exercise.
Don
@theliveseven
Mar 03 2016 09:46 UTC
hello people, i need some help with palindrome problem
Coy Sanders
@coymeetsworld
Mar 03 2016 09:49 UTC
gj @mstettner
Markus Török
@MarkusToe
Mar 03 2016 09:57 UTC
hello everyone, I am currently trying to solve Validate US Telephone Numbers
Matthew Stettner
@mstettner
Mar 03 2016 09:57 UTC
thx @coymeetsworld
CamperBot
@camperbot
Mar 03 2016 09:57 UTC
mstettner sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:warning: mstettner already gave coymeetsworld points
Matthew Stettner
@mstettner
Mar 03 2016 09:57 UTC
thanks @coymeetsworld
CamperBot
@camperbot
Mar 03 2016 09:57 UTC
mstettner sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:warning: mstettner already gave coymeetsworld points
Markus Török
@MarkusToe
Mar 03 2016 09:57 UTC
could some one (probably an american) tell me why this 27576227382 isn’t a US phone number?
Matthew Stettner
@mstettner
Mar 03 2016 09:58 UTC
why didnt it give you brownie pts lol
oh there it goes
too long?
yea its too long
Markus Török
@MarkusToe
Mar 03 2016 09:59 UTC
ok, so phone numbers are at most 11 digits long?
Abhishek Kumar
@abhishekKumar1
Mar 03 2016 09:59 UTC
@MarkusToe my guess i think because it 11 digits
Matthew Stettner
@mstettner
Mar 03 2016 09:59 UTC
10