These are chat archives for FreeCodeCamp/HelpJavaScript

6th
Apr 2016
Jackson Bates
@JacksonBates
Apr 06 2016 00:00 UTC
@chris542 type three backticks ` (under the ESC key, if you have the same kbd layout as me), then press shift+Enter to start a new line without sending. Paste your code, press shift+enter again, then three more backticks
Chris Kang
@chris542
Apr 06 2016 00:00 UTC
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line

  var lookup = {
    "alpha":"Adams",
    "bravo":"Boston",
    "charlie":"Chicago",
    "delta":"Denver",
    "echo":"Easy",
    "foxtrot":"Frank",
    "":undefined
  };


  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("charlie");
sweeeet
@JacksonBates It says to 'look up val and assign the associated string to the result variable'. but the example it shows isn't clear what i'm supposed to do
Jackson Bates
@JacksonBates
Apr 06 2016 00:03 UTC
@chris542 ok, well at the moment, your program is going to return an empty string, because you haven't changed it based on the lookup value. So change 'result' to something more meaningful
Chris Kang
@chris542
Apr 06 2016 00:04 UTC
something like lookup.value?
Jackson Bates
@JacksonBates
Apr 06 2016 00:04 UTC
@chris542 something like that...
Chris Kang
@chris542
Apr 06 2016 00:04 UTC
@chris542 lets just say i changed it to 'lastname'
// Setup
function phoneticLookup(val) {
  var lastName = "";

  // Only change code below this line

  var lookup = {
    "alpha":"Adams",
    "bravo":"Boston",
    "charlie":"Chicago",
    "delta":"Denver",
    "echo":"Easy",
    "foxtrot":"Frank",
    "":undefined
  };


  // Only change code above this line
  return lastName;
}

// Change this value to test
phoneticLookup("charlie");
Jackson Bates
@JacksonBates
Apr 06 2016 00:05 UTC
@chris542 you have the same problem, since lastName is still an empty string
Chris Kang
@chris542
Apr 06 2016 00:06 UTC
@JacksonBates ... I'm lost...
Jackson Bates
@JacksonBates
Apr 06 2016 00:06 UTC
@chris542 you also changed code outside of the area suggested, which you don't need to do
@chris542 So you want the user to run the function phoneticLookup(), and pass the value they want to lookup into it...
Chris Kang
@chris542
Apr 06 2016 00:07 UTC
@JacksonBates yes. i got that
Jackson Bates
@JacksonBates
Apr 06 2016 00:07 UTC
@chris542 like phoneticLookup("charlie") in the test.
Chris Kang
@chris542
Apr 06 2016 00:08 UTC
@JacksonBates i'm confused how I'm supposed to let 'val' link upto the key value on 'var lookup'
Jackson Bates
@JacksonBates
Apr 06 2016 00:08 UTC
@chris542 if we look at the function we see it takes the arguement (val), which will be something we can use
@chris542 with objects like these we can use a value to lookup it's key using dot notation or bracket notation
Chris Kang
@chris542
Apr 06 2016 00:09 UTC

@JacksonBates should I say

val = lookup.key

Jackson Bates
@JacksonBates
Apr 06 2016 00:09 UTC
@chris542 so when you said: something like lookup.value? you were pretty close
Kamarudeen Ayankunbi
@kevone123
Apr 06 2016 00:10 UTC
For the Celsius to Fahrenheit problem when it says to create a variable,does the problem want me to create my own variable or a function called Fahrenheit like it does with Celsius?
Jackson Bates
@JacksonBates
Apr 06 2016 00:10 UTC
@chris542 not quite. If you return the variable 'result' you want to change that variable from an empty string to the the key
Chris Kang
@chris542
Apr 06 2016 00:11 UTC
@JacksonBates so.... result = lookup.value?
Jackson Bates
@JacksonBates
Apr 06 2016 00:11 UTC
@chris542 almost - but value isn't defined anywhere. 'val' is the thing that got passed in, not 'value'
Jeff
@Jeffgl77
Apr 06 2016 00:11 UTC
Invert Regular Expression Matches with JavaScript
You can invert any match by using the uppercase version of the regular expression selector.

For example, \s will match any whitespace, and \S will match anything that isn't whitespace.

Instructions
Use /\S/g to count the number of non-whitespace characters in testString.

Run tests (ctrl + enter)
Reset    Help    Bug

9

Your regular expression should find forty nine non-space characters in the testString.
Use the /\S/g regular expression to find non-space characters in testString.


1
// Setup
2
var testString = "How many non-space characters are there in this sentence?";
3
​
4
// Only change code below this line.
56
var expression = /\S+/g;  // Change this line
78
// Only change code above this line
910
// This code counts the matches of expression in testString
11
var nonSpaceCount = testString.match(expression).length;
12
​
so... according to this, what I have should be correct
is this a bug or am I missing something?
Chris Kang
@chris542
Apr 06 2016 00:13 UTC
@JacksonBates so....
val = lookup.key
result = val?
@JacksonBates my brain is dying man
Jackson Bates
@JacksonBates
Apr 06 2016 00:14 UTC
@chris542 haha, happens to us all. result = lookup.val should do it
@chris542 just remember to change your variable at the top back to result instead of lastName
Chris Kang
@chris542
Apr 06 2016 00:14 UTC
@JacksonBates is SOMETHING.key / SOMETHING.val way to access the lookup object?
// Setup
function phoneticLookup(val) {
  var result = "";

  // Only change code below this line

  var lookup = {
    "alpha":"Adams",
    "bravo":"Boston",
    "charlie":"Chicago",
    "delta":"Denver",
    "echo":"Easy",
    "foxtrot":"Frank",
    "":undefined
  };

  result = lookup.val;

  // Only change code above this line
  return result;
}

// Change this value to test
phoneticLookup("charlie");
@JacksonBates still not working :(
@JacksonBates maybe changing the top ``
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:16 UTC
Can somebody tell me why my "Testing Objects for Properties" code only returns "pony"?
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj() { // Your Code Here 
  if (myObj.hasOwnProperty("gift")) { 
    return "pony";
  } 
  else if (myObj.hasOwnProperty("pet")) {
    return "kitten";
} 
  else { 
  return "Not Found";
       } 
}

// Test your code by modifying these values
checkObj("pet");
Chris Kang
@chris542
Apr 06 2016 00:16 UTC
top var result = "" to result = lookup.val?
Jackson Bates
@JacksonBates
Apr 06 2016 00:16 UTC
@chris542 that is identical to my code, which passes, except mine doesn't have "":undefined in it
buonarfcc
@buonarfcc
Apr 06 2016 00:17 UTC

Any one could help? var result = "";

// Only change code below this line
var lookup = {
1: result = "Adams",
2: result = "Boston",
3: result = "Chicago",
4: result = "Denver",
5: result = "Easy",
6: result = "Frank"
};

// Only change code above this line

// Change this value to test
var value = "charlie";
lookup(value); TypeError: lookup is not a function????

Chris Kang
@chris542
Apr 06 2016 00:17 UTC
@JacksonBates I just deleted "":undefined, but the page doesn't approve :(
llamatarianism
@llamatarianism
Apr 06 2016 00:17 UTC
@buonarfcc that's because lookup isn't a function, it's an object.
Jackson Bates
@JacksonBates
Apr 06 2016 00:17 UTC
@buonarfcc @chris542 and I are talking about that right now...scroll up :)
Jeff
@Jeffgl77
Apr 06 2016 00:17 UTC
@TheAmazingKarla because all three of your ifs are true, therefore it is stopping after the first true return
Chris Kang
@chris542
Apr 06 2016 00:18 UTC
@buonarfcc i'm on the same page bro. haha
llamatarianism
@llamatarianism
Apr 06 2016 00:18 UTC
can someone help me with arguments optional (intermediate algorithm scripting)?
function addTogether() {
  var args = Array.prototype.slice.call(arguments);
  if (typeof args[0] !== "number" || typeof args[1] !== "number") {
    return undefined;
  } else if (args.length === 1) {
    return function() {
      if (typeof args[0] !== "number" || typeof arguments[0] !== "number") {
        return undefined;
      }
      return args[0] + arguments[0];
    };
  } else {
    return args[0] + args[1];
  }
}

addTogether(2)(3);
I'm getting TypeError: addTogether(...) is not a function
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:18 UTC
Not sure what to do about that
Jackson Bates
@JacksonBates
Apr 06 2016 00:18 UTC
@chris542 try lookup[val]
Chris Kang
@chris542
Apr 06 2016 00:18 UTC
@JacksonBates
```
Jackson Bates
@JacksonBates
Apr 06 2016 00:18 UTC
instead of lookup.val
Chris Kang
@chris542
Apr 06 2016 00:19 UTC
@JacksonBates OH THERE WE GO
Jackson Bates
@JacksonBates
Apr 06 2016 00:19 UTC
just realised I used bracket notation instead
Jeff
@Jeffgl77
Apr 06 2016 00:19 UTC
@llamatarianism look at how the actual function is defined.. the first line and then compare it to how you are calling it
Chris Kang
@chris542
Apr 06 2016 00:19 UTC
@JacksonBates i guess it's because it takes it as an array..?
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:19 UTC
When I type in pet or house, shouldn't that change?
Chris Kang
@chris542
Apr 06 2016 00:19 UTC
@JacksonBates thanks man!! I came to this challenge without getting stuck at all, and this one, I couldn't have found it out myself without you :D!! Woop
CamperBot
@camperbot
Apr 06 2016 00:19 UTC
chris542 sends brownie points to @jacksonbates :sparkles: :thumbsup: :sparkles:
:star: 284 | @jacksonbates | http://www.freecodecamp.com/jacksonbates
Jeff
@Jeffgl77
Apr 06 2016 00:20 UTC
if your first 'if' returns true for everything you throw at it, then no
llamatarianism
@llamatarianism
Apr 06 2016 00:20 UTC
@Jeffgl77 that's how the arguments were laid out when I first started the challenge
Jeff
@Jeffgl77
Apr 06 2016 00:20 UTC
@TheAmazingKarla my last comment was for you
Chris Kang
@chris542
Apr 06 2016 00:20 UTC
@JacksonBates one last question. How do you do that thing that shows only a block of coding on a chat?
Jackson Bates
@JacksonBates
Apr 06 2016 00:20 UTC
@chris542 No worries - I was the same...sailed through it all until I hit objects.
llamatarianism
@llamatarianism
Apr 06 2016 00:20 UTC
@Jeffgl77 not sure how I'd even set them out to account for addTogether(2)(3)
I've literally never seen a function that looks like that
Jackson Bates
@JacksonBates
Apr 06 2016 00:21 UTC
@chris542 I think I still don't quite get how to use dot notation properly, so I better review that
Jeff
@Jeffgl77
Apr 06 2016 00:21 UTC
@llamatarianism look at the '(', ')'
llamatarianism
@llamatarianism
Apr 06 2016 00:21 UTC
@Jeffgl77 not sure what you mean
wait I think I might.
Jeff
@Jeffgl77
Apr 06 2016 00:22 UTC
@llamatarianism see how the function is defined? it only has '()' not "()()"
Chris Kang
@chris542
Apr 06 2016 00:22 UTC
@JacksonBates Thanks for the help :) I guess this is how i do it
CamperBot
@camperbot
Apr 06 2016 00:22 UTC
chris542 sends brownie points to @jacksonbates :sparkles: :thumbsup: :sparkles:
:warning: chris542 already gave jacksonbates points
llamatarianism
@llamatarianism
Apr 06 2016 00:22 UTC
@Jeffgl77 did you actually click the link https://www.freecodecamp.com/challenges/arguments-optional
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:22 UTC
I get what you're saying, @Jeffgl77 , but I'm scratching my head about what to do about it.
Jeff
@Jeffgl77
Apr 06 2016 00:22 UTC
in the link, you are passing multiple variables
the function takes multiple vars
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:23 UTC
I tried putting parameters in the checkObj function, but that didn't work
Jeff
@Jeffgl77
Apr 06 2016 00:24 UTC
@TheAmazingKarla you have to rework the logic of your if statements
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:24 UTC
Hmmm...
Jeff
@Jeffgl77
Apr 06 2016 00:25 UTC
@TheAmazingKarla instead of comparing to something that always be true, compare to something that can go either way
that way there is an option to either pass , or fail and continue to the next test
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:26 UTC
O-ka-a-ay...
Jackson Bates
@JacksonBates
Apr 06 2016 00:26 UTC
@TheAmazingKarla if (myObj.hasOwnProperty("gift")) { return "pony"; is true, and always will be with that object, so it will always return pony and stop running the rest
Jeff
@Jeffgl77
Apr 06 2016 00:26 UTC
@llamatarianism did you figure out the problem with your function?
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:26 UTC
Got that, @JacksonBates , just don't know what to do about it
Jeff
@Jeffgl77
Apr 06 2016 00:27 UTC
try adding && and a new comparison
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:27 UTC
Thanks, @Jeffgl77 - I'll give that a try.
CamperBot
@camperbot
Apr 06 2016 00:27 UTC
theamazingkarla sends brownie points to @jeffgl77 :sparkles: :thumbsup: :sparkles:
:star: 238 | @jeffgl77 | http://www.freecodecamp.com/jeffgl77
Jeff
@Jeffgl77
Apr 06 2016 00:29 UTC
asking again if this a bug or am I missing something
// Setup
var testString = "How many non-space characters are there in this sentence?";

// Only change code below this line.

var expression = /\S+/g;  // Change this line

// Only change code above this line

// This code counts the matches of expression in testString
var nonSpaceCount = testString.match(expression).length;
im supposed to be getting the non-whitespace characters
Jackson Bates
@JacksonBates
Apr 06 2016 00:30 UTC
@TheAmazingKarla also, did you delete something from the function checkObj() line? Mine looks different, but not sure if that's beacuse I added something, or you deleted it...
Jeff
@Jeffgl77
Apr 06 2016 00:30 UTC
ha, i got it... it was mostly correct
llamatarianism
@llamatarianism
Apr 06 2016 00:32 UTC
@Jeffgl77 yeah I got it
Jeff
@Jeffgl77
Apr 06 2016 00:32 UTC
great
Jackson Bates
@JacksonBates
Apr 06 2016 00:34 UTC
@TheAmazingKarla I just double checked, the original function looks like this: function checkObj(checkProp)...that checkProp is useful
PHPman
@dmitrikonnikov
Apr 06 2016 00:37 UTC
can soemone help me with the word blanks exercise in js
Jackson Bates
@JacksonBates
Apr 06 2016 00:38 UTC
@TheAmazingKarla last thing...you don't need && and more comparisons...
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:38 UTC
hi! want help

function queue(arr, item) {
item=testArr.push(item);
item=testArr.shift(item);
return item;
}

// 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));

queue([5,6,7,8,9], 1) should return 5
//this guy is not working queue([5,6,7,8,9], 1) should return 5
Jeff
@Jeffgl77
Apr 06 2016 00:40 UTC
you have to push the item onto the arr, then shift the first element of the arr off
you are currently assigning the arr to the item being passed into the function
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:41 UTC
more easy way please
Coy Sanders
@coymeetsworld
Apr 06 2016 00:42 UTC
the problem is you're using testArr in your queue function @printdhruv , but you should be using arr
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:42 UTC
@JacksonBates Yes, I deleted the checkProp, but I just put it back in. Still doesn't work
Coy Sanders
@coymeetsworld
Apr 06 2016 00:42 UTC
your second queue command returned 2 right?
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:43 UTC
I could get different answers with && and comparisons, but only one at a time. definitely not the solution
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:43 UTC
@coymeetsworld no
@coymeetsworld i am not getting any of you
Coy Sanders
@coymeetsworld
Apr 06 2016 00:43 UTC
function queue(arr, item) {
item=testArr.push(item);
item=testArr.shift(item);
return item;
}
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:44 UTC
thats what i wrote
Coy Sanders
@coymeetsworld
Apr 06 2016 00:44 UTC
you're referencing testArr in your function, but it should be arr, the name of the argument of the queue function
Eric Murta
@murtinha
Apr 06 2016 00:44 UTC
Guys on "Everything be true" challenge, am I supposed to list the predicates?
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:44 UTC
@coymeetsworld haha
Coy Sanders
@coymeetsworld
Apr 06 2016 00:44 UTC
:)
Jackson Bates
@JacksonBates
Apr 06 2016 00:45 UTC
@TheAmazingKarla what does your code look like at the moment? re-paste
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:45 UTC
@coymeetsworld parameter name was wrong.thanks
CamperBot
@camperbot
Apr 06 2016 00:45 UTC
printdhruv sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star: 472 | @coymeetsworld | http://www.freecodecamp.com/coymeetsworld
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:45 UTC
To me it looks just like the example, but something's not right.
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) { // Your Code Here 
  if (myObj.hasOwnProperty("gift")) { 
    return "pony";
  } 
  else if (myObj.hasOwnProperty("pet")) {
    return "kitten";
} 
  else { 
  return "Not Found";
       } 
}

// Test your code by modifying these values
checkObj("pet");
Coy Sanders
@coymeetsworld
Apr 06 2016 00:45 UTC
yup, and you didn't get an error because you have that variable defined @printdhruv
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:46 UTC
@coymeetsworld well! machines are so kind to run even logical error without yelling
Jackson Bates
@JacksonBates
Apr 06 2016 00:46 UTC
@TheAmazingKarla ok, myObj.hasOwnProperty("gift") will always return true, since the obj has a 'gift' in it
Jeff
@Jeffgl77
Apr 06 2016 00:46 UTC
@TheAmazingKarla now that I have looked at your code closer, you only need an if / else statement, not an if / else if statement
Coy Sanders
@coymeetsworld
Apr 06 2016 00:46 UTC
a little too kind sometimes @printdhruv :)
Jackson Bates
@JacksonBates
Apr 06 2016 00:46 UTC
@TheAmazingKarla so try passing something other than 'gift' in, which may not always be true
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:46 UTC
@coymeetsworld haha.i am master student in ms . sometimes it helps
Jackson Bates
@JacksonBates
Apr 06 2016 00:47 UTC
@TheAmazingKarla think about what variables you have at your disposal to play with
Coy Sanders
@coymeetsworld
Apr 06 2016 00:47 UTC
ms?
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:47 UTC
master in computer science in sanjose
Jeff
@Jeffgl77
Apr 06 2016 00:47 UTC
@TheAmazingKarla a function that has a parameter, you use that parameter for comparison.. at least for this
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:47 UTC
@JacksonBates everything returns "pony". I typed in "smurf" and got pony.
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:48 UTC
@coymeetsworld will also go to stanford for this summer 2016.
Coy Sanders
@coymeetsworld
Apr 06 2016 00:48 UTC
ah ok nice, Bachelors in Computer Eng
for me
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:48 UTC
@coymeetsworld nice
Coy Sanders
@coymeetsworld
Apr 06 2016 00:48 UTC
going to Stanford for what?
transfer?
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:48 UTC
@coymeetsworld no.only for 1 sem.
@coymeetsworld they call it stanford summer session
Coy Sanders
@coymeetsworld
Apr 06 2016 00:49 UTC
still can tell people you went to Stanford lol
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:49 UTC
@coymeetsworld ya
Jackson Bates
@JacksonBates
Apr 06 2016 00:49 UTC
@TheAmazingKarla where did you type smurf? in the final checkObj("smurf") at the end?
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:49 UTC
yes
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:49 UTC
@coymeetsworld well! even its admission are tight
Jackson Bates
@JacksonBates
Apr 06 2016 00:50 UTC
@TheAmazingKarla ok, so in that case smurf is the value you are passing to the variable checkProp...what does your program actually do with that variable checkProp at the moment?
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:51 UTC
check in myObj for that property?
Jackson Bates
@JacksonBates
Apr 06 2016 00:52 UTC
@TheAmazingKarla which line in your function tells it to do that?
Coy Sanders
@coymeetsworld
Apr 06 2016 00:52 UTC
i would imagine @printdhruv
Jackson Bates
@JacksonBates
Apr 06 2016 00:52 UTC
@TheAmazingKarla you don't mention checkProp in your function
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:52 UTC
the if?
Coy Sanders
@coymeetsworld
Apr 06 2016 00:52 UTC
gets worse every year
Eric Murta
@murtinha
Apr 06 2016 00:53 UTC
Guys on "Everything be true" challenge, am I supposed to list the predicates?
Jackson Bates
@JacksonBates
Apr 06 2016 00:53 UTC
@TheAmazingKarla the if statements are testing hard coded strings that don't change, not the variable chackProp
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:53 UTC
So I need to give that variable a value?
Jackson Bates
@JacksonBates
Apr 06 2016 00:53 UTC
@TheAmazingKarla the variable checkProp will be changed to whatever people put in the parenthesis after checkObj,
@TheAmazingKarla the variable has a value, you just need to use the variable somewhere in the function
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:55 UTC
@coymeetsworld what u do>
Jackson Bates
@JacksonBates
Apr 06 2016 00:55 UTC
@TheAmazingKarla think about the difference between these: (myObj.hasOwnProperty("gift")) and (myObj.hasOwnProperty(checkProp)) What would each one do in your function?
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:55 UTC
Trying something - brb
Coy Sanders
@coymeetsworld
Apr 06 2016 00:56 UTC
I work as a Linux Admin for HP
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:56 UTC
@coymeetsworld great
Coy Sanders
@coymeetsworld
Apr 06 2016 00:56 UTC
manage idk 20k something servers for cloud environments
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:56 UTC
@coymeetsworld any job for me!
Coy Sanders
@coymeetsworld
Apr 06 2016 00:56 UTC
as a developer sadly no
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:57 UTC
@coymeetsworld ahhah!
Coy Sanders
@coymeetsworld
Apr 06 2016 00:57 UTC
at the moment they're not hiring developers in US, which is dumb
bitgrower
@bitgrower
Apr 06 2016 00:57 UTC
@TheAmazingKarla -- I think you are working way too hard on this challenge ...
Coy Sanders
@coymeetsworld
Apr 06 2016 00:57 UTC
HP trying real hard to outsource jobs to India
Ghost
@ghost~56ea103685d51f252ab937b2
Apr 06 2016 00:57 UTC
@coymeetsworld what can i apply for?
Jackson Bates
@JacksonBates
Apr 06 2016 00:57 UTC
@bitgrower she's nearly there :)
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 00:58 UTC
tried replacing (myObj.hasOwnProperty("gift")) with (myObj.hasOwnProperty(checkProp)). That didn't work.
Coy Sanders
@coymeetsworld
Apr 06 2016 00:58 UTC
probably Operations jobs, like Sys Admin stuff
not sure if we have openings though, if you're honestly interested i could look PM me if you want
bitgrower
@bitgrower
Apr 06 2016 00:59 UTC
can you post your code WITH the hasOwnProperty(checkProp) code, @TheAmazingKarla
Jackson Bates
@JacksonBates
Apr 06 2016 01:00 UTC
@TheAmazingKarla no, that on it's own won't work, but it's closer. If you use checkProp instead of "gift" or "pet" you are at least checking the variable. Now that you are doing that, look at the rest of the logic. You don't need so many if/elses
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:00 UTC
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) { // Your Code Here 
  if (myObj.hasOwnProperty(checkProp)) { 
    return "pony";
  } 
  else if (myObj.hasOwnProperty(checkProp)) {
    return "kitten";
} 
  else { 
  return "Not Found";
       } 
}

// Test your code by modifying these values
checkObj("pet");
Henry Parson
@Hparson
Apr 06 2016 01:01 UTC

Hey all. I'm on the Profile Lookup exercise for javascript. I had trouble figuring it out, so I looked up someone elses' solution to reverse engineeer what I was doing wrong, and I dont understand why at the end of their solution the return statement is not an else statement.

function lookUp(firstName, prop){
// Only change code below this line
for (i = 0; i < contacts.length; i++){
if (firstName == contacts[i].firstName){
if (contacts[i].hasOwnProperty(prop)){
return contacts[i][prop];
}
else{
return "No such property";
}
}
}
return "No such contact";
// Only change code above this line
}

bitgrower
@bitgrower
Apr 06 2016 01:01 UTC
All your statements where you are returning a literal text value ... you don't need ... you only need ONE line ...
just one return ...
to "look up" a value in an object, you simply index into the object with the property ...
Jackson Bates
@JacksonBates
Apr 06 2016 01:02 UTC
@TheAmazingKarla so in that example now, your function is saying 'if the object has a property called "pet" (which it does) return "pony"'
@TheAmazingKarla so instead you want it to say return the value, rather than always pony...
bitgrower
@bitgrower
Apr 06 2016 01:03 UTC
so all you have to do is return the value referenced by the property in checkProp -- you don't even need to know what it is ... all you need to know is whether it's found or not ...
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:04 UTC

Something like
if (myObj.hasOwnProperty(checkProp))

and then checkObj(value)?

bitgrower
@bitgrower
Apr 06 2016 01:05 UTC
MUCH closer, @TheAmazingKarla
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:05 UTC
Uhhh...
Jackson Bates
@JacksonBates
Apr 06 2016 01:05 UTC
@TheAmazingKarla closer, but checkObj is a function, you want to look in the object
bitgrower
@bitgrower
Apr 06 2016 01:05 UTC
...but you need to reference the object (myObj), and you need to "index" into myObj using the checkProp variable...you need to use brackets for that ...
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:05 UTC
if (myObj.has OwnProperty(checkProp)) {
return value
?
Jeff
@Jeffgl77
Apr 06 2016 01:06 UTC
what exercise is that one?
bitgrower
@bitgrower
Apr 06 2016 01:06 UTC
Testig Objects for Properties
@TheAmazingKarla ... basically ... so then you would have to set the variable value to something ...
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:07 UTC
I'm so confused!
bitgrower
@bitgrower
Apr 06 2016 01:08 UTC
@Hparson -- because all the other conditions you've checked for already have a return statement to return the value within the loop -- what do you think the if statement should say ?
Jackson Bates
@JacksonBates
Apr 06 2016 01:08 UTC
@TheAmazingKarla myObj["pet"] would return 'kitten'...how would you return a value for the variable?
bitgrower
@bitgrower
Apr 06 2016 01:09 UTC
@TheAmazingKarla ... review the Using objects for Lookup Challenge, @TheAmazingKarla -- the challenge RIGHT before this one ...
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:09 UTC
I did!
Henry Parson
@Hparson
Apr 06 2016 01:09 UTC
@bitgrower I thought that there would be an else if statment that followed those but was inline with the original if statement
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:10 UTC
checkProp = ??
bitgrower
@bitgrower
Apr 06 2016 01:10 UTC

the only conceptual difference is that you are using the .hasOwnProperty to determine if the property exists in the object ... otherwise, you use the same syntax ...

where you used lookup, you use myObj; where you used val, you would use checkProp

Henry Parson
@Hparson
Apr 06 2016 01:10 UTC
function lookUp(firstName, prop){
// Only change code below this line
  for (i = 0; i < contacts.length; i++){
    if (firstName == contacts[i].firstName){
      if (contacts[i].hasOwnProperty(prop)){
        return contacts[i][prop];
      }
      else{
        return "No such property";
      }
    }
   else if{
     return "No such contact";
}
// Only change code above this line
}
So this basically
bitgrower
@bitgrower
Apr 06 2016 01:11 UTC
there's no if for the else to connect to, @Hparson
Henry Parson
@Hparson
Apr 06 2016 01:11 UTC
it was meant to be inline with first if statement. But I think I understand what you're saying
Jackson Bates
@JacksonBates
Apr 06 2016 01:12 UTC
@TheAmazingKarla you don't need to assign checkProp with a new value, you just need to know it has a value and use checkProp in the right places. You used it correctly in the if statement, you need to use it on one more place
bitgrower
@bitgrower
Apr 06 2016 01:12 UTC
in your for loop, you've looked thru ALL the objects ... -- and if you get thru the loop, you've not found a contact with that name ...
Henry Parson
@Hparson
Apr 06 2016 01:13 UTC
i see. I wasnt thinking about it properly.
thanks @bitgrower
CamperBot
@camperbot
Apr 06 2016 01:13 UTC
hparson sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 965 | @bitgrower | http://www.freecodecamp.com/bitgrower
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:13 UTC
(looking at previous lesson again)
bitgrower
@bitgrower
Apr 06 2016 01:13 UTC

Using Objects For Lookup:
return lookup[val];

Testing Objects For Lookup:
return myObj[checkProp];

Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:15 UTC
It worked! Thanks, @JacksonBates & @bitgrower !
CamperBot
@camperbot
Apr 06 2016 01:15 UTC
theamazingkarla sends brownie points to @jacksonbates and @bitgrower :sparkles: :thumbsup: :sparkles:
:star: 966 | @bitgrower | http://www.freecodecamp.com/bitgrower
:star: 285 | @jacksonbates | http://www.freecodecamp.com/jacksonbates
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:15 UTC
gotta look this over carefully before moving on.
bitgrower
@bitgrower
Apr 06 2016 01:16 UTC
yeah ... you'll be using it a lot going forward ... :)
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:16 UTC
Making sure I know what I did.
Onward & upward.
bitgrower
@bitgrower
Apr 06 2016 01:16 UTC
@TheAmazingKarla ... it's just like indexing into an array, except that you use a string to index into the object ....
mjqblade
@mjqblade
Apr 06 2016 01:17 UTC
who can help me on this plz
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:17 UTC
Making a note of that.
Jackson Bates
@JacksonBates
Apr 06 2016 01:17 UTC
@TheAmazingKarla objects is where I started stumbling...good luck with the next few :)
mjqblade
@mjqblade
Apr 06 2016 01:17 UTC
function convert(celsius) {
  // Only change code below this line


  // Only change code above this line
  if ( typeof fahrenheit !== 'undefined' ) {
    return fahrenheit;
  } else {
    return 'fahrenheit not defined';
  }
}

// Change the inputs below to test your code
convert(30);

it says convert(0) should return a number

Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:18 UTC
@JacksonBates Thanks for the warning!
CamperBot
@camperbot
Apr 06 2016 01:18 UTC
theamazingkarla sends brownie points to @jacksonbates :sparkles: :thumbsup: :sparkles:
:warning: theamazingkarla already gave jacksonbates points
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:18 UTC
I'll be sure to read extra carefully!
Gotta fix supper now. 'bye
bitgrower
@bitgrower
Apr 06 2016 01:19 UTC
good luck, @TheAmazingKarla -- when you "get it" and feel comfortable with it, you'll see how powerful it is ...
mjqblade
@mjqblade
Apr 06 2016 01:19 UTC
any help plz
bitgrower
@bitgrower
Apr 06 2016 01:19 UTC
fahrenheit appears to be undefined....
Karla Parker Schultz
@TheAmazingKarla
Apr 06 2016 01:19 UTC
Looking forward to that, @bitgrower
Ythalo Rossy Saldanha Lira
@ythalorossy
Apr 06 2016 01:26 UTC
Hello, i need help in Intermediate Algorithm
Arguments Optional
Brandon Dean
@thedeany
Apr 06 2016 01:28 UTC
Cannot for the life of me figure out why the button color and background color don't change at the same time when you click "New Quote" http://codepen.io/thedeany/pen/reGZZY The button color changes very clearly before the background color.
Ythalo Rossy Saldanha Lira
@ythalorossy
Apr 06 2016 01:28 UTC
function addTogether() {

  var args = Array.prototype.slice.call(arguments);

  var x = args[0];

  if (typeof args[1] !== 'number') {
    return undefined;
  }

  return function (y) {
    return x + y;
  };
}
Is this incorrect?
I tried this out of FCC and ran correctly.
But inside FCC I can't run it!
```
vendor-main-066508b245.js:58 Uncaught TypeError: Cannot read property 'split' of undefined
mjqblade
@mjqblade
Apr 06 2016 01:34 UTC
help plz what is wrong with this code
var sampleStr = "everyone said, \"mario is boss\"."; // Change this
CamperBot
@camperbot
Apr 06 2016 01:34 UTC
no wiki entry for: plz what is wrong with this codevar samplestr everyone said mario is boss change this
mjqblade
@mjqblade
Apr 06 2016 01:35 UTC
help plz what is wrong with this code
var sampleStr = "everyone said, \"mario is boss\"."; // Change this
CamperBot
@camperbot
Apr 06 2016 01:35 UTC
no wiki entry for: plz what is wrong with this codejavascriptvar samplestr everyone said mario is boss change this
Ythalo Rossy Saldanha Lira
@ythalorossy
Apr 06 2016 01:35 UTC
Anybody help me!
mjqblade
@mjqblade
Apr 06 2016 01:35 UTC
it says youse You should use two double quotes (") and four escaped double quotes (\")
Ythalo Rossy Saldanha Lira
@ythalorossy
Apr 06 2016 01:36 UTC
explain Arguments Optional
CamperBot
@camperbot
Apr 06 2016 01:36 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

mjqblade
@mjqblade
Apr 06 2016 01:38 UTC
explain Arguments Optional
CamperBot
@camperbot
Apr 06 2016 01:38 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

mjqblade
@mjqblade
Apr 06 2016 01:38 UTC
explain javascript
CamperBot
@camperbot
Apr 06 2016 01:38 UTC

:point_right: advantages and disadvantages of javascript [wiki]

Advantages & Disadvantages of JavaScript

Like all computer languages, JavaScript has certain advantages and disadvantages. Many of the pros and cons are related to being a client-side language.

:pencil: read more about advantages and disadvantages of javascript on the FCC Wiki

robdesautel
@robdesautel
Apr 06 2016 01:47 UTC
Hey guys I am so confused about .hasOwnProperty
How do I return a function that uses .hasOwnProperty from a global variable?
Ken Truong
@kjjtruong
Apr 06 2016 01:50 UTC
Hi everyone! I just completed the TItle Case a Sentence bonfire challenge where I had to return the provided string with the first letter of each word capitalized and everything else lower case.
just wondering if anyone could review my code for bugs or a better way to solve the problem
function titleCase(str) {

  var newArray = str.split(' ');

  function lowerToUpper(match) {
    return match.toUpperCase();
  }

  for(var i = 0; i < newArray.length; i++) {
    newArray[i] = newArray[i].toLowerCase().replace(/^[a-z]/g, lowerToUpper); 
  }

  str = newArray.join(' ');

  return str;

}

titleCase("I'm a little tea pot");
Jeff
@meankraken
Apr 06 2016 01:55 UTC

does anyone have any idea why my

$interval(func, 1000, 5);

call is not firing??

Ken Haduch
@khaduch
Apr 06 2016 01:55 UTC
@ythalorossy - how are you doing with your challenge?
@meankraken - could you post more code than that? (Unless I missed something else that you posted?) Where is that code, what is $interval?
Jeff
@meankraken
Apr 06 2016 01:57 UTC
$interval is an angular function, I included angular in my script but it's still not working
Ken Haduch
@khaduch
Apr 06 2016 01:58 UTC
@meankraken - oh, okay... I cannot help you directly with that, I'm not up to speed on angular... if you should me a codepen post or something I might have a shot at giving you some help? I'm willing to try, at least...
@robdesautel - hello there... what lesson or challenge is this? What have you got going with it so far?
Jeff
@meankraken
Apr 06 2016 02:01 UTC
Here's my codepen
http://codepen.io/meankraken/pen/YqrJGK
Trying to mess with my playMoves_addTurn function.. gonna warn you it's a lot of code
robdesautel
@robdesautel
Apr 06 2016 02:01 UTC
@khaduch testing objects for properties
Ken Haduch
@khaduch
Apr 06 2016 02:01 UTC
@mjqblade - which challenge is this? If it says you two double quotes and four escaped double quotes, I don't see that in the code that you posted?
robdesautel
@robdesautel
Apr 06 2016 02:02 UTC
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here

  checkProp = myObj;

  checkProp.hasOwnProperty();
  if (checkProp === true){
    return "";
  }else{
    return "Not Found";
  }

}

// Test your code by modifying these values
checkObj();
@khaduch ^^^^^
Justin
@daemedeor
Apr 06 2016 02:04 UTC
@robdesautel while you could theoretically do that, just put myObj into the checkObj() function and then you don’t have to do that assignment
checkObj(myObj)
robdesautel
@robdesautel
Apr 06 2016 02:07 UTC
so instead of my if function and initiation I use checkObj(myObj)?
Ken Haduch
@khaduch
Apr 06 2016 02:07 UTC
@robdesautel - okay - you have a slight misinterpretation of the functionality. You have a value (or should have a value) in the call to the function checkObj(); That property is associated with the argument in the function checkObj that has the name checkProp. That becomes the property name (or the potential property name) that you are looking for in the object myObj. You then need to have something that looks my myObj.hasOwnProperty(), because .hasOwnProperty is a method of an object. So what you are doing with this line: checkProp = myObj; is changing the value of the checkProp function argument variable. So you need the value that is passed in, and you need to use the myObj variable (which is the object) as I described...
Jeff
@meankraken
Apr 06 2016 02:08 UTC
@khaduch hey nvm I solved it by not using angular, thanks anyways man
CamperBot
@camperbot
Apr 06 2016 02:08 UTC
meankraken sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star: 860 | @khaduch | http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
Apr 06 2016 02:09 UTC
@robdesautel - no you cannot do that. the checkObj function will have different property names passed to it, as you see in the test code that is below the test description. You cannot change what is being passed to it because you have no control over that aspect of the solution.
Justin
@daemedeor
Apr 06 2016 02:09 UTC
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here

  checkProp.hasOwnProperty();
  if (checkProp === true){
    return "";
  }else{
    return "Not Found";
  }

}

// Test your code by modifying these values
checkObj(myObj);
Ken Haduch
@khaduch
Apr 06 2016 02:09 UTC
@meankraken - oh good... hope you get it all working!
Justin
@daemedeor
Apr 06 2016 02:10 UTC
@robdesautel see how it should look like
robdesautel
@robdesautel
Apr 06 2016 02:10 UTC
It's still a bit confusing to me...
most of JavaScript had made sense until now...lol
Justin
@daemedeor
Apr 06 2016 02:11 UTC
@robdesautel okay so checkProp is what is called a parameter, when you call the function, it can contain any value (theoretically)
Robert Richey
@0x0936
Apr 06 2016 02:12 UTC
@kjjtruong Great job solving that. Here is one way you might consider to optimize that solution. Please note, I am not presenting this as the best way.
function titleCase(str) {
  return str.split(' ').map((word) =>
    word[0].toUpperCase() + word.slice(1).toLowerCase()
  ).join(' ')
}
Ken Haduch
@khaduch
Apr 06 2016 02:12 UTC
@daemedeor @robdesautel - you cannot make that change because the test code that is going to run against that function would be doing something totally different. the test code is going to have three different cases - checkObj("gift") should return "pony". is the first one. See that they are passing names of properties that are potential properties in the myObj object. So what you have to do is use .hasOwnProperty() to see if the value that is passed in is a property of the object.
Justin
@daemedeor
Apr 06 2016 02:12 UTC
@khaduch oh okay i never did that lessson XD
@robdesautel but anyway, what you want to do is use the hasOwnProperty to see if that object has a key
Ken Haduch
@khaduch
Apr 06 2016 02:13 UTC
@robdesautel - they really almost give you the entire answer in the example part of the lesson, that's a hint...
you really just have to add similar looking code into the function.
Justin
@daemedeor
Apr 06 2016 02:14 UTC
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here

  var isThere = myObj.hasOwnProperty(checkProp);
  if (isThere){
    return myObj[checkProp];
  }else{
    return "Not Found";
  }

}

// Test your code by modifying these values
checkObj(“gift”);
robdesautel
@robdesautel
Apr 06 2016 02:15 UTC
@khaduch I have tried looking at the example but I am just not understanding the idea of this challenge....I thought in order to use the parameter I had to initiate it uses the object
@khaduch so essentially would you think I was close to the solultion lol....
Ken Haduch
@khaduch
Apr 06 2016 02:19 UTC
@robdesautel - the scope of the variable myObj is global to the function, so within the function you can access it freely and see the properties and get the values without having to pass it into the function. So you really just have to take the step of using the variable checkProp as the argument within myObj.hasOwnProperty() and check to see if that's true. @daemedeor 's code that he posted is essentially what you need to do, it could be optimized slightly. I was trying to help you see how to do it.
Justin
@daemedeor
Apr 06 2016 02:20 UTC
@khaduch meh i’m not in the business of optimizing the code :)
not here at least
Ken Haduch
@khaduch
Apr 06 2016 02:21 UTC
@daemedeor - that wasn't a criticism, and it's not really a requirement, just a good thing to be able to do. I was trying to point out that it could be simplified a little, but they talk about some of that in later lessons, I think? The fact that a function works to meet the tests is all that's required. thanks for helping out!
CamperBot
@camperbot
Apr 06 2016 02:21 UTC
khaduch sends brownie points to @daemedeor :sparkles: :thumbsup: :sparkles:
:star: 196 | @daemedeor | http://www.freecodecamp.com/daemedeor
Justin
@daemedeor
Apr 06 2016 02:22 UTC
@khaduch pre-optimization can be just as bad though :) this keeps his overall logic with trying to show what to do, i think he doesn’t understand what a parameter and maybe scope?
its hard to really parse it down when its “too simple"
robdesautel
@robdesautel
Apr 06 2016 02:25 UTC
@daemedeor I understand the scope and parameter of functions...The idea I couldn't understand was just using .hasOwnProperty
Justin
@daemedeor
Apr 06 2016 02:25 UTC
oh
Ken Haduch
@khaduch
Apr 06 2016 02:25 UTC
@daemedeor - you're correct - sometimes the one-line solutions to a problem can be confusing... I know it gets me confused sometimes! Especially with some of the higher-order Array methods. I'm still trying to get a handle on some of those!
Justin
@daemedeor
Apr 06 2016 02:25 UTC
@robdesautel okay ;)
@robdesautel do you want a link to how hasOwnProperty and how it works? MDN is a fantastic resource: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty
rodascesar
@cesarrodas
Apr 06 2016 02:26 UTC
anyone with ubuntu? I'm trying to get started with babel and es2015 but my (npm install -g babel-cli) isn't working. honestly the whole goal was to get the react starter kit to work on the browser. I don't mind doing either though
robdesautel
@robdesautel
Apr 06 2016 02:27 UTC
@daemedeor ive checked that out....that's why I came to the help site....
Justin
@daemedeor
Apr 06 2016 02:27 UTC
@cesarrodas what do you mean by “isn’t working?”\
oh …
robdesautel
@robdesautel
Apr 06 2016 02:28 UTC
@khaduch i like to learn the on-line solutions...it beats having to think about refactoring the code lol
Justin
@daemedeor
Apr 06 2016 02:28 UTC
hmmm it returns true depending on the string given it @robdesautel?
rodascesar
@cesarrodas
Apr 06 2016 02:28 UTC
@daemedeor it gives me an error and most of it is like alien symbols.
Justin
@daemedeor
Apr 06 2016 02:28 UTC
@cesarrodas i’m just going to say get a picture if you could last person i can help for now
“alien symbols” is not an error i can fix
rodascesar
@cesarrodas
Apr 06 2016 02:29 UTC

(Q������"A�e�9�J��M��C)�3���r¨Z��B�e�E
npm ERR! �7a�X��@i[�jd�Wđ�ע��| ����I�$$����
%�/á��Ԋ>tjUn�ʤ�w���}T}�;v �k�qi)ʀRtL�?.V�����繸����)�s���p��c����g]Us8��@T�@����Hf����2��?ds�9 npm ERR! �� y�m ERR!�[�/���y�o�-��"�H�:�u������:�S!a=�t4*���X����S 5&�!=�*zŅJg������aS�j�6���xۗ�M��X=,_H@q@��v�k�4;)��(� Oiy)�c�0�4�8�gH2{�t��q��"��4�dS�+���&Q��i�]�$�n�zр�=L�Hf8���p�WM�x��������H�K�i>t�m�)6�t@"Wu�AT�~誶o!�
C,��Fq��ភ>�D7{��s����6�k��u~~#�_��I�S�e��wQ
�����X� ��-7�Ʌ��'qc�"�S��VZL��tin���O�n��^Q�����^e#s^���C��ٱ
Q��:��� �3�3t�Z�8]��
ݵ(��A4�hhx�V�V<�|�����P��f7��2u�F�qvr���.��i��y'Jj�X�����tpJ�'��e!]/�CG��cQ���:�PH�����5<��֪a���a���S��g�^p$�G�]�-���JP���d#�G�q�4�|�/���4ס��ŏ�X�pI���s�jj�uc����HB����%ªi������o]��ט�S� 8�=�dR���i���?����AK1����K��B�]<�����[+R��Vq��������f�],"^�nw���e&�����ʄב��t�t�Ss��^���C"�m������8�x뎡����>�2ܳ�S~��u�Z�&|�ǥd�pUf+���
�a���#���b
��֣Hb�˜xЪ��6L81�z��8gL"p�������H���WV]�h]�����a0�y��?� h�|x9$Y����h��ϼ?��LE�o������9�%:H�쐥_�[�y���� ?;O�Z۠.W�9����lȳy��Qogә�7������N��J���
s
K�H$
y���a��г�~ZM6�5T��(Q�5��
hM���*ԝ�UL`e��)
��DRw},�f��i������:�G��j���[(�Ì�����A|�B8V�d���PCy�?9�cxz�0�T�?YWc��k�yWU��68��߻�����BY���f��pU�~Ьz[iֈ
pj ��c�|=���_���
npm ERR! �
npm ERR! at Object.parse (native)
npm ERR! at RegClient.<anonymous> (/usr/share/npm/node_modules/npm-registry-client/lib/request.js:238:23)
npm ERR! at Request.self.callback (/usr/lib/nodejs/request/index.js:148:22)
npm ERR! at Request.EventEmitter.emit (events.js:98:17)
npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/index.js:896:14)
npm ERR! at Request.EventEmitter.emit (events.js:117:20)
npm ERR! at IncomingMessage.<anonymous> (/usr/lib/nodejs/request/index.js:847:12)
npm ERR! at IncomingMessage.EventEmitter.emit (events.js:117:20)
npm ERR! at _stream_readable.js:920:16
npm ERR! at process._tickCallback (node.js:415:13)
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! npm-@googlegroups.com

npm ERR! System Linux 3.19.0-56-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "babel-cli"
npm ERR! cwd /home/cez
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! type unexpected_token
npm http 304 https://registry.npmjs.org/v8flags
npm http 200 https://registry.npmjs.org/babel-core
npm ERR! registry error parsing json
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/cez/npm-debug.log
npm ERR! not ok code 0
cez@ubuntu:~$ npm install -g babel-cli

Ken Haduch
@khaduch
Apr 06 2016 02:29 UTC
@robdesautel - the example in the lesson is really a fairly clear example of how to use it. The only difference is that instead of having a literal string as the argument, as they have in the example, you are being given the value that you are trying to check. I don't remember what they give you to start with in that lesson?
robdesautel
@robdesautel
Apr 06 2016 02:29 UTC
@daemedeor You are absolutely right...that's what was confusing me, how could I get a Boolean property return the object properties...that was my hang up
rodascesar
@cesarrodas
Apr 06 2016 02:29 UTC
sorry don't know how to describe it.
Ken Truong
@kjjtruong
Apr 06 2016 02:30 UTC
Dang..I didn't know about .map() and .slice(). Thanks for that @0x0936 !
CamperBot
@camperbot
Apr 06 2016 02:30 UTC
kjjtruong sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:star: 1264 | @0x0936 | http://www.freecodecamp.com/0x0936
Justin
@daemedeor
Apr 06 2016 02:30 UTC
@cesarrodas that’s why i said picture? sorry i can’t read the symbols gitter can’t parse
Robert Richey
@0x0936
Apr 06 2016 02:31 UTC
@kjjtruong :+1: :)
robdesautel
@robdesautel
Apr 06 2016 02:31 UTC
@khaduch The example it uses shows how .hasOwnProperty returns true and false statements...
Robert Richey
@0x0936
Apr 06 2016 02:32 UTC
@cesarrodas I'm not sure what the issue is, but your versions of node and npm are woefully outdated. install nvm, then get the latest node, which comes with latest npm
Justin
@daemedeor
Apr 06 2016 02:34 UTC
yea… node is at v4 i think or something haha
Robert Richey
@0x0936
Apr 06 2016 02:34 UTC
5.10.1 is latest stable
Justin
@daemedeor
Apr 06 2016 02:34 UTC
oh woah i just let brew manage my node thats why
i haven’t looked at version numbers in a whilllle
rodascesar
@cesarrodas
Apr 06 2016 02:35 UTC
I must have more than one than. :/ node version return 5.8.0
Ken Haduch
@khaduch
Apr 06 2016 02:37 UTC

@robdesautel - which is what you really need to do...

Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".

if the property is found = myObj.hasOwnProperty returns TRUE. If the property is not found = myObj.hasOwnProperty return FALSE. You just use that information in your testing. As @daemedeor showed, with a slight rewrite:

    if ( myObj.hasOwnProperty(checkProp) ) {
        return myObj[checkProp];
    } else {
        return "Not Found";
    }

you could also do this:

    if ( myObj.hasOwnProperty(checkProp) === true ) {
        return myObj[checkProp];
    } else {
        return "Not Found";
    }

but that is redundant to do that extra check for === true because of the way that the if test works.

Justin
@daemedeor
Apr 06 2016 02:38 UTC
@khaduch i would say that since hasOwnProperty() already returns true no need to do a double check :D
Ken Haduch
@khaduch
Apr 06 2016 02:41 UTC

@daemedeor - I explained that... just wanted to point out that their example of showing that it returns true or false can be used in the code with an explicit test, but it is not necessary. I was just trying to tie the example to the code that I was showing. There is yet another optimization, you don't need the else part.

    if ( myObj.hasOwnProperty(checkProp) ) {
        return myObj[checkProp];
    }
    return "Not Found";

because it is a one-shot test - no looping involved. But that doesn't really add that much or improve it that much.

Robert Richey
@0x0936
Apr 06 2016 02:41 UTC
or the ternary, if you're feeling feisty
return myObj.hasOwnProperty(checkProp) ? myObj[checkProp] : 'Not Found';
Ken Haduch
@khaduch
Apr 06 2016 02:42 UTC
@0x0936 - ooohhh... yeah. I don't always think of the ternary... see - there is always a way to improve things! :)
thanks
CamperBot
@camperbot
Apr 06 2016 02:42 UTC
khaduch sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
Justin
@daemedeor
Apr 06 2016 02:42 UTC
@khaduch fair enough -.-"
CamperBot
@camperbot
Apr 06 2016 02:42 UTC
:star: 1265 | @0x0936 | http://www.freecodecamp.com/0x0936
Justin
@daemedeor
Apr 06 2016 02:42 UTC
@0x0936 we don’t want to confuse the hell out of them -.-"
Ken Haduch
@khaduch
Apr 06 2016 02:42 UTC
@daemedeor :clap:
Kyle Morton
@kmorton1988
Apr 06 2016 02:43 UTC
anyone working on the Twitch.tv json api project?
Robert Richey
@0x0936
Apr 06 2016 02:43 UTC
@daemedeor when I was a beginner, I appreciated seeing many different ways of approaching a problem.
@kmorton1988 going through my 3rd re-write of that project ;)
Kyle Morton
@kmorton1988
Apr 06 2016 02:44 UTC
sigh
I'd like it if I could just get through the first one.
Having a hell of a time translating proper status messages, let alone passing an external variable into the getJSON callback function :/
Justin
@daemedeor
Apr 06 2016 02:45 UTC
@0x0936 hmmm well … fair enough, i normally just use their logic and modify it to teach (well if its as simple as this) because we all think differently
Ken Haduch
@khaduch
Apr 06 2016 02:45 UTC
@kmorton1988 - I haven't done this one yet, but I'm game to try and see what you have if you post a link? Or someone here will be able to chime in.
Kyle Morton
@kmorton1988
Apr 06 2016 02:45 UTC
it's gross and messy right now, but here goes:
Justin
@daemedeor
Apr 06 2016 02:45 UTC
man the twitch.tv api must be undergoing some amount of strain -.-"
Robert Richey
@0x0936
Apr 06 2016 02:46 UTC
@kmorton1988 I'll check it out in a bit - taking a small break right now
Kyle Morton
@kmorton1988
Apr 06 2016 02:46 UTC
thx, i'll keep hashing away at it.
Dylan
@dhcodes
Apr 06 2016 02:55 UTC
@kmorton1988 I had to use two diff. api calls to get what I needed
Kyle Morton
@kmorton1988
Apr 06 2016 02:55 UTC
Yeah, I'm thinking of using a second one to assign usernames. But I feel like there has to be a way to do it with a single one.
Dylan
@dhcodes
Apr 06 2016 02:56 UTC
@kmorton1988 idk, check this out: https://github.com/justintv/Twitch-API
I used GET channels
and GET streams
there may be one in there that has them both
Ken Haduch
@khaduch
Apr 06 2016 02:57 UTC
@kmorton1988 - I'm wondering if your first test for "data.stream" is where things are going wrong at this point? Because if that has a "null" value, then it will not pass that test? It seems like you're just trying to scope out how to handle the return at this point. I was thinking that you can use .hasOwnProperty there, since I just spent an hour talking about that method here in some chat discussions...
Kyle Morton
@kmorton1988
Apr 06 2016 02:57 UTC
yeah, and if it doesn't pass the test it'll move on to the next one, or it should.
that's the logic.
Ken Haduch
@khaduch
Apr 06 2016 02:58 UTC
i mean, you probably want to see something working in a most basic way right?
Kyle Morton
@kmorton1988
Apr 06 2016 02:58 UTC
I'm just trying to figure out how to return the values I need.
then I can figure out what I want to do with them.
Kent
@kenthub
Apr 06 2016 02:58 UTC

code challenge "chunky monkey"

Any ideas on how to get the arrays together inside final array? I've tried using push on each arrOne and arrTwo at the ends but nada

function chunkArrayInGroups(arr, size) {
  // Break it up.
  var finalArr = [];

  var arrOne = arr.slice(0, size);
  var arrTwo = arr.slice(0 + size);

  return finalArr;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
Robert Richey
@0x0936
Apr 06 2016 02:58 UTC
@kmorton1988 I had to use two different API calls, like @dhcodes mentioned. one to the streams endpoint and the other to channels
Kyle Morton
@kmorton1988
Apr 06 2016 02:59 UTC
that's frustrating :/
Dylan
@dhcodes
Apr 06 2016 02:59 UTC
@kenthub you tried finalArr.push(arrOne).push(arrTwo);
return finalArr;
?
Kent
@kenthub
Apr 06 2016 02:59 UTC
also tried to push() on my finalArr containing both created variables.
Robert Richey
@0x0936
Apr 06 2016 02:59 UTC
streams will tell you if the stream is live - null or not. channels will give you the info you need on that channel, but won't tell you if it's live
Kent
@kenthub
Apr 06 2016 02:59 UTC
yes but not like that... i tried combining them in one .push(arrOne, arrTwo)
will try
Dylan
@dhcodes
Apr 06 2016 03:00 UTC
@kenthub idk if that will work. Heck I'm not even sure chaining them like I did will work. You can always do them one at a time.
Kent
@kenthub
Apr 06 2016 03:01 UTC
@dhcodes yea it returned an error, combining them said was not a function :(
Dylan
@dhcodes
Apr 06 2016 03:01 UTC
@kmorton1988 I believe I made an array of usernames and then looped through it putting the username into the api call or something
@kenthub have you tried them one at a time?
Kyle Morton
@kmorton1988
Apr 06 2016 03:01 UTC
Yeah, that's what I'm doing.
Dylan
@dhcodes
Apr 06 2016 03:01 UTC

finalArr.push(arrOne);
final.Arr.push(arrTwo);

return finalArr;

Kyle Morton
@kmorton1988
Apr 06 2016 03:01 UTC
but it's actually display those usernames in the output inside the getJSON callback function.
Kent
@kenthub
Apr 06 2016 03:01 UTC
as in on each var.... such as arrOne.push(finalArr) ....
Ken Haduch
@khaduch
Apr 06 2016 03:01 UTC
@kmorton1988 - well, it looks like you're getting a lot of help here. But the first thing that I tried was to use the 'hasOwnProperty', and it is returning "Streaming Now" and "Account Deleted", but you don't have the user names because they are not available from the array at the point where the callback gets executed. But you could get the channel information from the returned data.
Kyle Morton
@kmorton1988
Apr 06 2016 03:02 UTC
hmm...
Dylan
@dhcodes
Apr 06 2016 03:02 UTC
@kenthub looking at your code again, I think you just need arrOne
Kent
@kenthub
Apr 06 2016 03:02 UTC
@dhcodes nada
Kyle Morton
@kmorton1988
Apr 06 2016 03:02 UTC
parse the username out of the data with a regexp or something?
Dylan
@dhcodes
Apr 06 2016 03:03 UTC
@kenthub one sec. I'll look at my solution
@kenthub nvm my solution is wrong
well, it got overridden
Kent
@kenthub
Apr 06 2016 03:07 UTC
lol i see that some of mine have as well
Ken Haduch
@khaduch
Apr 06 2016 03:08 UTC

@kmorton1988 - just working with what you have now, I made this change, and am seeing some useful output:

      var status;
      var user = '';
      if (data.hasOwnProperty("stream")) {
        if (data.stream === null) {
          status = "User Offline";
        }
        status = "Streaming Now";
        if (data.hasOwnProperty("_links")) {
          user = data["_links"]["channel"];
        }

      } else {
        status = "Account Deleted";
      }

      $("#twitch").append("<div class='streamer'>" + user + "</div>" + status);

    });

that's a snipped of code, but I'm using the data object that is returned and getting information from it, which is then reported in the output as:

Twitch Stream
https://api.twitch.tv/kraken/channels/freecodecamp
Streaming Now
https://api.twitch.tv/kraken/channels/terakilobyte
Streaming Now
https://api.twitch.tv/kraken/channels/storbeck
Streaming Now
https://api.twitch.tv/kraken/channels/habathcx
Streaming Now
https://api.twitch.tv/kraken/channels/RobotCaleb
Streaming Now
https://api.twitch.tv/kraken/channels/thomasballinger
Streaming Now
https://api.twitch.tv/kraken/channels/noobs2ninjas
Streaming Now
https://api.twitch.tv/kraken/channels/beohoff
Streaming Now

Maybe that helps you get a handle on what's happening? Maybe the others have better ideas...

Kyle Morton
@kmorton1988
Apr 06 2016 03:09 UTC
OH wow.
that does help, thanks.
thanks @khaduch
CamperBot
@camperbot
Apr 06 2016 03:09 UTC
kmorton1988 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star: 861 | @khaduch | http://www.freecodecamp.com/khaduch
Kyle Morton
@kmorton1988
Apr 06 2016 03:10 UTC
that won't help for deleted accounts, but I suppose we'll cross that bridge when we get there.
Traplord Ses
@TrapSes
Apr 06 2016 03:10 UTC
hey guys why isnt my switch statement working?
function myTest(val) {
  var answer = "";
  // Only change code below this line
  switch(val) {
    case 1:
      console.log("alpha");
      break;
    case 2:
      console.log("beta");
      break;
    case 3:
      console.log("gamma");
      break;
    case 4:
      console.log("delta");
      break;
i feel like i got it all right
Sudeep Narkar
@sudeepnarkar
Apr 06 2016 03:11 UTC
@TrapSes try answer="alpha";
and so on
Traplord Ses
@TrapSes
Apr 06 2016 03:11 UTC
@sudeepnarkar ahh yeh that works
@sudeepnarkar thanks
CamperBot
@camperbot
Apr 06 2016 03:11 UTC
trapses sends brownie points to @sudeepnarkar :sparkles: :thumbsup: :sparkles:
:star: 261 | @sudeepnarkar | http://www.freecodecamp.com/sudeepnarkar
Sudeep Narkar
@sudeepnarkar
Apr 06 2016 03:11 UTC
@TrapSes Great!
robdesautel
@robdesautel
Apr 06 2016 03:14 UTC
@khaduch @daemedeor I understand that I had a hard time understanding that challenge and the requirements. However what I was thinking is, if .hasOwnProperty is true then execute the return. However how blatantly obvious that it was wrong I didn't need you to tear it all a part to use me as a bad example. I am a learner and will continue to learn, but it don't help the learning process when I have to be the "what not to do" example.....thank you
CamperBot
@camperbot
Apr 06 2016 03:14 UTC
robdesautel sends brownie points to @khaduch and @daemedeor :sparkles: :thumbsup: :sparkles:
:star: 862 | @khaduch | http://www.freecodecamp.com/khaduch
:star: 198 | @daemedeor | http://www.freecodecamp.com/daemedeor
Dylan
@dhcodes
Apr 06 2016 03:16 UTC
@kenthub you still here?
buonarfcc
@buonarfcc
Apr 06 2016 03:16 UTC
can any one pls hep me with this->

// Only change code below this line
var lookup = {
alpha:"Adams",
bravo:"Boston",
charlie:"Chicago",
delta:"Denver",
echo:"Easy",
foxtrot:"Frank"
};

// Only change code above this line

// Change this value to test
var result = lookup.charlie;
console.log(result);

Justin
@daemedeor
Apr 06 2016 03:16 UTC
@robdesautel that was not my intention. I’m sorry.
Dylan
@dhcodes
Apr 06 2016 03:17 UTC
@kenthub I think the chunky monkey challenge would be easier with .splice(). Check it out on MDN
buonarfcc
@buonarfcc
Apr 06 2016 03:17 UTC
I go error : red circle with xs on each the following:
apklip
@apklip
Apr 06 2016 03:17 UTC
This message was deleted
buonarfcc
@buonarfcc
Apr 06 2016 03:17 UTC
phoneticLookup("alpha") should equal "Adams"
phoneticLookup("bravo") should equal "Boston"
phoneticLookup("charlie") should equal "Chicago"
phoneticLookup("delta") should equal "Denver"
phoneticLookup("echo") should equal "Easy"phoneticLookup("") should equal undefined
apklip
@apklip
Apr 06 2016 03:17 UTC
This message was deleted
function diffArray(arr1, arr2) {
  var newArr = [];

  if(arr1.length === 0) {
    newArr = arr2;
  } else if(arr2.length === 0) {
    newArr = arr1;
  } else {

    for(var i = 0; i < arr1.length; i++) {
      if(arr2.indexOf(arr1[i]) === -1) {
        newArr.push(arr1[i]); 
      }  
    }

    for(var b = 0; b < arr1.length; b++) {
      if(arr1.indexOf(arr2[b]) === -1) {
        newArr.push(arr2[b]); 
      }  
    }
  }

  return newArr;
}

diffArray(["diorite", "andesite", "grass", "dirt", "pink wool", "dead shrub"], ["diorite", "andesite", "grass", "dirt", "dead shrub"]);
Why does this return pinkwool and null?
["pinkwool", null];
Dylan
@dhcodes
Apr 06 2016 03:19 UTC
@buonarfcc you are writing to solve one test. You need to write so all the tests work
Robert Richey
@0x0936
Apr 06 2016 03:20 UTC
@kmorton1988 here is a forked pen showing how I went about it. No need for JSONP, and I moved the ajax into it's own function
Ken Haduch
@khaduch
Apr 06 2016 03:21 UTC
@robdesautel - if you took offense at anything that I posted, I apologize. I was just trying to help you, and I didn't know how. Sometimes it is difficult to try and convey the information without face-to-face interaction. I didn't know where you were having confusion, as the concept seems to be simple to me. I was not trying to make any kind of bad example - it just seemed to be getting more confusing as the discussion went on. When I finally saw how you seemed to be stuck on the 'true' and 'false' aspect of the function, I tried to explain it clearly. As I said, no offense intended, I had no desire to make a 'bad example' of you. There are a lot of concepts here and some of them come a little more naturally, some of them are more difficult. I try to provide help, try to provide hints without giving the answer because I think in the long run that will be more helpful in the learning process? I might be wrong, or sometimes it doesn't work well.... I apologize. Thank you for your understanding!
CamperBot
@camperbot
Apr 06 2016 03:21 UTC
khaduch sends brownie points to @robdesautel :sparkles: :thumbsup: :sparkles:
Dylan
@dhcodes
Apr 06 2016 03:21 UTC
@buonarfcc so instead of var result = lookup.charlie; you need to return statement that does the lookup for each value
CamperBot
@camperbot
Apr 06 2016 03:21 UTC
:star: 219 | @robdesautel | http://www.freecodecamp.com/robdesautel
Ken Haduch
@khaduch
Apr 06 2016 03:27 UTC
@robdesautel - and one more point: this chat room concept is both great and terrible. You can get help here - but things get very confusing sometimes as people chime in with helpful comments, and other things get missed and misinterpreted. It's a struggle to find a clear thread of communication here, especially when you have multiple threads going on. It takes patience to try and help, and also to get help! Sometimes people are downright nasty here, most often not. I try not to be offensive - but sometimes you walk a fine line between just giving the answer and trying to coach someone toward understanding when that seems to be more helpful? But please don't be offended - there are many times when I give what I think is a good answer only to have someone else chime in and point out my error(s). I have an expectation that things in these chats don't always go as well as you'd like them to, so you have to take some things with a grain of salt. I appreciate people who are trying to learn this - I'm trying that, as well! Best of luck to you, I hope I can be more helpful and do it in the right way in the future!
Robert Richey
@0x0936
Apr 06 2016 03:27 UTC
@robdesautel programming is not easy. I struggle with it all the time. Take a break, however long you need, then come back and keep working those problems. Read some new documentation. Find someone on the forums you can help - the best way to learn is when you put yourself in a position to teach.
buonarfcc
@buonarfcc
Apr 06 2016 03:28 UTC
what I missed pls:

function phoneticLookup(val) {
var result = "";
// Setup

// Only change code below this line
var lookup = {
alpha: result ="Adams",
bravo: result ="Boston",
charlie:result ="Chicago",
delta: result ="Denver",
echo: result ="Easy",
foxtrot: result ="Frank"

};
return result;// Only change code above this line
}
// Change this value to test

//console.log(result);
phoneticLookup("delta");
I kept getting "Frank" as answer!

robdesautel
@robdesautel
Apr 06 2016 03:29 UTC
@khaduch @daemedeor while we were discussing I felt I was starting to learn a bit, but I still have some confusion, however it was after the discussion I didn't feel was 'helpful' starting from when you were discussing about my if statement. To me it seemed like the was snickering about how many times can he test a true statement. Like I said I would like to learn more about how this code worked and how that example was relatable to the lesson tomorrow if you're still on.
Justin
@daemedeor
Apr 06 2016 03:30 UTC
not really, it was just us discussing the relative merits to each other
we were ripping each other!
well honestly in terms of ripping each other, that was pretty tame -.-“ some people can be insane
they’d go down the path of how much memory and how many seconds it took to execute
Robert Richey
@0x0936
Apr 06 2016 03:31 UTC
cringe
Ken Haduch
@khaduch
Apr 06 2016 03:32 UTC
@robdesautel - sure thing - always happy to help. And as @daemedeor just said - part of it went to a discussion between the two of us on the merits of doing one thing or another, when many options are available... and I don't consider it "ripping" :) I just felt it was a healthy discussion about how to do this. It just happened to be in the context of helping you with something that you were having trouble with.
Justin
@daemedeor
Apr 06 2016 03:32 UTC
@0x0936 you know the pain
Ken Haduch
@khaduch
Apr 06 2016 03:33 UTC
and @daemedeor is right - sometimes things can get nasty here, but I think that even some of that "nastiness" is more or less done in jest, or at least with tongue-in-cheek. (Although I have seen some things that seems nasty to me!)
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:33 UTC
wiki introducing javascript json notation
CamperBot
@camperbot
Apr 06 2016 03:33 UTC
no wiki entry for: introducing javascript json notation
Robert Richey
@0x0936
Apr 06 2016 03:33 UTC
I'm aware of it, but luckily I don't have the scars from being forced to do it. I have some background in assembly and C/C++ @daemedeor
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:33 UTC
wiki Introducing JavaScript Object Notation JSON
CamperBot
@camperbot
Apr 06 2016 03:33 UTC

:point_right: challenge introducing javascript object notation json [wiki]

Challenge: Introducing JavaScript Object Notation JSON

JavaScript Object Notation or JSON uses the format of JavaScript Objects to store data. JSON is flexible because it allows for Data Structures with arbitrary combinations of strings, numbers, booleans, arrays, and objects.

Here is an example of a JSON object:

var ourMusic = [
  {
    "artist": "Daft Punk",
    "title": "Homework",
    "release_year": 1997,
    "formats": [ 
      "CD", 
      "Cassette", 
      "LP" ],
    "gold": true
  }
];

:pencil: read more about challenge introducing javascript object notation json on the FCC Wiki

Justin
@daemedeor
Apr 06 2016 03:34 UTC
@khaduch the workplace is no buffer though -.-"
Robert Richey
@0x0936
Apr 06 2016 03:35 UTC
@khaduch this place is fairly tame compared to the underbelly of the web and many work places
Justin
@daemedeor
Apr 06 2016 03:35 UTC
@0x0936 parts of SO XD
Robert Richey
@0x0936
Apr 06 2016 03:35 UTC
yeah
Justin
@daemedeor
Apr 06 2016 03:36 UTC
it took .000000023ms longer?! are you insane?!
Jamie Lipschitz
@Jlipschitz
Apr 06 2016 03:39 UTC
Can that wiki bot call be done for all challenges?
Robert Richey
@0x0936
Apr 06 2016 03:39 UTC
I think performance is worth tweaking when orders of magnitude are at stake (less time, less memory, LOC), but smaller than that - waste of effort. focus on making sure it works, and others can easily contribute to it / take over
Ken Haduch
@khaduch
Apr 06 2016 03:39 UTC
@0x0936 @daemedeor @robdesautel - my last comment for now - I also have a lot of background in different programming languages, so a lot of the things are not "new" to me. I sometimes find that people get tripped up on things here through the lessons just because there are many concepts introduced, and then a "leap" to something that was not clearly explained or sometimes it takes some deduction from what was presented up to that point. Or something that was presented quite a few lessons back that was covered and then maybe forgotten (one of my problems...) So I sometimes have to remember that things that I think are 'easy' aren't all that intuitive if you are approaching this for the first time - maybe the lessons could be improved somewhat, or maybe the "Learn what to do if you get stuck" lesson should be reviewed. "Read-Search-Ask"...
Good night all - time to shut down (for me) for the night...
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:39 UTC
Evening all.
I'm scratching my head here on this one
```
Justin
@daemedeor
Apr 06 2016 03:39 UTC
@0x0936 oh yeah. but like in my example, no one is going to notice a 23 nanosecond difference
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:40 UTC
var myMusic = [
  {
    "artist": "Billy Joel",
    "title": "Piano Man",
    "release_year": 1973,
    "formats": [ 
      "CS", 
      "8T", 
      "LP" ],
    "gold": true
  }
  // Add record here
  {
    "artist": "AC/DC",
    "title": "TNT",
    "release_year": 1975,
    "formats": [
      "CS",
      "8T",
      "LP"],
    "gold": true
  }
];
Robert Richey
@0x0936
Apr 06 2016 03:40 UTC
@daemedeor right, I agree
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:40 UTC
I feel this should pass
Robert Richey
@0x0936
Apr 06 2016 03:40 UTC
@khaduch good night!
Justin
@daemedeor
Apr 06 2016 03:40 UTC
@wannabecoding you forgot a comma
Robert Richey
@0x0936
Apr 06 2016 03:41 UTC
@Jlipschitz I think so. the wiki is very extensive
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:41 UTC
@daemedeor O_O
Justin
@daemedeor
Apr 06 2016 03:41 UTC
@wannabecoding between the two objects
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:42 UTC
@daemedeor it clearly says it in the instructions, thanks
Justin
@daemedeor
Apr 06 2016 03:42 UTC
@khaduch same i’m just here for funsies :D
CamperBot
@camperbot
Apr 06 2016 03:42 UTC
wannabecoding sends brownie points to @daemedeor :sparkles: :thumbsup: :sparkles:
:star: 200 | @daemedeor | http://www.freecodecamp.com/daemedeor
Justin
@daemedeor
Apr 06 2016 03:45 UTC
yay 200 brownies :D
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:45 UTC
nice lol
Sudeep Narkar
@sudeepnarkar
Apr 06 2016 03:45 UTC
How is it going guys?
Robert Richey
@0x0936
Apr 06 2016 03:45 UTC
:wave:
Sudeep Narkar
@sudeepnarkar
Apr 06 2016 03:46 UTC
Is anyone getting any interview calls after building a few projects?
Justin
@daemedeor
Apr 06 2016 03:46 UTC
@sudeepnarkar hiyas
can’t say i have… but it really dpeneds where you live
Sudeep Narkar
@sudeepnarkar
Apr 06 2016 03:47 UTC
@daemedeor Hmm. Ok!
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:47 UTC
One day man... I'm messing with "basic" JS stuff and bootstrap still
Justin
@daemedeor
Apr 06 2016 03:48 UTC
@sudeepnarkar well i’m already employed so don’t consider it because of FCCs fault… i’m a full time dev
Sudeep Narkar
@sudeepnarkar
Apr 06 2016 03:48 UTC
@daemedeor That is nice. What technology stack are you working on?
Justin
@daemedeor
Apr 06 2016 03:49 UTC
right now Swift/iOS
Sudeep Narkar
@sudeepnarkar
Apr 06 2016 03:49 UTC
@daemedeor Cool!
Justin
@daemedeor
Apr 06 2016 03:49 UTC
i was previously a C#, JS, HTML, CSS so … there’s that
i’m a full stack web dev by default
so FCC was never for serious for me
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:50 UTC
nice... from your experience, how long before someone could be considered employable?
Justin
@daemedeor
Apr 06 2016 03:50 UTC
3-4 months… but i went to a bootcamp
i try not to say “how long” because it depends on the person and the place
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:51 UTC
good point
might take me longer :)
Justin
@daemedeor
Apr 06 2016 03:52 UTC
just keep trying imo and make projects
contribute to open source
Alejandro Tejada
@wannabecoding
Apr 06 2016 03:52 UTC
that's the plan, even if it's just for 30 minutes a day
hopefully it will sink in
note that i do more than 30 minutes a day on most days btw, sometimes work and family don't allow more than that though
Emil Aasa
@emilaasa
Apr 06 2016 03:55 UTC
30 minutes is infinitely more than 0 minutes
Keep tinkering every day and it will be good! =)
Justin
@daemedeor
Apr 06 2016 03:56 UTC
i’d also like to note, i’ve been single and quite young for most of it… thats the only way i’ve been able to do it
its not for everyone
buonarfcc
@buonarfcc
Apr 06 2016 04:00 UTC

hi daemedeor -> would you kindly decipher these codes for me? function phoneticLookup(val) {
var result = "";
// Setup

// Only change code below this line
var lookup = {
alpha: result ="Adams",
bravo: result ="Boston",
charlie:result ="Chicago",
delta: result ="Denver",
echo: result ="Easy",
foxtrot: result ="Frank"

};
return result; // Only change code above this line
}
// Change this value to test

//console.log(result);
phoneticLookup(result); I only got "Frank" as answer! Thank you.

Justin
@daemedeor
Apr 06 2016 04:01 UTC
@buonarfcc errr thats not how you do switch stataements
i’m guessing that what’s your trying to do?
random-x
@random-x
Apr 06 2016 04:04 UTC
@daemedeor or alternatively maybe he was trying to do some ninja stuff like:
var lookup = {
  'alpha': 'Adams',
  'bravo': 'Boston'
};
result = lookup[val];
Justin
@daemedeor
Apr 06 2016 04:04 UTC
perhaps
it would only be frank because thats the last assignment you do to result
that’s my guess
random-x
@random-x
Apr 06 2016 04:05 UTC
yeah, you're probably right
Blake Harris
@bharris62
Apr 06 2016 04:08 UTC
That challenge was worded very poorly for an intro to switch statements
Justin
@daemedeor
Apr 06 2016 04:09 UTC
@bharris62 MDN!!!!!
Blake Harris
@bharris62
Apr 06 2016 04:09 UTC
I'm just saying, it was confusing
Blake Harris
@bharris62
Apr 06 2016 04:10 UTC
Dear God I know how to do it. I'm saying I recall it was worded badly
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:11 UTC
Lel
Is there any way to edit those things?
Justin
@daemedeor
Apr 06 2016 04:11 UTC
@bharris62 i know… ;)
@rithvikvibhu probably mark it in the fcc repo and report an issue
i didn’t even bother with switch statemetns
haha
Alejandro Tejada
@wannabecoding
Apr 06 2016 04:13 UTC
in this code, what would the 2548, 2468 etc be considered?
// Setup
var collection = {
    2548: {
      album: "Slippery When Wet",
      artist: "Bon Jovi",
      tracks: [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    2468: {
      album: "1999",
      artist: "Prince",
      tracks: [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    1245: {
      artist: "Robert Palmer",
      tracks: [ ]
    },
    5439: {
      album: "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function update(id, prop, value) {
  if (id !== "" && prop != "tracks") {
    collection.tracks.value.push();
  } else {
    tracks.prop.shift();
  }

return collection;
}

// Alter values below to test your code
update(5439, "artist", "ABBA");

objects of the var collection, yes?
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:16 UTC
yup, i think
access like collection.5439;
random-x
@random-x
Apr 06 2016 04:16 UTC
@wannabecoding hm.. I think technically, since collection is an object, 2548 would be a property of it, which itself contains an object... but it's mostly because JS has incredibly loose typing.
Justin
@daemedeor
Apr 06 2016 04:17 UTC
@rithvikvibhu can’t do that
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:17 UTC
or collection[5439];
Justin
@daemedeor
Apr 06 2016 04:17 UTC
@rithvikvibhu forgot the quotes
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:17 UTC
isnt it a number?
int doent require right?
Justin
@daemedeor
Apr 06 2016 04:17 UTC
@rithvikvibhu well keys are always “coerced” to strings
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:18 UTC
and variables cannot start with int
ahhh
Justin
@daemedeor
Apr 06 2016 04:18 UTC
well.. i guess you could use the number
but you definitely can’t use the dot notation
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:18 UTC
hm. Thanks @daemedeor
CamperBot
@camperbot
Apr 06 2016 04:18 UTC
rithvikvibhu sends brownie points to @daemedeor :sparkles: :thumbsup: :sparkles:
:star: 203 | @daemedeor | http://www.freecodecamp.com/daemedeor
Justin
@daemedeor
Apr 06 2016 04:19 UTC
@rithvikvibhu oh the numbers are safe in the bracket notation
Robert Richey
@0x0936
Apr 06 2016 04:19 UTC
a bit unfortunate, I think, that object properties are allowed to be declared without quotes. although I do it all the time, to save on typing quotes, I am very aware of this quirk
Justin
@daemedeor
Apr 06 2016 04:19 UTC
sorry for false information
@0x0936 yea … i think they should always be strings… just because its better
Alejandro Tejada
@wannabecoding
Apr 06 2016 04:19 UTC
i wish i could follow lol
Justin
@daemedeor
Apr 06 2016 04:19 UTC
no need to switch between a variable
goudAsh
@goudAsh
Apr 06 2016 04:21 UTC
Hey..I'm in Everything Be True challenge. I am not able to find out the error in my code. Though it works fine if you see console.. but yet shows XX in test results.I have not added conditions for last two test cases. But this should atleast work for first few.
function every(collection, pre) {
  // Is everyone being true?
  var flag;
  for(var i=0;i<collection.length;i++)
    {

         if(collection[i].hasOwnProperty(pre))
        {
          if((collection[i][pre] !== "") && (collection[i][pre] !== 0) && (collection[i][pre]!==null))
               return true;
           else 
             return false;

        }
      else
         return false;


    }


}
random-x
@random-x
Apr 06 2016 04:21 UTC

the horrible part is that:

var collection = {
  '1' : 'tree'
};
console.log(collection[1]);

works perfectly well, too

thanks javascript.
goudAsh
@goudAsh
Apr 06 2016 04:22 UTC
Here is the function call for that

every([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex");
Alejandro Tejada
@wannabecoding
Apr 06 2016 04:22 UTC
i thought JS was zero indexed
confusion every other thing i read
random-x
@random-x
Apr 06 2016 04:23 UTC
@wannabecoding it is.. don't worry, we were discussing some broader issues of JS
Justin
@daemedeor
Apr 06 2016 04:24 UTC
@wannabecoding they’re not trying to read an array, they’re reading an object
Alejandro Tejada
@wannabecoding
Apr 06 2016 04:24 UTC
gotcha
don't mind me
Justin
@daemedeor
Apr 06 2016 04:24 UTC
@wannabecoding objects have discrete values, lets say i tried collection[0] in random’s example since there is no key that corressponds to 0 it would be undefined
Alejandro Tejada
@wannabecoding
Apr 06 2016 04:25 UTC
@daemedeor okay, i see what you mean
JS forced the string 1 to be a numerical 1
Justin
@daemedeor
Apr 06 2016 04:25 UTC
in this case, this type of notation is called bracket notation, its for variables and numbers usually
and yes @wannabecoding
Alejandro Tejada
@wannabecoding
Apr 06 2016 04:25 UTC
or integer, whatever the correct nomenclature may be
Justin
@daemedeor
Apr 06 2016 04:25 UTC
well not “forced"
i’m guessing for object accessors its only == not ===
llamatarianism
@llamatarianism
Apr 06 2016 04:26 UTC
@wannabecoding number, in this case
@wannabecoding javascript doesn't have floats/integers, everything's a floating point number
at least IIRC
Justin
@daemedeor
Apr 06 2016 04:26 UTC
@llamatarianism coorrrrect
a floating point number that makes dealing with large numbers a pain
buonarfcc
@buonarfcc
Apr 06 2016 04:26 UTC

I have modified the codes _> what would be missing?function phoneticLookup(lookup) {
var result = "";
// Setup

// Only change code below this line
lookup = {
alpha: result ="Adams",
bravo: result ="Boston",
charlie:result ="Chicago",
delta: result ="Denver",
echo: result ="Easy",
foxtrot: result ="Frank"

};
return result; // Only change code above this line
}
// Change this value to test
var bum = lookup.charlie;
//console.log(result);
phoneticLookup(bum);
Still getting : Frank?

Justin
@daemedeor
Apr 06 2016 04:27 UTC
@buonarfcc you haven’t modified anything though
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:27 UTC
@buonarfcc i thought u needed quotes
llamatarianism
@llamatarianism
Apr 06 2016 04:28 UTC
http://i.imgur.com/wqiAEAE.png is this an infinite loop? according to the engine it is (I had to add noprotect to get it to run and when it did, it crashed) but I don't see why it would be.
random-x
@random-x
Apr 06 2016 04:28 UTC
@goudAsh make sure you are using the right function name
llamatarianism
@llamatarianism
Apr 06 2016 04:28 UTC
sorry I had to take a screenshot, it wouldn't let my copypaste because it had crashed.
Justin
@daemedeor
Apr 06 2016 04:29 UTC
@llamatarianism it can be
@llamatarianism lets take if the first if never passed
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:29 UTC
@buonarfcc try something like 'alpha': 'apple';
Justin
@daemedeor
Apr 06 2016 04:29 UTC
@llamatarianism then change will always be > 0
llamatarianism
@llamatarianism
Apr 06 2016 04:30 UTC
@daemedeor wouldn't it just decrement i and move on to the next item in worthArr?
Justin
@daemedeor
Apr 06 2016 04:30 UTC
@llamatarianism no…. because then the change would be still unmodified
Alejandro Tejada
@wannabecoding
Apr 06 2016 04:30 UTC
@llamatarianism what OS are you running?
Justin
@daemedeor
Apr 06 2016 04:30 UTC
this is the extreme case that the first if never passed
llamatarianism
@llamatarianism
Apr 06 2016 04:30 UTC
not sure I understand what you're saying
@wannabecoding ubuntu 14.04
Alejandro Tejada
@wannabecoding
Apr 06 2016 04:31 UTC
looks nice
never ventured into linux
wiki Record Collection
CamperBot
@camperbot
Apr 06 2016 04:31 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

Justin
@daemedeor
Apr 06 2016 04:31 UTC
@llamatarianism basically the first test for whatever reason (not really parsing it in my mind) will not pass, so change will get stuck maybe at the last time
you can possibly also check for i
llamatarianism
@llamatarianism
Apr 06 2016 04:32 UTC
@daemedeor you mean change > worthArr[i]?
Justin
@daemedeor
Apr 06 2016 04:32 UTC
@llamatarianism the entire first test
since both have to pass
you can add another check to the while loop to make sure i > 0 as well
i’m not really going to make sure its right or wrong
llamatarianism
@llamatarianism
Apr 06 2016 04:33 UTC
@daemedeor I still don't see the problem though. if neither test passes, i is reduced by 1, so it checks if change is greater than 20, then 10, then 5, etc
Justin
@daemedeor
Apr 06 2016 04:34 UTC
@llamatarianism yea but then what happens at 1 and it still never passes that test?
and change doesn’t get decremented enough
llamatarianism
@llamatarianism
Apr 06 2016 04:34 UTC
@daemedeor good point
Justin
@daemedeor
Apr 06 2016 04:34 UTC
change will go -1, -2, etc.
buonarfcc
@buonarfcc
Apr 06 2016 04:34 UTC

I have modified with quote function phoneticLookup(lookup) {
var result = "";

// Setup

// Only change code below this line
lookup = {
'alpha': result ="Adams",
'bravo': result ="Boston",
'charlie':result ="Chicago",
'delta': result ="Denver",
'echo': result ="Easy",
'foxtrot': result ="Frank"

};
return result; // Only change code above this line
}
// Change this value to test
var bum = lookup("charlie");
//console.log(result);
phoneticLookup(bum);
//console.log(phoneticLookup.charlie); I got lookup is not defined?

Justin
@daemedeor
Apr 06 2016 04:36 UTC
uhhh @buonarfcc i think you’re changing the wrong thing, you need to change the lines from lookup = {} to result… in fact now you’re changing the value of lookup
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:36 UTC
@buonarfcc get the lookup object to key: value
var alpha = {
  1:"Z",
  2:"Y",
  3:"X",
  4:"W",
  ...
  24:"C",
  25:"B",
  26:"A"
};
@buonarfcc you will also need to quote the key, since they arent integers
Justin
@daemedeor
Apr 06 2016 04:37 UTC
@rithvikvibhu he can leave them as integers
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:38 UTC
@daemedeor the tests require them: phoneticLookup("alpha")
buonarfcc
@buonarfcc
Apr 06 2016 04:38 UTC

@rithvikvibhu function phoneticLookup(lookup) {
var result = "";

// Setup

// Only change code below this line
lookup = {
'alpha': result ='Adams',
'bravo': result ='Boston',
'charlie':result ='Chicago',
'delta': result ='Denver',
'echo': result ='Easy',
'foxtrot': result ='Frank'

};
return result; // Only change code above this line
}
// Change this value to test
var bum = lookup("charlie");
//console.log(result);
phoneticLookup(bum); I still got : lookup is not defined?

Justin
@daemedeor
Apr 06 2016 04:38 UTC
@rithvikvibhu you don’t technically…. have to put strings in quotes in objects for keys
i don’t do that because its type intensive :smile:
Trilok reddy
@Trilokreddy007
Apr 06 2016 04:39 UTC
hi can any one help me understanding Generate Random Fractions with JavaScript
Justin
@daemedeor
Apr 06 2016 04:39 UTC
4 extra button presses
llamatarianism
@llamatarianism
Apr 06 2016 04:39 UTC
@daemedeor you're correct, that was the problem
@daemedeor thanks
CamperBot
@camperbot
Apr 06 2016 04:39 UTC
llamatarianism sends brownie points to @daemedeor :sparkles: :thumbsup: :sparkles:
:star: 204 | @daemedeor | http://www.freecodecamp.com/daemedeor
Trilok reddy
@Trilokreddy007
Apr 06 2016 04:40 UTC

function myFunction() {

// Only change code below this line.

return math.random()*myFunction;

// Only change code above this line.
}
it only says math is not defined

Justin
@daemedeor
Apr 06 2016 04:40 UTC
Math.random()
;)
math isn’t defined
Elbert Cortez
@trip16661
Apr 06 2016 04:40 UTC

$(document).ready(function() {
var api = "http://www.stands4.com/services/v2/quotes.php?uid=5004&tokenid=LQT1R9DoNwzUYS1O";
var apiAuthor = "&searchtype=AUTHOR&query=";
  var authorInput;
  $("#submit").on("click", function() {
    authorInput = $("#autor").val();



  });
});
Why is authorInput shows as undefined? D:
Malcolm
@noinkling
Apr 06 2016 04:41 UTC
@buonarfcc you shouldn't be assigning result on every line in your object, and you shouldn't be naming your object the same as the argument
Justin
@daemedeor
Apr 06 2016 04:42 UTC
@trip16661 because you misspelled author?
#autor is probably on the page as #author
i’m guessing cause everything else is spelled right
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:42 UTC
@buonarfcc What we want is key: value;. In this case, key = alpha and so on and value is Adams. So it would look something like 'alpha': 'Adams'
The lookup object can then then be used in the return statement as lookup["alpha"]
We get the key in a variable (lookup), hence lookup[lookup]
Elbert Cortez
@trip16661
Apr 06 2016 04:43 UTC
yes pretty much
im straight up retarded
ahahahahahaha im so dumb >_<
Trilok reddy
@Trilokreddy007
Apr 06 2016 04:43 UTC
@ @daemedeor thanks
CamperBot
@camperbot
Apr 06 2016 04:43 UTC
trilokreddy007 sends brownie points to @daemedeor :sparkles: :thumbsup: :sparkles:
:star: 205 | @daemedeor | http://www.freecodecamp.com/daemedeor
Elbert Cortez
@trip16661
Apr 06 2016 04:43 UTC
i spent like 20 min looking all over the internet trying to find why xDD
random-x
@random-x
Apr 06 2016 04:43 UTC
happens to the best of us, @Trilokreddy007 :D
Justin
@daemedeor
Apr 06 2016 04:43 UTC
yay 205 stars!
Malcolm
@noinkling
Apr 06 2016 04:43 UTC
typos and misspellings are some of the most common programmer errors, the trick is how fast you can recognize them when something goes wrong
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:44 UTC
:point_up: April 6, 2016 10:08 AM The test requires to identify with keys like 'alpha' and the position of alpha isnt known. If i got it wrong, let me know
Justin
@daemedeor
Apr 06 2016 04:44 UTC
i’m getting good at spotting them quicker and quicker even with commas XD
Elbert Cortez
@trip16661
Apr 06 2016 04:44 UTC
@daemedeor thanks
CamperBot
@camperbot
Apr 06 2016 04:44 UTC
trip16661 sends brownie points to @daemedeor :sparkles: :thumbsup: :sparkles:
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:44 UTC
So it has to be in strings
CamperBot
@camperbot
Apr 06 2016 04:44 UTC
:star: 206 | @daemedeor | http://www.freecodecamp.com/daemedeor
Elbert Cortez
@trip16661
Apr 06 2016 04:44 UTC
im really bad at seeing my own errors
Justin
@daemedeor
Apr 06 2016 04:44 UTC
@trip16661 we all are
thats why we have QA departmenets….
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:45 UTC
:point_up: April 6, 2016 10:14 AM @daemedeor
Elbert Cortez
@trip16661
Apr 06 2016 04:45 UTC
it happens with my english often i keep saying things that don't make any sense even though i know the rules xD
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:45 UTC
Quoting a quote. wow
@trip16661 lel
Justin
@daemedeor
Apr 06 2016 04:46 UTC
i’m scared for the day that programming stops using english syntax
Malcolm
@noinkling
Apr 06 2016 04:46 UTC
@trip16661 If you speak spanish then "autor" is a pretty understandable mistake anyway
Justin
@daemedeor
Apr 06 2016 04:47 UTC
@noinkling that would be understanable if all the other variables were spelled the same way XD
i would’ve been w/e
Malcolm
@noinkling
Apr 06 2016 04:48 UTC
or portuguese for that matter
Justin
@daemedeor
Apr 06 2016 04:48 UTC
makes it tougher to debug if i don’t know what the variables are named XD
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:49 UTC
The @camperbot does not respond in private chats :worried:
Elbert Cortez
@trip16661
Apr 06 2016 04:49 UTC
@rithvikvibhu my gf is trying to fix my eng and she pointed out that i say latter instead of later and even gave me an explanation about why. But 6 month latter i still :P
xDD
llamatarianism
@llamatarianism
Apr 06 2016 04:49 UTC
is there a way to give a number a fixed number of decimal places?
I know about toFixed but that returns a string
Justin
@daemedeor
Apr 06 2016 04:49 UTC
tofixed is the only way
-.-
llamatarianism
@llamatarianism
Apr 06 2016 04:49 UTC
argh
@daemedeor thanks anyway :P
CamperBot
@camperbot
Apr 06 2016 04:50 UTC
llamatarianism sends brownie points to @daemedeor :sparkles: :thumbsup: :sparkles:
:warning: llamatarianism already gave daemedeor points
Justin
@daemedeor
Apr 06 2016 04:50 UTC
nooooo wasted brownies
sniff wasted chocolate
Malcolm
@noinkling
Apr 06 2016 04:50 UTC
toPrecision as well, but that also converts to string
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:50 UTC
do we lose points?
Justin
@daemedeor
Apr 06 2016 04:50 UTC
no no no
1 / point /person /hour
i’m just trying to make a joke
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:51 UTC
but it isnt like giving away our brownies right?
Justin
@daemedeor
Apr 06 2016 04:51 UTC
yea… just spilled chocolate
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:51 UTC
if so, i'm leaviny
xD
Justin
@daemedeor
Apr 06 2016 04:52 UTC
i’m sure the mods of camper bot know of a way though
not really THAT difficult to code
if you can add 1, you can remove 1
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:52 UTC
a secret word. Going to check the source for the bot on github
Elbert Cortez
@trip16661
Apr 06 2016 04:52 UTC
i wish there were a less intrusive camper bot
Brian
@sludge256
Apr 06 2016 04:52 UTC
You don't give away your points.
Malcolm
@noinkling
Apr 06 2016 04:53 UTC
make your own bot that has its own points system, and give yourself a billion or so to start
Justin
@daemedeor
Apr 06 2016 04:53 UTC
@noinkling that would be inflation, worthless
Elbert Cortez
@trip16661
Apr 06 2016 04:53 UTC
like you could just @daemedeor help format (and it pops the help information onlyto you)
Malcolm
@noinkling
Apr 06 2016 04:53 UTC
hand down one or two the peasants every so often
Brian
@sludge256
Apr 06 2016 04:53 UTC
You say that like brownies don't suffer from inflation ;)
Elbert Cortez
@trip16661
Apr 06 2016 04:54 UTC
instead of spaming the whole chat
Justin
@daemedeor
Apr 06 2016 04:54 UTC
@sludge256 they do, just at a slower rate
Malcolm
@noinkling
Apr 06 2016 04:54 UTC
and set it up so that when camperbot gives a brownie point to someone, your bot takes one of your points away from them
Brian
@sludge256
Apr 06 2016 04:54 UTC
@trip16661 There is an alternative way that doesn't spam the chat.
find format
CamperBot
@camperbot
Apr 06 2016 04:54 UTC

find format

:zero: code formatting

Brian
@sludge256
Apr 06 2016 04:54 UTC
:point_up:
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:55 UTC
0
CamperBot
@camperbot
Apr 06 2016 04:55 UTC

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick(`) at start and end around the code.

See also: ☛ How to type Backticks | ☯ Compose Mode | ❄ Gitter Formatting Basics

:pencil: read more about code formatting on the FCC Wiki

Justin
@daemedeor
Apr 06 2016 04:55 UTC
so we have a black hat hacker on our hands
Elbert Cortez
@trip16661
Apr 06 2016 04:55 UTC
is the same xD
Brian
@sludge256
Apr 06 2016 04:55 UTC
Only if someone sends 0
They can click the link instead.
Elbert Cortez
@trip16661
Apr 06 2016 04:55 UTC
i see
Brian
@sludge256
Apr 06 2016 04:56 UTC
But yes, I had considered proposing PM functionality for the bot.
Justin
@daemedeor
Apr 06 2016 04:56 UTC
had, would you consider making that considering?
Elbert Cortez
@trip16661
Apr 06 2016 04:57 UTC
but it's anyway not directed
like if the person is new , i don't think he would know that's a link
cuz it doesn't look like one xD
Rithvik Vibhu
@rithvikvibhu
Apr 06 2016 04:57 UTC
holler
CamperBot
@camperbot
Apr 06 2016 04:57 UTC
holler back!
Justin
@daemedeor
Apr 06 2016 04:58 UTC
@trip16661 but it has a blue line and everything….
Elbert Cortez
@trip16661
Apr 06 2016 04:58 UTC
it's cuz you are used to it but some people are not
Justin
@daemedeor
Apr 06 2016 04:58 UTC
so you’re not used to the web having blue text and underline for links?
Brian
@sludge256
Apr 06 2016 04:59 UTC
Feel free to file an issue: https://github.com/FreeCodeCamp/camperbot
Elbert Cortez
@trip16661
Apr 06 2016 04:59 UTC
I live in a village in a small wood
what can i say
xD
Justin
@daemedeor
Apr 06 2016 05:00 UTC
@trip16661 into the woods?
Brian
@sludge256
Apr 06 2016 05:00 UTC
But consider this,
Elbert Cortez
@trip16661
Apr 06 2016 05:00 UTC
it's called konoha but that's not the point xDD
Elijah
@Elijahhh
Apr 06 2016 05:00 UTC
This message was deleted
Brian
@sludge256
Apr 06 2016 05:00 UTC
It has potential to be abused for spamming people.
Elbert Cortez
@trip16661
Apr 06 2016 05:01 UTC
ye but that's easily fixeable , the same way people don't over spam on the chat
Brian
@sludge256
Apr 06 2016 05:01 UTC
Although, that potential already exists in the chats themselves.
Justin
@daemedeor
Apr 06 2016 05:01 UTC
@trip16661 lol but then i think if your village isn’t used to blue text for links, then i think we have bigger issues with the internet
like the lack of internet
Elbert Cortez
@trip16661
Apr 06 2016 05:02 UTC
I'm sure there are intern rules that will block an user of sending things to another use in a period of time
@daemedeor :(
Brian
@sludge256
Apr 06 2016 05:02 UTC
There's nothing currently built into Gitter or Camperbot itself as far as I know.
Elbert Cortez
@trip16661
Apr 06 2016 05:02 UTC
well if we want internet we need to get close to a city and steal a wifi code :(
rphares
@rphares
Apr 06 2016 05:03 UTC
(chimes in quickly-- it doesn't look like link to me, either, there is no line, and it is offset but that number, AND... if you dont know what formatting is, it doesn't register as aimed at you... )
Elbert Cortez
@trip16661
Apr 06 2016 05:03 UTC
really? so the only way to moderate the chat is by an actual person?
Brian
@sludge256
Apr 06 2016 05:03 UTC
The problem is with how people use the command.
Justin
@daemedeor
Apr 06 2016 05:03 UTC
@rphares fine fine T-T
Brian
@sludge256
Apr 06 2016 05:03 UTC
People post code
and others reply with help format
Elbert Cortez
@trip16661
Apr 06 2016 05:03 UTC
<3 my second favorite peng :P helping me xD
Brian
@sludge256
Apr 06 2016 05:03 UTC
w/o directing it at op
They don't say "Hey, do what this message says."
Elbert Cortez
@trip16661
Apr 06 2016 05:04 UTC
penguins rocks xD
Justin
@daemedeor
Apr 06 2016 05:04 UTC
ya … but she hasn’t seen Happy Feet :(
so penguin hasn’t seen more penguins
rphares
@rphares
Apr 06 2016 05:04 UTC
yep-- which is why a lot of people point to the explanation, as they often just keep going....
but the picture in the help format part, with that code blcok does help
(NOT saying something should be changed... just that i get trips side with the confusion :blush: )
Elijah
@Elijahhh
Apr 06 2016 05:05 UTC
This message was deleted
Brian
@sludge256
Apr 06 2016 05:05 UTC
@Elijahhh I think it was fine as it was.
formatting wise
Justin
@daemedeor
Apr 06 2016 05:06 UTC
i didn’t even see the message T_T
Brian
@sludge256
Apr 06 2016 05:06 UTC
@daemedeor Need faster :eyes:
I can sell you some.
Elbert Cortez
@trip16661
Apr 06 2016 05:06 UTC
I just feel that would be nice if you could just target one person but i think the whole chat must be overwrited since there is not wispering function in it
Justin
@daemedeor
Apr 06 2016 05:06 UTC
i saw a black flash
Elbert Cortez
@trip16661
Apr 06 2016 05:06 UTC
it will be cool too :P
Justin
@daemedeor
Apr 06 2016 05:06 UTC
and in it Math.Floor()
@trip16661 you can whisper to people
Elbert Cortez
@trip16661
Apr 06 2016 05:06 UTC
ye but in another table
chat
Brian
@sludge256
Apr 06 2016 05:07 UTC
/query @username
@trip16661 Oh you mean a whisper within this room?
Elbert Cortez
@trip16661
Apr 06 2016 05:09 UTC
ye
Brian
@sludge256
Apr 06 2016 05:09 UTC
That doesn't exist in Gitter.
Elbert Cortez
@trip16661
Apr 06 2016 05:09 UTC
I'm aware that's what i mean xD
Brian
@sludge256
Apr 06 2016 05:09 UTC
It would have to be a PM like the one you just sent me.
Gotcha.
Elbert Cortez
@trip16661
Apr 06 2016 05:10 UTC
that for like selecting one person to send a help information from camper bot
it will need a wisper kind of function
integrated in the chat
Brian
@sludge256
Apr 06 2016 05:10 UTC
Yea sending them the message through a PM isn't a very elegant solution either because the receiver has to click on the PM in the left pane. It alleviates "spam" though.
Elbert Cortez
@trip16661
Apr 06 2016 05:11 UTC
so for example sending /wisper @sludge256 and then whatever inside is in a gray box
Brian
@sludge256
Apr 06 2016 05:11 UTC
Yea I understand.
Like how it's implemented in MMOs or Twitch chat.
Justin
@daemedeor
Apr 06 2016 05:12 UTC
i think we need to send some H’s to trip :)
Elbert Cortez
@trip16661
Apr 06 2016 05:12 UTC
cough cough cough pinky in control >_<
ex gamer xD
H's ? xD
Justin
@daemedeor
Apr 06 2016 05:12 UTC
@trip16661 you missed an H in whisper
and the H in author
its just being playful
Elbert Cortez
@trip16661
Apr 06 2016 05:13 UTC
D: im just straight up dumb :D hope you understand
Justin
@daemedeor
Apr 06 2016 05:14 UTC
just playful banter late nights do that to you
Brian
@sludge256
Apr 06 2016 05:14 UTC
@Elijahhh Still need help?

Pretty quiet tonight.
Elbert Cortez
@trip16661
Apr 06 2016 05:14 UTC
yesterday was the same
Justin
@daemedeor
Apr 06 2016 05:15 UTC
i like it like this quiet at times, easier to chat with a few regulars like mods
Brian
@sludge256
Apr 06 2016 05:15 UTC
Mods? What are those?
Justin
@daemedeor
Apr 06 2016 05:16 UTC
i see the activity in the sidebar
Brian
@sludge256
Apr 06 2016 05:16 UTC
:see_no_evil:
You see nothing.
I wonder if those can be hidden.
They're not exactly a friendly sight.
Elbert Cortez
@trip16661
Apr 06 2016 05:17 UTC
i wonder who is a mod and who is not
rphares
@rphares
Apr 06 2016 05:17 UTC
hmm, id leave them
they arent friendly,
Elbert Cortez
@trip16661
Apr 06 2016 05:17 UTC
is like a game, spy game
Justin
@daemedeor
Apr 06 2016 05:17 UTC
slude and benmcmahon and hallaathrad are mods
rphares
@rphares
Apr 06 2016 05:17 UTC
but... they are also a reminder
Justin
@daemedeor
Apr 06 2016 05:17 UTC
and our favorite penguin
rphares
@rphares
Apr 06 2016 05:17 UTC
lol, im not a mod, @daemedeor
Elbert Cortez
@trip16661
Apr 06 2016 05:18 UTC
i guessed that she was a penguin too
Justin
@daemedeor
Apr 06 2016 05:18 UTC
:O
Elbert Cortez
@trip16661
Apr 06 2016 05:18 UTC
aren't you?
Brian
@sludge256
Apr 06 2016 05:18 UTC
@daemedeor Seems the middle two keys aren't in use tonight
G and H
Justin
@daemedeor
Apr 06 2016 05:18 UTC
oh no ;O my mac needs to go to the mac store state
stat*
rphares
@rphares
Apr 06 2016 05:18 UTC
noo, sorry to disappoint :blush:
Justin
@daemedeor
Apr 06 2016 05:18 UTC
the Gs need to be revitalized
go go go go
Elbert Cortez
@trip16661
Apr 06 2016 05:19 UTC
Go go power rangers
oh wait
Brian
@sludge256
Apr 06 2016 05:19 UTC
For anyone else reading chat, feel free to ask for help.
Justin
@daemedeor
Apr 06 2016 05:19 UTC
nah nah nah nah nah nah nah nah nah bat man!
Brian
@sludge256
Apr 06 2016 05:19 UTC
These guys need something productive to do.
rphares
@rphares
Apr 06 2016 05:19 UTC
lol
Elbert Cortez
@trip16661
Apr 06 2016 05:20 UTC
I'm going to catch them all then @sludge256
Brian
@sludge256
Apr 06 2016 05:20 UTC
The Casual room could use some loving also.
Emil Aasa
@emilaasa
Apr 06 2016 05:24 UTC
Someone could explain how I embed fancy formatted github gists into my page!
Nevermind there was an embed button on the page! :D
Brian
@sludge256
Apr 06 2016 05:26 UTC
:+1: Glad to be of service.
Emil Aasa
@emilaasa
Apr 06 2016 05:26 UTC
Rubber chatroom debugging
Can't count the number of questions I've almost asked, only to google the actual string I'm typing into the chat window instead and find the answer at once.
Brian
@sludge256
Apr 06 2016 05:28 UTC
I was going to say look for an embed button/link but you beat me to it.
Justin
@daemedeor
Apr 06 2016 05:29 UTC
@emilaasa thats how googling works
once you get good enough, you just google your phrase
Emil Aasa
@emilaasa
Apr 06 2016 05:29 UTC
Yep!
Okay someone could help me check some JS understanding.
A closure is only a function within a function right_
That has access to the enclosing functions variables?
Justin
@daemedeor
Apr 06 2016 05:31 UTC
@emilaasa nah
@emilaasa its a way for variables to talk over functions!
okay i guess you’re right
:)
Emil Aasa
@emilaasa
Apr 06 2016 05:31 UTC
lol
xD
Markus Kiili
@Masd925
Apr 06 2016 05:31 UTC
@emilaasa In JS, when you return a function, you actually return a closure. The function retains connection to variables at outer scope it had access to.
Emil Aasa
@emilaasa
Apr 06 2016 05:32 UTC
Okay so it has access to the scope chain that was in effect when it was created?
Justin
@daemedeor
Apr 06 2016 05:33 UTC
okay
Markus Kiili
@Masd925
Apr 06 2016 05:33 UTC
@emilaasa Yes.
Chuck Adams
@chuckadams
Apr 06 2016 05:34 UTC
it retains a copy of the scope, which is the important part
Brian
@BrianCodes33
Apr 06 2016 05:34 UTC
Can someone help me understand 'this'
Chuck Adams
@chuckadams
Apr 06 2016 05:34 UTC
except for globals, which don't obey any of that
Emil Aasa
@emilaasa
Apr 06 2016 05:34 UTC
Only the references tho right?
Brian
@BrianCodes33
Apr 06 2016 05:35 UTC
  $listItems.on('mouseover click', function() {
    ids = this.id;
    $listItems.children('span').remove();
    $(this).append(' <span class="priority">' + ids + '</span>');
  });
Chuck Adams
@chuckadams
Apr 06 2016 05:35 UTC
right, anytime i say "copy" assume shallow copy
Emil Aasa
@emilaasa
Apr 06 2016 05:35 UTC
Cool!
thanks @chuckadams @Masd925 @daemedeor and @sludge256 =)
CamperBot
@camperbot
Apr 06 2016 05:36 UTC
emilaasa sends brownie points to @chuckadams and @masd925 and @daemedeor and @sludge256 :sparkles: :thumbsup: :sparkles:
:star: 1309 | @masd925 | http://www.freecodecamp.com/masd925
Emil Aasa
@emilaasa
Apr 06 2016 05:36 UTC
POINTS FOR ALL
wooohooo
CamperBot
@camperbot
Apr 06 2016 05:36 UTC
:star: 2100 | @sludge256 | http://www.freecodecamp.com/sludge256
:star: 415 | @chuckadams | http://www.freecodecamp.com/chuckadams
:star: 208 | @daemedeor | http://www.freecodecamp.com/daemedeor
Justin
@daemedeor
Apr 06 2016 05:36 UTC
@BrianCodes33 the easiest way is that it refers to the current context, in jquery the current element
Chuck Adams
@chuckadams
Apr 06 2016 05:36 UTC
as for 'this', it seems to be pretty darn magic
Elbert Cortez
@trip16661
Apr 06 2016 05:36 UTC
this is not a strip club and brownies are not 1$ dollar bills
Brian
@BrianCodes33
Apr 06 2016 05:37 UTC
well...this still confuses me
Chuck Adams
@chuckadams
Apr 06 2016 05:37 UTC
basically it's an object that gets created and bound by new
Elbert Cortez
@trip16661
Apr 06 2016 05:37 UTC
@daemedeor can i borrow your time a bit? xD
Justin
@daemedeor
Apr 06 2016 05:37 UTC
@trip16661 oh you may ;}
jkjk
what up?
@BrianCodes33 it confuses a lot of people…
Elbert Cortez
@trip16661
Apr 06 2016 05:38 UTC
i got this but i don't know how can use it
Brian
@BrianCodes33
Apr 06 2016 05:38 UTC
i wish there was a way to see the DOM being changed when i write code
it's a library
Chuck Adams
@chuckadams
Apr 06 2016 05:38 UTC
@BrianCodes33 there's browser extensions for that sort of thing
Brian
@BrianCodes33
Apr 06 2016 05:39 UTC
hah i dont know about it
Justin
@daemedeor
Apr 06 2016 05:39 UTC
@trip16661 after importing it, you pass in a string of XML to the first argument and “” for the second unless you indentation formatting
Eldar Tinjić
@EldarT90
Apr 06 2016 05:39 UTC
hey folks
Justin
@daemedeor
Apr 06 2016 05:39 UTC
@BrianCodes33 its called liveReload
Brian
@BrianCodes33
Apr 06 2016 05:39 UTC
this is inefficient
Eldar Tinjić
@EldarT90
Apr 06 2016 05:39 UTC
i need bit of help with js
Markus Kiili
@Masd925
Apr 06 2016 05:39 UTC
@chuckadams By the copy, you mean that when the function that returns the closure is run again, there is a new execution context and new variables?
Brian
@BrianCodes33
Apr 06 2016 05:39 UTC
'this' is inefficient
Chuck Adams
@chuckadams
Apr 06 2016 05:39 UTC
@Masd925 exactly
Justin
@daemedeor
Apr 06 2016 05:40 UTC
@BrianCodes33 this is great! you just have to follow scope… but in es2015, (the newest edition) this gets a facelift
Eldar Tinjić
@EldarT90
Apr 06 2016 05:40 UTC
tast stand in line, asks me to remove 1 item from array and return it ; i have a solution that works for 3 out of 4 "checking tasks"
Elbert Cortez
@trip16661
Apr 06 2016 05:40 UTC
can u show me how would you do it with a fake hipotetical xml api ?
if it don't take too long
Eldar Tinjić
@EldarT90
Apr 06 2016 05:40 UTC
queue([], 1) should return 1 - NOT done
queue([2], 1) should return 2 - DONE
queue([5,6,7,8,9], 1) should return 5 - DONE
After queue(testArr, 10), testArr[4] should be 10 - DONE
Elbert Cortez
@trip16661
Apr 06 2016 05:40 UTC
and i'm sorry for asking you think i just didn't get what you said xD
Eldar Tinjić
@EldarT90
Apr 06 2016 05:40 UTC
how can i display "empty queue"
Brian
@BrianCodes33
Apr 06 2016 05:41 UTC
@daemedeor why cant i just say id.append(code...)- why do i need a variable to store this.id. it confuses everything
Justin
@daemedeor
Apr 06 2016 05:41 UTC
xml2json(“<parent><child></child></parent”,””) -> { parent : child; }
@BrianCodes33 just to make it readable
Brian
@BrianCodes33
Apr 06 2016 05:41 UTC
its not readable @daemedeor
Justin
@daemedeor
Apr 06 2016 05:41 UTC
@BrianCodes33 well understandable
for human coders to know what this.id means
Elbert Cortez
@trip16661
Apr 06 2016 05:42 UTC
oh so you basically write what elements you want to change and how you want it to look after
Brian
@BrianCodes33
Apr 06 2016 05:42 UTC
there should be a language that already stores all html elements in variables so i dont have to rewrite them in JS
Justin
@daemedeor
Apr 06 2016 05:42 UTC
@trip16661 well i’m hoping you’re not writing xml by hand
Brian
@sludge256
Apr 06 2016 05:42 UTC
@EldarT90 push before you shift
Elbert Cortez
@trip16661
Apr 06 2016 05:43 UTC
what's this part ”” after the comma
what do you mean by not writing by hand?
Justin
@daemedeor
Apr 06 2016 05:43 UTC
@trip16661 the second argument, defines the number of spaces for indentations, the json comes out by string
Brian
@BrianCodes33
Apr 06 2016 05:43 UTC
oh no someone is going to steal by brilliant ide
idea
Justin
@daemedeor
Apr 06 2016 05:44 UTC
I THINK you can use JSON.parse() or something similar to do
Brian
@BrianCodes33
Apr 06 2016 05:44 UTC
and make millions
Justin
@daemedeor
Apr 06 2016 05:44 UTC
@BrianCodes33 i doubt it, that seems very verbose and heavy
Emil Aasa
@emilaasa
Apr 06 2016 05:44 UTC
It's already a markup language @BrianCodes33 :)
How much more terse do you want it to be?
Eldar Tinjić
@EldarT90
Apr 06 2016 05:44 UTC
@sludge256 thanks that worked
CamperBot
@camperbot
Apr 06 2016 05:44 UTC
eldart90 sends brownie points to @sludge256 :sparkles: :thumbsup: :sparkles:
:star: 2101 | @sludge256 | http://www.freecodecamp.com/sludge256
Justin
@daemedeor
Apr 06 2016 05:45 UTC
besides webassembly will probably eclipse js at some point… maybe in 7 years but still
Eldar Tinjić
@EldarT90
Apr 06 2016 05:45 UTC
@sludge256 and it also makes sense
Emil Aasa
@emilaasa
Apr 06 2016 05:45 UTC
@daemedeor Wont webassembly be a compilation target?
rather than a language
that people write crud apps in
Brian
@BrianCodes33
Apr 06 2016 05:45 UTC
@emilaasa @daemedeor if id's and classes can already be variables we could just be writing functions and using the html in our JS without creating all these variables
Justin
@daemedeor
Apr 06 2016 05:45 UTC
@emilaasa still a language ;) like haxe
Chuck Adams
@chuckadams
Apr 06 2016 05:45 UTC
perhaps he refers to "arbitrary languages targeting webassembly"
which would be nice, but i think JS has staying power for another decade at least
Justin
@daemedeor
Apr 06 2016 05:46 UTC
@BrianCodes33 well that memory though
Brian
@BrianCodes33
Apr 06 2016 05:46 UTC
there has to be a way, its 2016
Justin
@daemedeor
Apr 06 2016 05:46 UTC
@chuckadams errr possibly we’ll see how it plays out, i’m more excited for AR anyway
Emil Aasa
@emilaasa
Apr 06 2016 05:47 UTC
Seems like JS will be the C of web for a loooHohOhohoooooooong time tho
Justin
@daemedeor
Apr 06 2016 05:47 UTC
@BrianCodes33 its doable, but still memory intensive… people are complaing about chromes’ footprint and its not even doing half of that
btw… you can access the entire document structure by hand
its a pain but doable
document cough
it’ll also likely slow down the rendering of the page
to a point
Chuck Adams
@chuckadams
Apr 06 2016 05:49 UTC
as it is, there's lots of good languages that can compile to js. just not a lot of them support the browser interfaces to make them interesting client-side
and on server side, you may as well just run the native target
Brian
@BrianCodes33
Apr 06 2016 05:50 UTC
instead of saying var listItems = 'li';
you can just say <li listItems></li> or something like that.
Emil Aasa
@emilaasa
Apr 06 2016 05:50 UTC
Yeah. And also JS is not a bad language either.
Chuck Adams
@chuckadams
Apr 06 2016 05:50 UTC
weeeellll, there are certainly worse
Justin
@daemedeor
Apr 06 2016 05:50 UTC
@BrianCodes33 i wouldn’t do that either
@chuckadams PHP?
:D
Chuck Adams
@chuckadams
Apr 06 2016 05:50 UTC
it does have more than its share of warts, some that can't ever be fixed
and PHP ... it's made of warts
Emil Aasa
@emilaasa
Apr 06 2016 05:51 UTC
I use TypeScript and a transpiler so the gentlemen at microsoft sort of steer me clear of most of the warts.
Justin
@daemedeor
Apr 06 2016 05:51 UTC
i’m used to vanilla JS get out of here emilaasa #jokes
Brian
@BrianCodes33
Apr 06 2016 05:51 UTC
why not create one language that does everything? a lot simpler and faster. there is too much out there.
Chuck Adams
@chuckadams
Apr 06 2016 05:51 UTC
@BrianCodes33 because it would be the Homermobile of languages
Justin
@daemedeor
Apr 06 2016 05:51 UTC
@BrianCodes33 simpler and faster… those words don’t work together in programming all the time
Emil Aasa
@emilaasa
Apr 06 2016 05:52 UTC
@BrianCodes33 Go go assembler time for you
Justin
@daemedeor
Apr 06 2016 05:52 UTC
besides thats what languages get created for… and then adds to another language pile
Emil Aasa
@emilaasa
Apr 06 2016 05:52 UTC
Then you will appreciate different language doing different things
Brian
@sludge256
Apr 06 2016 05:52 UTC
Jack of all trades, master of none.
Chuck Adams
@chuckadams
Apr 06 2016 05:52 UTC
what a language doesn't let you do is often more important than what it does
take haskell for a somewhat extreme case
Emil Aasa
@emilaasa
Apr 06 2016 05:53 UTC
love me some haskell!
@chuckadams have you played with elm anything?
Brian
@BrianCodes33
Apr 06 2016 05:53 UTC
$listItems.on('mouseover click', function() { ids = this.id; $listItems.children('span').remove(); $(this).append(' <span class="priority">' + ids + '</span>'); }); why is ids = this.id???
Justin
@daemedeor
Apr 06 2016 05:54 UTC
@BrianCodes33 because whomever coded that was unimaginative using that as a variable name
in fact they made it a global variable
they made it wors
e
Chuck Adams
@chuckadams
Apr 06 2016 05:54 UTC
@emilaasa elm? dunno what that is other than a really old-skool mail client :)
Brian
@BrianCodes33
Apr 06 2016 05:54 UTC
var ids = '';
  var $listItems = $('li');

  $listItems.on('mouseover click', function() {
    ids = this.id;
    $listItems.children('span').remove();
    $(this).append(' <span class="priority">' + ids + '</span>');
  });

  $listItems.on('mouseout', function() {
    $(this).children('span').remove();
  });
});
Justin
@daemedeor
Apr 06 2016 05:55 UTC
i still maintain its a global variable
Brian
@BrianCodes33
Apr 06 2016 05:55 UTC
its local
Justin
@daemedeor
Apr 06 2016 05:55 UTC
only partly
Brian
@BrianCodes33
Apr 06 2016 05:55 UTC
inside the IIFE
Justin
@daemedeor
Apr 06 2016 05:55 UTC
based on this code snippet
Emil Aasa
@emilaasa
Apr 06 2016 05:55 UTC
@chuckadams elm-lang.org
striclty functional haskell-like language that complies to js
super fun to write stuff in!
Justin
@daemedeor
Apr 06 2016 05:56 UTC
there was absolutely no reason to do that though @BrianCodes33 and since it uses ids in exactly one place
not local
it’d be local if it were inside the function
Brian
@BrianCodes33
Apr 06 2016 05:56 UTC
can you elaborate
Justin
@daemedeor
Apr 06 2016 05:57 UTC
do you see it being used in any place? so they used a closure for absolutely no reason
Chuck Adams
@chuckadams
Apr 06 2016 05:57 UTC
@emilaasa since ghc compiles to js, i could always use that :)
Brian
@BrianCodes33
Apr 06 2016 05:57 UTC
?
Emil Aasa
@emilaasa
Apr 06 2016 05:57 UTC
@chuckadams :>
Justin
@daemedeor
Apr 06 2016 05:58 UTC
@BrianCodes33 typically you use that pattern if you need to access it somewhere else… but its not even being used anywhere else
Chuck Adams
@chuckadams
Apr 06 2016 05:58 UTC
@emilaasa though it's Idris that tickles my interest the most now
Brian
@BrianCodes33
Apr 06 2016 05:58 UTC
i got this code from a javascript book i paid almost $40 for
Justin
@daemedeor
Apr 06 2016 05:58 UTC
that doesn’t mean the code was good
Brian
@BrianCodes33
Apr 06 2016 05:58 UTC
i think they are just trying to show the power of this
Justin
@daemedeor
Apr 06 2016 05:58 UTC
if they were trying to show something, they succeeded in showing that its horrible code
still should’ve put the var declaration inside that anonomous function
Emil Aasa
@emilaasa
Apr 06 2016 05:59 UTC
@chuckadams dependent types eh
Justin
@daemedeor
Apr 06 2016 05:59 UTC
should’ve named the ids to something more semantic
even CurrentID is better
or lastCalledID
Chuck Adams
@chuckadams
Apr 06 2016 06:00 UTC
@emilaasa i'm told they're pretty powerful stuff, though i lack the imagination to know how to use them. mostly i'm psyched by the fact that it's strict.
Justin
@daemedeor
Apr 06 2016 06:00 UTC
okay, so its not the worst code but i wouldn’t herald it as the most semantic
Chuck Adams
@chuckadams
Apr 06 2016 06:01 UTC
haskell's laziness has always been nifty, but space leaks are maddening
Emil Aasa
@emilaasa
Apr 06 2016 06:01 UTC
Hmm, how is Idris not lazy then?
(I know nothing about Idris)
Justin
@daemedeor
Apr 06 2016 06:02 UTC
python space!
Chuck Adams
@chuckadams
Apr 06 2016 06:02 UTC
that's about all i know about it, it's strict and has dependent types
Emil Aasa
@emilaasa
Apr 06 2016 06:02 UTC
So you mean it has eager eval instead of lazy?
Chuck Adams
@chuckadams
Apr 06 2016 06:02 UTC
right, like ML
(or most everything else)
Emil Aasa
@emilaasa
Apr 06 2016 06:03 UTC
Isn't that like the bane of the front end asynchronous junkie programmer tho?
Chuck Adams
@chuckadams
Apr 06 2016 06:03 UTC
has nothing to do with async
though i guess async lends itself to lazy
Emil Aasa
@emilaasa
Apr 06 2016 06:04 UTC
I had the impression that the lazyness sort of plays well with async
If for nothing else than performance
Chuck Adams
@chuckadams
Apr 06 2016 06:04 UTC
eh, performance is limited by way more mundane stuff
Emil Aasa
@emilaasa
Apr 06 2016 06:04 UTC
But I honestly don't know enough
I will say it's nice to read an eager eval piece of code and sort of follow it along
Chuck Adams
@chuckadams
Apr 06 2016 06:05 UTC
but yeah you can write async code with a sync feel to it when you have pervasive laziness. but you can get that benefit using stuff like generators, you don't need laziness at every level
Elbert Cortez
@trip16661
Apr 06 2016 06:05 UTC

$(document).ready(function() {
var api = "http://www.stands4.com/services/v2/quotes.php?uid=5004&tokenid=LQT1R9DoNwzUYS1O";
var apiAuthor = "&searchtype=AUTHOR&query= ";
  $("#submit").on("click", function() {
    apiAuthor += $("#author").val();
    var apiLink = api + apiAuthor;
   $.get("apiAuthor",function (xml) {
       var jsonApi = $.xml2json(xml,"");
       alert(jsonApi);

   });

  });
});
did i do anything wrong? D:
Chuck Adams
@chuckadams
Apr 06 2016 06:06 UTC
JS is finally getting on that train with ES6 Promises. be nice to see node switch, no more Callback Pyramids Of Doom
something scala frameworks had figured out years before
Emil Aasa
@emilaasa
Apr 06 2016 06:06 UTC
@chuckadams Yeah and due to all the compiler optimizations etc I guess the pure lazy / pure eager divide isn't as clear
When it comes to how it actually runs
Chuck Adams
@chuckadams
Apr 06 2016 06:07 UTC
yah ghc aggressively tries to make things strict behind the scenes when it knows it can get away with it
Justin
@daemedeor
Apr 06 2016 06:08 UTC
@chuckadams if you wrote it right you don’t have to worry about callback hell
Matthew Kenneth McMasters
@mkmcmast
Apr 06 2016 06:08 UTC

I'm working on the Map the Debris problem and my solution prints out the correct answer (so I think) but i can't get it to pass. The first test will pass but the second will not. What am I missing here.. ```
var answer = [];
function orbitalPeriod(arr) {
var GM = 398600.4418;
var earthRadius = 6367.4447;
var a = earthRadius + arr[0].avgAlt;

var orbit = Math.round(2 Math.PI Math.sqrt(Math.pow(a,3)/GM));
answer.push({name:arr[0].name, orbitalPeriod: orbit});
arr.splice(0,1);
if(arr.length > 0) {
orbitalPeriod(arr);
}
return answer;
}

orbitalPeriod([{name: "iss", avgAlt: 413.6}, {name: "hubble", avgAlt: 556.7}, {name: "moon", avgAlt: 378632.553}]);
```

Chuck Adams
@chuckadams
Apr 06 2016 06:08 UTC
unfortunately it's not psychic, so there's only so much it can do
Justin
@daemedeor
Apr 06 2016 06:09 UTC
@trip16661 that can’t be your url you’re sending right?
Markus Kiili
@Masd925
Apr 06 2016 06:09 UTC
@mkmcmast Variables need to be declared inside functions in FCC. So FCC can test properly.
Chuck Adams
@chuckadams
Apr 06 2016 06:09 UTC
@daemedeor using a promise framework like q or ES6 is one way of writing it right
Justin
@daemedeor
Apr 06 2016 06:09 UTC
@trip16661 you should do $.get(apilink,
@chuckadams fair enough
Emil Aasa
@emilaasa
Apr 06 2016 06:10 UTC
Well nice chatting to you all, now I have to get some work done =) glhf everyone
Elbert Cortez
@trip16661
Apr 06 2016 06:10 UTC
y but it's still not working
kadeekberg
@kadeekberg
Apr 06 2016 06:11 UTC
need help converting celsius to fahrenheit and I can't get the convert statements to work
Justin
@daemedeor
Apr 06 2016 06:11 UTC
@trip16661 you also have an extra space in your url
@trip16661 &query= see the extra spac
Matthew Kenneth McMasters
@mkmcmast
Apr 06 2016 06:12 UTC
@Masd925 Ah I see. So does that mean I need to do this another way?
Justin
@daemedeor
Apr 06 2016 06:12 UTC
and you also modify apiAuthor…. every time
Elbert Cortez
@trip16661
Apr 06 2016 06:12 UTC
I did that cuz for some reason when i tried to add something after query= it deletes the = from it
Markus Kiili
@Masd925
Apr 06 2016 06:13 UTC
@mkmcmast Does it work if you just declare it inside the function?
Justin
@daemedeor
Apr 06 2016 06:13 UTC
@trip16661 i can’t speak to your experience, just what your code says :)
Elbert Cortez
@trip16661
Apr 06 2016 06:14 UTC
:P ye i know
Matthew Kenneth McMasters
@mkmcmast
Apr 06 2016 06:14 UTC
@Masd925 No I think it keeps emptying the answer variable when it runs through.
Markus Kiili
@Masd925
Apr 06 2016 06:16 UTC
@mkmcmast You can always make a wrapper function that calls your code on inner function.
Justin
@daemedeor
Apr 06 2016 06:16 UTC
@trip16661 gasp you still have it strung
Elbert Cortez
@trip16661
Apr 06 2016 06:16 UTC
what?
Justin
@daemedeor
Apr 06 2016 06:17 UTC
apiLink
Matthew Kenneth McMasters
@mkmcmast
Apr 06 2016 06:17 UTC
@Masd925 Oh you're right I'll try that. thanks
CamperBot
@camperbot
Apr 06 2016 06:17 UTC
mkmcmast sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star: 1310 | @masd925 | http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
Apr 06 2016 06:18 UTC
@mkmcmast I think I used array map method for that exercise.
Elbert Cortez
@trip16661
Apr 06 2016 06:18 UTC
I changed it but still xD
Justin
@daemedeor
Apr 06 2016 06:19 UTC
@trip16661 i’ll PM you the deets, please thank me in here ;)
<