These are chat archives for FreeCodeCamp/HelpJavaScript

10th
Aug 2016
alhajit21
@alhajit21
Aug 10 2016 00:00
im getting stuck on accessing nested objects // my code var gloveBoxContents = myStorage.inside["car"].glove box
Moisés Man
@moigithub
Aug 10 2016 00:00
@alhajit21 glove box contain space.. u cant use dot notation
Stephen James
@sjames1958gm
Aug 10 2016 00:01
@alhajit21 Also I think car should be before inside?
alhajit21
@alhajit21
Aug 10 2016 00:03
like this. var gloveBoxContents = myStorage.car["inside glove box"];
CamperBot
@camperbot
Aug 10 2016 00:03
no wiki entry for: me im stuckhttpswwwfreecodecampcomchallengesmake-object-properties-privatesolution0avar20car203d20function207b0a20202f2f20this20is20a20private20variable0a2020var20speed203d20103b0a0a20202f2f20these20are20public20methods0a2020thisaccelerate203d20functionchange207b0a20202020speed202b3d20change3b0a20207d3b0a0a2020thisdecelerate203d20function207b0a20202020speed20-3d2053b0a20207d3b0a0a2020thisgetspeed203d20function207b0a20202020return20speed3b0a20207d3b0a7d3b0a0avar20bike203d20function207b0a2020var20gear203d20103b202f2fpriave20property0a0a20202f2f20only20change20code20below20this20line0a2020thisaccelerate203d20function207b0a20202020getgear203d2013b0a20207d3b0a20200a2020thisgetgear203d20function7b0a20202020return20gear3b0a20207d3b0a2020thissetgear20203d20function7b0a20202020return20gear3b0a20207d3b0a0a2020thisdecelerate203d20function207b0a202020setgear20203d2013b0a202020200a202020200a20207d3b0a0a200a0a7d3b0a0avar20mycar203d20new20car3b0a0avar20mybike203d20new20bike3b0amybike203d20function7b0a2020thisgetgear203d20function7b0a20202020return2043b0a20207d3b0a7d3b0a
Vikrant Singh
@VikrantSingh13
Aug 10 2016 00:04
@duonganh169 name of challenge? and copy paste what you have done so far
Norvin Burrus
@ndburrus
Aug 10 2016 00:05
@alhajit21 this may be helpful: :sparkles:
Diego Mayer
@Chrono79
Aug 10 2016 00:05
@alhajit21 why 2 properties inside the same brackets?
alhajit21
@alhajit21
Aug 10 2016 00:05
because glove box
Vikrant Singh
@VikrantSingh13
Aug 10 2016 00:06
@alhajit21 what's the name of the challenge?
Diego Mayer
@Chrono79
Aug 10 2016 00:06
@alhajit21 inside is one and glove box the other
Stephen James
@sjames1958gm
Aug 10 2016 00:06
@alhajit21 "inside glove box" is one property name because it is a string.
alhajit21
@alhajit21
Aug 10 2016 00:06
accessing nested objects @VikrantSingh13
Ademola Adegbuyi
@ooade
Aug 10 2016 00:07
@duonganh169 remove this, then ask me how to solve each of em
myBike = function(){
  this.getGear = function(){
    return 4;
  };
};
Stephen James
@sjames1958gm
Aug 10 2016 00:07
@duonganh169 setGear needs a parameter and should be setting the gear value
Vikrant Singh
@VikrantSingh13
Aug 10 2016 00:08
@alhajit21 var gloveBoxContents = myStorage.car.inside['glove box'];
Nicholas Vorraso
@nickeyvee
Aug 10 2016 00:09
can someone please tell me what a boolean primitive is in plain english?!? In my research i haven't found an explanation that i can understand.
Vikrant Singh
@VikrantSingh13
Aug 10 2016 00:09
@alhajit21 I think you should review hierarchy and different notations for accessing JSON
Stephen James
@sjames1958gm
Aug 10 2016 00:09
@nickeyvee There are only two true and false
alhajit21
@alhajit21
Aug 10 2016 00:09
@VikrantSingh13 thanks I just found out before you posted
CamperBot
@camperbot
Aug 10 2016 00:09
alhajit21 sends brownie points to @vikrantsingh13 :sparkles: :thumbsup: :sparkles:
:cookie: 304 | @vikrantsingh13 |http://www.freecodecamp.com/vikrantsingh13
Vikrant Singh
@VikrantSingh13
Aug 10 2016 00:11
@nickeyvee boolean primitives are the boolean values: true and false
Nicholas Vorraso
@nickeyvee
Aug 10 2016 00:13
@sjames1958gm ok let me explain, I'm on the exercise "falsy bouncer" I must return an array without "falsy values" : false, null, 0, "", undefined, and NaN.
Promise Tochi
@Promhize
Aug 10 2016 00:16
rewriting my solutions in es6 , and it is awesome
/* jshint esversion: 6 */
function largestOfFour(arr) {
    return arr.map((a,b) => Math.max(...a));
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Vikrant Singh
@VikrantSingh13
Aug 10 2016 00:18
@nickeyvee are you stuck on it?
Diego Mayer
@Chrono79
Aug 10 2016 00:18

@Promhize

const largestOfFour = arr => arr.map(a => Math.max(...a)); //you don't need the b in map

More ES6 for you

Norvin Burrus
@ndburrus
Aug 10 2016 00:18

@nickeyvee
Boolean

new Boolean([value])
The value passed as the first parameter is converted to a boolean value, if necessary. If value is omitted or is 0, -0, null, false, NaN, undefined...

Ademola Adegbuyi
@ooade
Aug 10 2016 00:19
ES6 dudes :wink:
Vikrant Singh
@VikrantSingh13
Aug 10 2016 00:19
hehe
Chovin
@Chovin
Aug 10 2016 00:21
when doing ajax calls asynchronously do multiple requests go out before 1 response is returned?
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:22

var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
answer = "5 bet";
break;

}

// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

I wanted the case sequence 2,3,4,5,6, to return to "5 bet". what did I do wrong?
Chovin
@Chovin
Aug 10 2016 00:22
or does it just do the calls linearly when it's not busy?
Diego Mayer
@Chrono79
Aug 10 2016 00:23
@pelicanscarecrow your function doesn't return, but in any case that's not what the challenge asks, you have to change count value in there
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:23
it does ask to return doesnt it?
Ademola Adegbuyi
@ooade
Aug 10 2016 00:24

@nickeyvee you can check for false valid using this: !!value returns the boolean value
let's say

!![] //returns true
!!0 //returns false
!!'' //returns false

And so on, just pass it to Array.filter n you're done.

Diego Mayer
@Chrono79
Aug 10 2016 00:24
yes, just not there @pelicanscarecrow
Chovin
@Chovin
Aug 10 2016 00:24
yeah, I don't think he understands anything you're saying @marhyorh
Stephen James
@sjames1958gm
Aug 10 2016 00:24
@pelicanscarecrow You are still not changing count base on the card value.
llamatarianism
@llamatarianism
Aug 10 2016 00:25
@marhyorh that's not what syntactic sugar is
Ademola Adegbuyi
@ooade
Aug 10 2016 00:25
@llamatarianism Oh yeah!
llamatarianism
@llamatarianism
Aug 10 2016 00:26
syntactic sugar is a way of doing something that is exactly the same as some other way, but looks prettier
like, for example,
Ademola Adegbuyi
@ooade
Aug 10 2016 00:26
+"32423"
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:26
@sjames1958gm how would I change the count base on the card value?
llamatarianism
@llamatarianism
Aug 10 2016 00:26
x => x + 1
is sugar for
function(x) {
  return x + 1;
}
Stephen James
@sjames1958gm
Aug 10 2016 00:26
@pelicanscarecrow count ++ in your case statement?
llamatarianism
@llamatarianism
Aug 10 2016 00:26
Boolean(x) isn't the exact same as !!x
!!x is just applying the ! operator to it twice, which also happens to convert it to a boolean
Ademola Adegbuyi
@ooade
Aug 10 2016 00:27
Ok. Thanks @llamatarianism
CamperBot
@camperbot
Aug 10 2016 00:27
marhyorh sends brownie points to @llamatarianism :sparkles: :thumbsup: :sparkles:
:star2: 1156 | @llamatarianism |http://www.freecodecamp.com/llamatarianism
llamatarianism
@llamatarianism
Aug 10 2016 00:27
+"123" also technically isn't sugar for Number("123")
+ is just a unary operator that makes numbers positive
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:27
So I would put case 2: count ++?
llamatarianism
@llamatarianism
Aug 10 2016 00:27
it also happens to coerce stuff to numbers
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:28
I apologize, I am having a hard time on this challenge. @sjames1958gm
Stephen James
@sjames1958gm
Aug 10 2016 00:28
@pelicanscarecrow Instead of your answer = "5 Bet"
@pelicanscarecrow No problem, let's work through it.
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:28

var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count ++;
break;

}

// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

Close to that?
Chovin
@Chovin
Aug 10 2016 00:28
explain to us what your code does
CamperBot
@camperbot
Aug 10 2016 00:28
no wiki entry for: to us what your code does
Chovin
@Chovin
Aug 10 2016 00:28
lol
Ademola Adegbuyi
@ooade
Aug 10 2016 00:28
@llamatarianism i saw that somewhere. They did poison my mind on that one. Thought it was a syntax sugar :worried:
Stephen James
@sjames1958gm
Aug 10 2016 00:29
@pelicanscarecrow See the table to the left? You have satisfied the first row of the table.
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:29
Right, so 2,3,4,5,6 have to count 1.
Stephen James
@sjames1958gm
Aug 10 2016 00:29
@pelicanscarecrow Now you can do the same for the other two rows (hint : since the middle row doesn't change count it can be left out).
@pelicanscarecrow Right so if you called the function with 2, then 3, 4, 5, 6 count would be 5 (there is your 5 in the 5 Bet)
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:30
@sjames1958gm what I do not understand is what do I code after all my case statements?
Stephen James
@sjames1958gm
Aug 10 2016 00:31
@pelicanscarecrow The function will then return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative. The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
you test count according to these instructions.
Diego Mayer
@Chrono79
Aug 10 2016 00:31
@pelicanscarecrow you evaluate count value in a separate block (note the if in the text james pasted above)
Stephen James
@sjames1958gm
Aug 10 2016 00:32
@pelicanscarecrow Pick out the key phrases. if the count is positive and if the count is zero or negative
Shu1k
@Shu1k
Aug 10 2016 00:32
whats wrong with this ---------> function testSize(num) {
// Only change code below this line
if (num<5) { return "Tiny"; } else if (num < 10) { return "Small"; } else if (num < 15) { return "Medium"; } else if (num < 20);{ return "Large"; } else if (num >= 20); {
return "Huge";
}
else {
return "Change Me";
// Only change code above this line
}
Chovin
@Chovin
Aug 10 2016 00:33
you didn't "Change Me" for one?
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:33
Okay, so once I put this: // Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count ++;
break;
Chovin
@Chovin
Aug 10 2016 00:33
please please
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:33
I just do the same for the others?
Chovin
@Chovin
Aug 10 2016 00:33
help format
CamperBot
@camperbot
Aug 10 2016 00:33

: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 thecode`.

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

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

Diego Mayer
@Chrono79
Aug 10 2016 00:33
@Shu1k are all your curly braces paired?
Shu1k
@Shu1k
Aug 10 2016 00:34
pretty sure @Chrono79
Stephen James
@sjames1958gm
Aug 10 2016 00:34
@pelicanscarecrow Yes.
Shu1k
@Shu1k
Aug 10 2016 00:34
function testSize(num) {
// Only change code below this line
if (num<5) { return "Tiny"; } else if (num < 10) { return "Small"; } else if (num < 15) { return "Medium"; } else if (num < 20);{ return "Large"; } else if (num >= 20); {
return "Huge";
}
Stephen James
@sjames1958gm
Aug 10 2016 00:34
@Shu1k There is an extra semicolon after (num < 20) and (num >= 20)
Chovin
@Chovin
Aug 10 2016 00:35
if you format your code nicely, you will more easily find errors like that
Shu1k
@Shu1k
Aug 10 2016 00:35
@sjames1958gm thank you
CamperBot
@camperbot
Aug 10 2016 00:35
shu1k sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2462 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:38

var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count ++;
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count --;
break;

}

// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

This is what I have done. Unfortunately no check mark has been fulfilled.
Stephen James
@sjames1958gm
Aug 10 2016 00:38
@pelicanscarecrow Now fulfill the text instructions.
beline
@beline2005
Aug 10 2016 00:39

Mutations

function mutation(arr) {
var str1 = arrxamarin/xamarin-android@a16673d.toString().toLowerCase();
var str2 = arr1.toString().toLowerCase();
//return str1.indexOf(str2xamarin/xamarin-android#147);
//return str1.charAt(0);
for (var i=0;i<str2.length;i++){

if (str1.indexOf(str2.charAt(i))==-1){
  return false;
}
return true;

}

//var strr = str.charAt(0);

return strr;
}

mutation(["hello", "hey"]);

function mutation(arr) {
var str1 = arrxamarin/xamarin-android@a16673d.toString().toLowerCase();
var str2 = arr1.toString().toLowerCase();
//return str1.indexOf(str2xamarin/xamarin-android#147);
//return str1.charAt(0);
for (var i=0;i<str2.length;i++){

if (str1.indexOf(str2.charAt(i))==-1){
  return false;
}
return true;

}

//var strr = str.charAt(0);

return strr;
}

mutation(["hello", "hey"]);

Joseph
@revisualize
Aug 10 2016 00:40
help format
CamperBot
@camperbot
Aug 10 2016 00:40

: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 thecode`.

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

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

Leeia Isabelle
@Leeiaisabelle
Aug 10 2016 00:40
Hey guys! Anyone care to help me with "Selecting from many options with Switch Statements"?
beline
@beline2005
Aug 10 2016 00:40
"hello", "hey" returns true

'''
function mutation(arr) {
var str1 = arrxamarin/xamarin-android@a16673d.toString().toLowerCase();
var str2 = arr1.toString().toLowerCase();
//return str1.indexOf(str2[2]);
//return str1.charAt(0);
for (var i=0;i<str2.length;i++){

if (str1.indexOf(str2.charAt(i))==-1){
  return false;
}
return true;

}

//var strr = str.charAt(0);

return strr;
}

mutation(["hello", "hey"]);

CamperBot
@camperbot
Aug 10 2016 00:41
:bulb: to format code use backticks! ``` more info
Joseph
@revisualize
Aug 10 2016 00:41
```js [SHIFT+ENTER]
// your code here
```[CTRL+ENTER or CMD+ENTER to send]
Please do not confuse `s with 's.
Also note that the ```s need to each be on their own lines
The ` key can usually be found on most keyboards up next to the 1 key.
If you hit SHIFT+` it will give you the ~.
Example:
```
code
```
beline
@beline2005
Aug 10 2016 00:41
Sorry I'm trying.
Let me try again.
Joseph
@revisualize
Aug 10 2016 00:41
Try small not big.
Once you learn small do big.
Shu1k
@Shu1k
Aug 10 2016 00:42
whats wrong here -----------> function golfScore(par, strokes) {
// Only change code below this line
if (stroke==1) {
return "Hole=in-one!";
}
else if (strokes<= par -2) {
return "Eagle";
}
else if (strokes==par-1) {
return"Birdie";
}
else if(strokes==par) {
return "Par";
}
else if (strokes==par +1) {
return "Bogey";
}
else if(strokes==par +2) {
return "Double Bogey";
}
else if(strokes>=par +3){
return "Go Home!";
}
else {
return "Change Me";
}
beline
@beline2005
Aug 10 2016 00:42
function mutation(arr) {
    var str1 = arr[0].toString().toLowerCase();
    var str2 = arr[1].toString().toLowerCase();
//return str1.indexOf(str2[2]);
  //return str1.charAt(0);
  for (var i=0;i<str2.length;i++){

    if (str1.indexOf(str2.charAt(i))==-1){
      return false;
    }
    return true;
  }


    //var strr = str.charAt(0);
  return strr;
}

mutation(["hello", "hey"]);
Joseph
@revisualize
Aug 10 2016 00:43
have you tried www.pythontutor.com ??
beline
@beline2005
Aug 10 2016 00:43
My code returns true when it should return false.
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:43

var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count ++;
answer ="Bet";
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count --;
answer= "Hold";
break;

}

my best judgement as of right now was to do this, but clearly I was wrong.
Joseph
@revisualize
Aug 10 2016 00:43
@pelicanscarecrow You need to be modifying the global count variable.
don't use an answer variable.
That you didn't even initialize.
You need an extra if statement AFTER the switch.
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:45
What would that look like?
Joseph
@revisualize
Aug 10 2016 00:45
What would an if statement look like?
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:45
if () {
return
Joseph
@revisualize
Aug 10 2016 00:45
That's an if statement!
You need a condition.
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:46
does anyone know how to solve the problem Multiple Identical Options in Switch Statements in JS?
I put the cases but I don't know which argument I should put on my switch
Joseph
@revisualize
Aug 10 2016 00:46
What?????
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:46

function sequentialSizes(val) {
var answer = "";
// Only change code below this line
switch (val) {
case 1:
case 2:
case 3:
result = "Low";
break;
case 4:
case 5:
case 6:
result = "Mid";
break;
case 4:
case 5:
case 6:
result = "High";
break;

}

Joseph
@revisualize
Aug 10 2016 00:47
@gabrielxucram That won't work.
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:47
why? :)
Joseph
@revisualize
Aug 10 2016 00:47
break; stops the switch.
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:47
but you are supposed to use it
you should use case 1 2 and 3 and give it the same return or result
and then break and move on to another chunk of cases
Diego Mayer
@Chrono79
Aug 10 2016 00:48
@revisualize is that the problem? I think the problem is he's using result instead of answer
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:48
right?
Joseph
@revisualize
Aug 10 2016 00:48
Yes. But, you have two sets of 4,5,6
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:48
oh crap. just noticed
Joseph
@revisualize
Aug 10 2016 00:48
YEAH!
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:48
still did not work
Joseph
@revisualize
Aug 10 2016 00:49
What???
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:49
is there a problem with my syntax?
Joseph
@revisualize
Aug 10 2016 00:49
Yes
Diego Mayer
@Chrono79
Aug 10 2016 00:49
@gabrielxucram
var answer = ""; <- use this var
bddgit
@bddgit
Aug 10 2016 00:50
find gear
CamperBot
@camperbot
Aug 10 2016 00:50
find gear
nothing found
bddgit
@bddgit
Aug 10 2016 00:50
find bddgit
CamperBot
@camperbot
Aug 10 2016 00:50
find bddgit
nothing found
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:50
@Chrono79 I have this on the top of my code
bddgit
@bddgit
Aug 10 2016 00:50
This message was deleted
CamperBot
@camperbot
Aug 10 2016 00:50
:cookie: 229 | @bddgit |http://www.freecodecamp.com/bddgit
Joseph
@revisualize
Aug 10 2016 00:50
You can't do this:
Diego Mayer
@Chrono79
Aug 10 2016 00:51
@gabrielxucram
  // Only change code above this line  
  return answer;   // not result
Stephen
@stephepush
Aug 10 2016 00:51
I need help with my code. I'm trying to make variables global but in trying to do that, i broke my apps functionality:
http://codepen.io/stephepush/pen/dXQKjW?editors=0010
Joseph
@revisualize
Aug 10 2016 00:52
switch (num) {
   case 1:
   case 2:
      name = "Joseph";
      break;
   case 1:
   case 2:
      name = "Gabriel";
      break;
}
Gabriel will NEVER get set.
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:53
Okay so after I closed off my switch with the curly brace. I would create an if statement?
Joseph
@revisualize
Aug 10 2016 00:53
yes
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:53

function sequentialSizes(val) {
var answer = "";
// Only change code below this line
switch (answer) {
case 1:
case 2:
case 3:
return = "Low";
break;
case 4:
case 5:
case 6:
return = "Mid";
break;
case 7:
case 8:
case 9:
return = "High";
break;

}

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

// Change this value to test
sequentialSizes(1);

Diego Mayer
@Chrono79
Aug 10 2016 00:53
@stephepush
var tweetQuote = data.quoteText + " " + data.quoteAuthor; data is undefined there
Joseph
@revisualize
Aug 10 2016 00:54
return is a keyword
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:54
oh I got it guys
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:54
so would I say
revisualize @revisualize leaves.
Diego Mayer
@Chrono79
Aug 10 2016 00:54
should I try saying don't use answer? @gabrielxucram ;)
Stephen James
@sjames1958gm
Aug 10 2016 00:54
@pelicanscarecrow Did you get it?
Stephen
@stephepush
Aug 10 2016 00:54
@Chrono79 , should I put the getJson object before the tweetquote variable?
Gabriel Xucram
@gabrielxucram
Aug 10 2016 00:54
thank you! it was a brain fart haha
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:55
@sjames1958gm i feel like im getting close but not quite
This is my first challenge of the day so I am a little rusty.
what would my if statement look like in this case?
Stephen James
@sjames1958gm
Aug 10 2016 00:55
@pelicanscarecrow The practice of reading the instructions and picking out key words and phrases if this or if that.
@pelicanscarecrow if the count is positive translate this into code if (count > 0)
Slimane
@slimane2015
Aug 10 2016 00:57

Hi, I'm struggling with the challenge "Accessing Objects Properties with Variables", that still give me an error message. That's my code: // Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;

var playerNumber = testObj[playerNumber]; // Change this Line
var player = testObj["16"]; // Change this Line

Diego Mayer
@Chrono79
Aug 10 2016 00:57
@stephepush why don't you put all the functionality of getting a new quote inside a function, and call that inside the click on newquote and on document.ready ?
Stephen
@stephepush
Aug 10 2016 00:57
indeed @Chrono79
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:58

var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count ++;
answer ="Bet";
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count --;
count="Hold";
break;}
if (count>o){
return "Bet";
}

// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

Does that look correct???
Stephen James
@sjames1958gm
Aug 10 2016 00:58
@slimane2015 Looking at the instructions.
Use the playerNumber variable to lookup player 16 so this says set the playerNumber to 16, then use that variable to look up in the object
Diego Mayer
@Chrono79
Aug 10 2016 00:58
@pelicanscarecrow no, is that an o instead of a zero?
Stephen James
@sjames1958gm
Aug 10 2016 00:58
@pelicanscarecrow Only change count in your case statement.
@pelicanscarecrow That looks like count is greater than the letter o??
Tyler Brown
@pelicanscarecrow
Aug 10 2016 00:59
@sjames1958gm okay so my if statement is completely wrong
It was and then I read it right after and changed it
Stephen James
@sjames1958gm
Aug 10 2016 01:00
@pelicanscarecrow It is closer than you think (assuming you replace zero for o)
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:00
@sjames1958gm well that is great news! I appreciate your help. Is my If statement incorrect?
Stephen James
@sjames1958gm
Aug 10 2016 01:00
@pelicanscarecrow Return the count plus the string.
@pelicanscarecrow count > 0 that is a zero
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:01
Okay, so if(count>0) is correct?
Stephen James
@sjames1958gm
Aug 10 2016 01:01
@pelicanscarecrow yes.
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:01
okay, but my return is incorrect I am assuming.
I just placed, "Bet"
Stephen James
@sjames1958gm
Aug 10 2016 01:02
@pelicanscarecrow Remember "5 Bet" from before - you need to return this string (but the 5 comes from count)
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:03
so I would put return count+bet??
This is such a hard challenge for me lol
Joseph
@revisualize
Aug 10 2016 01:03
You need a space
And a string has quotes
Stephen James
@sjames1958gm
Aug 10 2016 01:03
@pelicanscarecrow Yes, kind of, make sure Bet is in a string with a leading space.
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:04
Okay so now I put return "count + Bet";
Tica Alexandru Adrian
@LunyAlex
Aug 10 2016 01:04
This message was deleted
Joseph
@revisualize
Aug 10 2016 01:04
No
Stephen James
@sjames1958gm
Aug 10 2016 01:04
@pelicanscarecrow Count outside the string because it is a variable
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:04
Is Bet the string, and I am adding count to it?
Joseph
@revisualize
Aug 10 2016 01:04
Yes!
Stephen James
@sjames1958gm
Aug 10 2016 01:05
@pelicanscarecrow concatenating, not adding.
Joseph
@revisualize
Aug 10 2016 01:05
Meh
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:05
okay now I have return count + "Bet";
Stephen James
@sjames1958gm
Aug 10 2016 01:05
@LunyAlex Why not just push arr[i][0] after sorting, you don't need more for loops. shift removes from and array push would add to the end
Tica Alexandru Adrian
@LunyAlex
Aug 10 2016 01:06
Tried that, keeps telling me arr[ ] [ ].push() is not a function...
Gave me the impression you can't just select a sub-element like that
Stephen James
@sjames1958gm
Aug 10 2016 01:07
@pelicanscarecrow Space the finale frontier (need a space before Bet as in " Bet")
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:07
I got one checkmark!:):)
Stephen James
@sjames1958gm
Aug 10 2016 01:07
@LunyAlex tempArr.push(arr[i][0])
@LunyAlex you push onto the array the value from the inner array
@pelicanscarecrow :)
@pelicanscarecrow Now write the else for that if
Tica Alexandru Adrian
@LunyAlex
Aug 10 2016 01:09

Mindblown. I need more practice with these methods.

Thanks a million.

Stephen James
@sjames1958gm
Aug 10 2016 01:10
@LunyAlex :+1:
Stephen James
@sjames1958gm
Aug 10 2016 01:15
@pelicanscarecrow crickets - What happened.
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:16
@sjames1958gm I am about to try it, I am multi tasking hard.
Would I say else (count<0) this time?
Mostafa Syam
@pro-mos
Aug 10 2016 01:19
can someone tell me what im doing wrong on line 12
function translatePigLatin(str) {
  var vowels = /[aeiou]/gi,
      consonants = /[bcdfghjklmnpqrstvxz]/gi;

  // if str starts with a vowel
  if (str[0].match(vowels)) {
    return str + 'way';
  }

  str = str.split('');
  for (var i = 0;i<str.length;i++) {
    if ( str[i].match(consonants) ) {
      str.push(str.splice(i, 1)[0]);
    }
    // line 12:  if the next letter is NOT consonant, stop
    if ( !str[i + 1].match(consonants) ) {
      break;
    }
  }

  return str.join('') + 'ay';
}

translatePigLatin("california");
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:20

var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count ++;
answer ="Bet";
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count --;
count="Hold";
break;}
if (count>0){
return count + " Bet";
} else {
return count + " Hold";

}

// Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');

eeflores
@eeflores
Aug 10 2016 01:20
This message was deleted
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:20
I put in this and it only check off one more check point.
Moisés Man
@moigithub
Aug 10 2016 01:21
count="Hold"; <-- should NOT be there
u replacing count value @pelicanscarecrow
Joseph
@revisualize
Aug 10 2016 01:22
Hahahaha
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:22
I didn't even notice that was there! Thank you @sjames1958gm @moigithub @revisualize
CamperBot
@camperbot
Aug 10 2016 01:22
pelicanscarecrow sends brownie points to @sjames1958gm and @moigithub and @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2463 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 1839 | @moigithub |http://www.freecodecamp.com/moigithub
:star2: 1587 | @revisualize |http://www.freecodecamp.com/revisualize
Tyler Brown
@pelicanscarecrow
Aug 10 2016 01:22
So my else statement was correct then?
eeflores
@eeflores
Aug 10 2016 01:23
@pro-mos are you getting an error?
Mostafa Syam
@pro-mos
Aug 10 2016 01:24
@eeflores no, but 'california' returns 'aioniaclfray'
it doesn't stop if the next letter not consonant for some reason
Joseph
@revisualize
Aug 10 2016 01:24
www.pythontutor.com is a great resource.
ValerieG
@cre8vexec
Aug 10 2016 01:25

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i=0; i <arr.length; i++) {
for (var j=0; j <arrManageIQ/manageiq@6c40d76.length; j++) {
product *= [i][j];
}
}
// Only change code above this line
return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

Can anyone help? I'm trying to have the product variable multiply by each number in the sub-arrays of arr.

Moisés Man
@moigithub
Aug 10 2016 01:26
product *= [i][j];
what [i][j] are ? something missing @cre8vexec
eeflores
@eeflores
Aug 10 2016 01:27
@pro-mos sorry ... can't help you right now ... brain is fried
Mostafa Syam
@pro-mos
Aug 10 2016 01:27
:D
ValerieG
@cre8vexec
Aug 10 2016 01:27
var i and var j
for (var i = 0; i < arr.length; i++)
@moigithub
Moisés Man
@moigithub
Aug 10 2016 01:29
@cre8vexec i mean.. those are .... erm.. indices ???
of what ?
ValerieG
@cre8vexec
Aug 10 2016 01:30
I'm looping through an array and sub-array.
mulltiplyAll ([[1,2],[3,4],[5,6,7]])
Moisés Man
@moigithub
Aug 10 2016 01:30
@cre8vexec probably an example ...
if u have
var names = ["aaa", "bbbb"];
what code u use to access the first value.. aaa from names array ?
Stephen James
@sjames1958gm
Aug 10 2016 01:34
@pelicanscarecrow :+1: A key to this programming stuff is taking english instructions and translating to code
Moisés Man
@moigithub
Aug 10 2016 01:35
Stephen James
@sjames1958gm
Aug 10 2016 01:35
@cre8vexec shouldn't you use the array in the product *= statement?
Marshall
@marshalldanel
Aug 10 2016 01:37
Hey ya'll
So I'm on the Record Collection challenge and I can't figure out why i'm getting TypeError: Cannot read property 'push' of undefined
if(prop == "tracks" && value !== ""){
     collection[id][prop].push(value);
Stephen James
@sjames1958gm
Aug 10 2016 01:37
@marshalldanel Maybe tracks is not set on that collection[id] ?
John Magee
@jemagee
Aug 10 2016 01:42
@marshalldanel the left side of .push should be the array you're trying to add things to - is collection[id][prop] an array?
Marshall
@marshalldanel
Aug 10 2016 01:45
@jemagee I thought tracks was set on the collection[id] as part of the setup code?
@sjames1958gm **
@jemagee then the array i'm pushing to is .tracks right?
Stephen James
@sjames1958gm
Aug 10 2016 01:46
@marshalldanel Not on every case - one of the instructions mentions what to do about tracks not being set.
John Magee
@jemagee
Aug 10 2016 01:46
@marshalldanel I'm asking - i don't recall the exercise - but .push(x); works on an array - i'm making sure it's an array and that it's established
CamieleonGitHub
@CamieleonGitHub
Aug 10 2016 01:46
hi there! I have a problem with my newly installed browser... when i try to add a custom search provider i get the error window.external.AddSearchProvider is not a function
what can i do to work around this problem?
treycwong
@treycwong
Aug 10 2016 01:47
Hi, I am stuck at Manipulating Complex Objects , can anyone help
Shu1k
@Shu1k
Aug 10 2016 01:47
function isLess(a, b) {
// Fix this code
return a === b;
} //how come isLess(10,15) returns false?
treycwong
@treycwong
Aug 10 2016 01:48

var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
}
// Add record here
{
"artist" : "Daft Punk",
"title" : "Alive",
"release_year": 1997,
"formats": [
"CS",
"8T",
"LP"
]

};
];

Stephen James
@sjames1958gm
Aug 10 2016 01:49
@treycwong Read the function name and match the comparison.
@treycwong Arrays need commas between elements [1, 2]
Marshall
@marshalldanel
Aug 10 2016 01:50
@sjames1958gm ahh right, one of the objects doesn't have tracks set as a prop, must create a new array first. Thanks
CamperBot
@camperbot
Aug 10 2016 01:50
marshalldanel sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2464 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Shu1k
@Shu1k
Aug 10 2016 01:50
can someone help
Stephen James
@sjames1958gm
Aug 10 2016 01:50
@marshalldanel :+1:
@marshalldanel The instructions do give guidance in this case
@Shu1k What?
treycwong
@treycwong
Aug 10 2016 01:51
@sjames1958gm Thanks! solved.
CamperBot
@camperbot
Aug 10 2016 01:51
treycwong sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2465 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 10 2016 01:51
@treycwong :+1:
Wendy Medeiros
@wendyr21
Aug 10 2016 01:51
wiki
CamperBot
@camperbot
Aug 10 2016 01:51
usage:
wiki $topic info on that topic
Shu1k
@Shu1k
Aug 10 2016 01:51
function isLess(a, b) {
// Fix this code
return a === b;
} --- why isLess(10,15) returning false when i want it to return true @sjames1958gm
Stephen James
@sjames1958gm
Aug 10 2016 01:51
@Shu1k does a === b mean isLess?
Shu1k
@Shu1k
Aug 10 2016 01:52
@sjames1958gm honestly i just dont understand it at all
Stephen James
@sjames1958gm
Aug 10 2016 01:53
@Shu1k The comparison a and b needs to be a isLessThan b (replace isLessThan with the correct symbol meaning is less than)
Mostafa Syam
@pro-mos
Aug 10 2016 01:55
How do i know if a letter is consonant? (pig latin challenge)
Juan Carlos Monsalve
@juancmonsalves
Aug 10 2016 01:55
Hi!. I'm stuck with NaN comparison at a switch evaluation... case NaN doesn't work because NaN==NaN returns false....
Stephen James
@sjames1958gm
Aug 10 2016 01:56
@pro-mos it isn't a e i o u or are you asking how your code could do it?
Joseph
@revisualize
Aug 10 2016 01:56
@juancmonsalves Which challenge?
Juan Carlos Monsalve
@juancmonsalves
Aug 10 2016 01:56
Falsy Bouncer
Shubham yadav
@Shubham007yadav
Aug 10 2016 01:56

can anyone tell me what wrong in my code problem no-189
function isLess(a, b) {

return a === b;

}isLess(15, 10);

Juan Carlos Monsalve
@juancmonsalves
Aug 10 2016 01:56
@revisualize Falsy Bouncer
Joseph
@revisualize
Aug 10 2016 01:56
You don't need a switch.
Shubham yadav
@Shubham007yadav
Aug 10 2016 01:56
Fix the function isLess to remove the if/else statements.
Stephen James
@sjames1958gm
Aug 10 2016 01:56
@Shubham007yadav The function name should indicate what to put instead of a === b
Joseph
@revisualize
Aug 10 2016 01:57
@juancmonsalves You should use the suggested links.
Stephen James
@sjames1958gm
Aug 10 2016 01:57
@Shubham007yadav a isLessThan b
Mostafa Syam
@pro-mos
Aug 10 2016 01:57
thx @sjames1958gm
CamperBot
@camperbot
Aug 10 2016 01:57
pro-mos sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2466 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Juan Carlos Monsalve
@juancmonsalves
Aug 10 2016 01:57
@revisualize Ok... I'll read it one more time...
Stephen James
@sjames1958gm
Aug 10 2016 01:57
@pro-mos :+1: yeah, there is an English bias ;)
Shubham yadav
@Shubham007yadav
Aug 10 2016 01:58

@sjames1958gm actual code function isLess(a, b) {
// Fix this code
if (a < b) {
return true;
} else {
return false;
}
}

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

Stephen James
@sjames1958gm
Aug 10 2016 01:59
@Shubham007yadav Reduce that code to a single return of the condition
Juan Carlos Monsalve
@juancmonsalves
Aug 10 2016 01:59
@revisualize I didn't read Booleans... Sorry ....
Shubham yadav
@Shubham007yadav
Aug 10 2016 02:02
it works ,thanks guy's.
Vinícius de Morais Mussato
@Vmussato
Aug 10 2016 02:04
Hello, im on the record collection challenge, im having some problems handling arrays, i guess i got the idea of the challenge, but im probably missing something on the syntax, could someone help me? heres my code http://www.codesend.com/view/efbde88a1a8dbf9811d9859f09d3ca7f/
Taylor
@admiraltaylor
Aug 10 2016 02:05
Hi All, I'm on "Wherefore art thou". I just wrote code that works, but I know the solution I came up with is pretty bad... basically I wrote it to work only if there are 1 or 2 parameters instead of no matter the number involved.

function whatIsInAName(collection, source) {
// What's in a name?
var arr = [];
// Only change code below this line
//getting array of properties to check against.
var checkProp=Object.keys(source);
//iterating through collections
for (var i=0; i<collection.length; i++)
{
//checking to see if collection has all the properties necessary
if (checkProp.length==1)
{
if (collectionManageIQ/manageiq@6c40d76.hasOwnProperty([checkPropxamarin/xamarin-android@a16673d])&&(collection[i][checkPropxamarin/xamarin-android@a16673d]==source[checkPropxamarin/xamarin-android@a16673d]))
{
arr.push(collectionManageIQ/manageiq@6c40d76);
}
}
else if (checkProp.length==2)
{
if (collectionManageIQ/manageiq@6c40d76.hasOwnProperty([checkPropxamarin/xamarin-android@a16673d])&&(collectionManageIQ/manageiq@6c40d76.hasOwnProperty([checkProp1]))&&(collection[i][checkPropxamarin/xamarin-android@a16673d]==source[checkPropxamarin/xamarin-android@a16673d])&&(collection[i][checkProp1]==source[checkProp1]))
{
arr.push(collectionManageIQ/manageiq@6c40d76);
}
}
}

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

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });

ugh that's bad
I'm so sorry for posting it this way
please tell me a better way to post my code
Moisés Man
@moigithub
Aug 10 2016 02:08
help format
CamperBot
@camperbot
Aug 10 2016 02:08

: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 thecode`.

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

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

Juan Sierra
@juan-sierra
Aug 10 2016 02:08
hi anyone here
Juan Carlos Monsalve
@juancmonsalves
Aug 10 2016 02:09
@revisualize Thanks... Awesome.... Can I share how I solved the problem?
CamperBot
@camperbot
Aug 10 2016 02:09
juancmonsalves sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 1588 | @revisualize |http://www.freecodecamp.com/revisualize
Raj
@RajKumar1605
Aug 10 2016 02:11
Which is the best sorting algorithm ?
Jamen Marz
@jamen
Aug 10 2016 02:17
Define "best" and what type of sorting.
If by "best" you want to be performant, you'll almost always want to use procedural loops (for and while) instead of methods (like .sort, .filter, etc).
and because of that, how you design it can vary depending on the type of sorting you are doing.
Jordan
@Jorwhite11
Aug 10 2016 02:18

anyone can help me with this please?

var myStr = "FirstLine\n\SecondLine\r\ThirdLine";

im very confused on how to start new lines and or the esxape sequences
Giovanni
@spgiovanni
Aug 10 2016 02:19
10,"J","Q","K","A"
John Magee
@jemagee
Aug 10 2016 02:19
I don't care what anyone says - i still hate regular expressions but thank god for web sites that help me build /[^a-zA-Z0-9-]|[a-z][A-Z]/
Stephen James
@sjames1958gm
Aug 10 2016 02:19
@Jorwhite11 You should replace the keyword with the values from the table.
Giovanni
@spgiovanni
Aug 10 2016 02:19

var count = 0;

function cc(card) {
  // Only change code below this line
  if (card === [2,3,4,5,6]){
    return count+1;
  }
  if (card === [7,8,9]){
    return count + 0;
  }
  if (card === [10,"J","Q","K","A"]){
    return count -1;
  }
  if (count >= 1){
  return count + " Bet" ;
  }else{
    return count + " Hold";
  }
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Count Change Cards
+1 2, 3, 4, 5, 6
0 7, 8, 9
-1 10, 'J', 'Q', 'K', 'A'
You will write a card counting function. It will receive a card parameter and increment or decrement the global count variable according to the card's value (see table). The function will then return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative. The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
Stephen James
@sjames1958gm
Aug 10 2016 02:20
@spgiovanni Don't return count + 1 - modify count
bitgrower
@bitgrower
Aug 10 2016 02:20
@spgiovanni you can only do a test of one value at a time ..
John Magee
@jemagee
Aug 10 2016 02:20
@spgiovanni return ends the function so it can't continue
Stephen James
@sjames1958gm
Aug 10 2016 02:20
@spgiovanni Also card is not an array so it will never === [2, 3, 4, 5, 6] you need to use card === 2 || card === 3 etc.
Jordan
@Jorwhite11
Aug 10 2016 02:21

@sjames1958gm i do not have a table, just

Here is the text with the escape sequences written out.

FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine

Stephen James
@sjames1958gm
Aug 10 2016 02:21
@Jorwhite11 There isn't a table of escape sequences in the instructions?
Giovanni
@spgiovanni
Aug 10 2016 02:21
@sjames1958gm ok thanks, how should I modify the count?
CamperBot
@camperbot
Aug 10 2016 02:22
spgiovanni sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2467 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
bitgrower
@bitgrower
Aug 10 2016 02:22

@spgiovanni there are basically 2 "parts" to this challenge ... first, adjusting the count variable...

then .. .deciding what message to output based upon the value of the count vrarible

Mostafa Syam
@pro-mos
Aug 10 2016 02:22
switch will be better than if else in this challenge
Stephen James
@sjames1958gm
Aug 10 2016 02:22
@spgiovanni count++ or count += 1 or count = count + 1 your choice
Jordan
@Jorwhite11
Aug 10 2016 02:22

@sjames1958gm no table im suppoe to make this

FirstLine
\SecondLine\
ThirdLine

Stephen James
@sjames1958gm
Aug 10 2016 02:23
@Jorwhite11 Your instructions don't start with Quotes are not the only characters that can be escaped inside a string. Here is a table of common escape sequences:
bitgrower
@bitgrower
Aug 10 2016 02:23
@spgiovanni count is a global variable ... so, you just need to either leave it unchanged, subtract one, or add one, depending on the card ..
Jordan
@Jorwhite11
Aug 10 2016 02:24
@sjames1958gm yea, so just copy those codes into my code and it will work?
Stephen James
@sjames1958gm
Aug 10 2016 02:24
@Jorwhite11 replace the keywords with those codes and remove any spaces.
Giovanni
@spgiovanni
Aug 10 2016 02:27
@sjames1958gm @pro-mos @bitgrower ok thx guys I'll try that
CamperBot
@camperbot
Aug 10 2016 02:27
spgiovanni sends brownie points to @sjames1958gm and @pro-mos and @bitgrower :sparkles: :thumbsup: :sparkles:
:cookie: 287 | @pro-mos |http://www.freecodecamp.com/pro-mos
:warning: spgiovanni already gave sjames1958gm points
:star2: 1176 | @bitgrower |http://www.freecodecamp.com/bitgrower
Jordan
@Jorwhite11
Aug 10 2016 02:27

@sjames1958gm i did it, got this

var myStr = "FirstLine\nSecondLine\\rThirdLine";

still didnt work

Stephen James
@sjames1958gm
Aug 10 2016 02:27
@spgiovanni You can do it.
@Jorwhite11 Looks like the backslash after the newline didn't get replaced.
Giovanni
@spgiovanni
Aug 10 2016 02:28
@sjames1958gm thx bro sometimes I feel like I over think it
CamperBot
@camperbot
Aug 10 2016 02:28
spgiovanni sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: spgiovanni already gave sjames1958gm points
Jordan
@Jorwhite11
Aug 10 2016 02:29
@sjames1958gm im just confused, how is it suppose to look, not like the full code, but how the /n will look
John Magee
@jemagee
Aug 10 2016 02:29
Well - solved the spinal tap question - probably didn't it 'wrong' but it works :)
Stephen James
@sjames1958gm
Aug 10 2016 02:29
@Jorwhite11 \n\\ this is newlinebackslash
John Magee
@jemagee
Aug 10 2016 02:30
hey - when did they change it from 'enter' to 'command-enter'?
@sjames1958gm the FIRST \ is never shown it's just telling javascript to comment out the NEXT character - thus \ yields \
Jordan
@Jorwhite11
Aug 10 2016 02:30
@sjames1958gm ok i got it to work, but im still confused haha, need to read up more on these escape sequences
Stephen James
@sjames1958gm
Aug 10 2016 02:30
@Jorwhite11 :+1:
John Magee
@jemagee
Aug 10 2016 02:31
oops - sent that to the wrong person - my bad
@Jorwhite11 it just takes practice to learn them all - you probably won't use many of the 'key combos' aside from \n - but it's very helpful when you're inside a quotation "" and you want to use another " you can use \"
Jordan
@Jorwhite11
Aug 10 2016 02:31
@sjames1958gm thanks alot! you're the MVP
CamperBot
@camperbot
Aug 10 2016 02:31
jorwhite11 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 2468 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Aug 10 2016 02:32
The \ is telling javascript to ignore the default interpretation of the next character. (thus it escapes the standard behaviour of the parser)
@Jorwhite11 btw if you put backquotes at either end of the line of code when you post it wont hide those special characters.
var myStr = "FirstLine\n\\SecondLine\\\rThirdLine";
Nestor Figliuolo
@Makaan
Aug 10 2016 02:42
Hey guys, i have a problem, i'm adding 3 numbers to a variable, all numbers are initialized, but that variable become NaN, someone had the same issue?
John Magee
@jemagee
Aug 10 2016 02:42
@Makaan Can you show us the code?
Nestor Figliuolo
@Makaan
Aug 10 2016 02:43
yes, give me a second
var x=0;
x=unitChange+desc-cidi;
how i tag code?
//unitChange = 0.00, desc=0, cid[i][1]=0
var x=0;
x=unitChange+desc-cid[i][1];
there
Chovin
@Chovin
Aug 10 2016 02:50
what is unitChange?
Nestor Figliuolo
@Makaan
Aug 10 2016 02:53
i fixed it by parsing all of them to Float
i think the problem was that some variables was integers and one was float
Tyler Brown
@pelicanscarecrow
Aug 10 2016 02:54

// Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;

var playerNumber; // Change this Line
var player = testObj; // Change this Line

How would I use the playerNumber variable to lookup player 16 in testObj using bracket notation
?
Nestor Figliuolo
@Makaan
Aug 10 2016 02:55
testObj[playerNumber];
Tyler Brown
@pelicanscarecrow
Aug 10 2016 02:56
thanks @Makaan
CamperBot
@camperbot
Aug 10 2016 02:56
pelicanscarecrow sends brownie points to @makaan :sparkles: :thumbsup: :sparkles:
:cookie: 303 | @makaan |http://www.freecodecamp.com/makaan
Stephen James
@sjames1958gm
Aug 10 2016 02:56
@pelicanscarecrow First you have to give the playerNumber variable the correct player number (then do what @Makaan said)
Nestor Figliuolo
@Makaan
Aug 10 2016 02:56
no problem
Joseph
@revisualize
Aug 10 2016 03:15
Hi.
Nestor Figliuolo
@Makaan
Aug 10 2016 03:18
Hello fellow Camper :V
Mostafa Syam
@pro-mos
Aug 10 2016 03:22
spent 4 hours on this stupid pig latin challenge, finally solved it ^_^
Nestor Figliuolo
@Makaan
Aug 10 2016 03:23
@pro-mos you used regex?
Mostafa Syam
@pro-mos
Aug 10 2016 03:23
@Makaan yes, with .match()
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:23

// 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",

};

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

// Change this value to test
phoneticLookup("charlie");

What is wrong with this code?
Mostafa Syam
@pro-mos
Aug 10 2016 03:26
@pelicanscarecrow you're returning an empty string
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:27
How so?
Mostafa Syam
@pro-mos
Aug 10 2016 03:27
@pelicanscarecrow result, is empty
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:28
It tells me not to touch that though..
Mostafa Syam
@pro-mos
Aug 10 2016 03:29
ok then, assign to result a value
Taylor
@admiraltaylor
Aug 10 2016 03:29
`code`    test
hooray
Nestor Figliuolo
@Makaan
Aug 10 2016 03:29
lolo
As @pro-mos say, override the result value
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:33
@pro-mos My code is correct besides my result is empty though?
Mostafa Syam
@pro-mos
Aug 10 2016 03:34
@pelicanscarecrow yes
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:34
well thats good. so what should I code next??
Mostafa Syam
@pro-mos
Aug 10 2016 03:36
assign to result the value from the object with argument as a key
Nestor Figliuolo
@Makaan
Aug 10 2016 03:39
@pelicanscarecrow like result=...
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:45
result= .....
I have tried everything I can think of
Deanna Medina
@queenaryha
Aug 10 2016 03:46
@Vmussato I am also stuck on the Record Collection code...
Nestor Figliuolo
@Makaan
Aug 10 2016 03:47
@pelicanscarecrow you have the variable with the name of the phonetic (val), you have the object (lookup), how do you access the names in that object with that variable?
@queenaryha where are you stuck?
Deanna Medina
@queenaryha
Aug 10 2016 03:50
@Makaan on the Records Collection...I must be having a brain freeze because I can't get it to return anything right:

function updateRecords(id, prop, value) {

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

Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:51
@Makaan result= phoneticLookup?
Honestly I have no idea.
Nestor Figliuolo
@Makaan
Aug 10 2016 03:52
@pelicanscarecrow you have an object with a certain property and a parameter that is that property's name, how do you access it?
pahosler
@pahosler
Aug 10 2016 03:53
collection.hasOwnProperty('tracks')
Greg Duncan
@GregatGit
Aug 10 2016 03:53
@queenaryha you can only push to an array - if the array is not there you have to create it
Deanna Medina
@queenaryha
Aug 10 2016 03:53
@pahosler ahhhh thank you
CamperBot
@camperbot
Aug 10 2016 03:53
queenaryha sends brownie points to @pahosler :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @pahosler |http://www.freecodecamp.com/pahosler
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:53
with a dot property?
pahosler
@pahosler
Aug 10 2016 03:53
collection not prop...
oops
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:53
a dot operator i mean
DJ
@qualitymanifest
Aug 10 2016 03:54
dot notation*
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:54
dot opertor, bracket notation?
operator
Nestor Figliuolo
@Makaan
Aug 10 2016 03:54
@pelicanscarecrow the last one
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:54
bracket notation?
Nestor Figliuolo
@Makaan
Aug 10 2016 03:55
@pelicanscarecrow yes!
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:56
so would it be lookup["phoneticLookup"]?
Greg Duncan
@GregatGit
Aug 10 2016 03:56
@pelicanscarecrow you have to learn how to access properties and values of object - you need to get your head around it - create a obj in https://repl.it/ and play around with it till you feel you understand better if not you will be continually stuck on obj/props/values how to add access and the like
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:56
@GregatGit thanks
CamperBot
@camperbot
Aug 10 2016 03:56
pelicanscarecrow sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 731 | @gregatgit |http://www.freecodecamp.com/gregatgit
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:56
I know I am not good at it yet lol
Nestor Figliuolo
@Makaan
Aug 10 2016 03:57
@pelicanscarecrow almost, you need to use the argument of your function
Greg Duncan
@GregatGit
Aug 10 2016 03:57
@pelicanscarecrow alot of us struggled with this - but you'll get it in time
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:58
@Makaan so is lookup what goes before the bracket??
Nestor Figliuolo
@Makaan
Aug 10 2016 03:58
@pelicanscarecrow yes, that's the object you want to access
Tyler Brown
@pelicanscarecrow
Aug 10 2016 03:58
and the argument is the result?
Nestor Figliuolo
@Makaan
Aug 10 2016 03:59
the argument is the name of the property you want to access in the object, the string that you get it's the answer
Tyler Brown
@pelicanscarecrow
Aug 10 2016 04:00

// 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",

};
lookup["alpha"];
// Only change code above this line
return result;
}

// Change this value to test
phoneticLookup("charlie");

so what is wrong with this?
Nestor Figliuolo
@Makaan
Aug 10 2016 04:01
result=lookup[val];
Karolee
@KaroleeC
Aug 10 2016 04:08
Anyone have a good alternation program to input the code into for testing? I have no idea if my function variables are behaving the way I expect them to.
Nestor Figliuolo
@Makaan
Aug 10 2016 04:10
@KaroleeC i us js.do and a lot of document.writes()
Karolee
@KaroleeC
Aug 10 2016 04:13
@Makaan Thank you i will try it out. =)
CamperBot
@camperbot
Aug 10 2016 04:13
karoleec sends brownie points to @makaan :sparkles: :thumbsup: :sparkles:
:cookie: 306 | @makaan |http://www.freecodecamp.com/makaan
Nestor Figliuolo
@Makaan
Aug 10 2016 04:15
@KaroleeC we should learn how to use a debugger :P
Norvin Burrus
@ndburrus
Aug 10 2016 04:25
@pelicanscarecrow this may be useful: :sparkles:
Kaan
@oguzthedoc
Aug 10 2016 04:31

hey guys can anyone help me figure out what should I do here?
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");

Norvin Burrus
@ndburrus
Aug 10 2016 04:32
@oguzthedoc the exercise is asking for a sentence to be built using the 4 word types given. it may be easiest to begin by making a complete (spacing & punctuation) sentence, using the 4 words. to make sense, the complete sentence will require a few "filler" words. :sparkles:
Kaan
@oguzthedoc
Aug 10 2016 04:32
@ndburrus yeah but how, it doesn't tell me anything about it
Norvin Burrus
@ndburrus
Aug 10 2016 04:33
@oguzthedoc we need to use string concatenation
this may be useful: :sparkles:
Ian
@A8236
Aug 10 2016 04:35
hi can someone help me out with the Accessing Nested Objects challenge?
Access the myStorage object and assign the contents of the glove box property to the gloveBoxContents variable. Use bracket notation for properties with a space in their name.

// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

// Only change code below this line

var gloveBoxContents = ""; // Change this line

Norvin Burrus
@ndburrus
Aug 10 2016 04:36
@A8236 ok, the var/iable (gloveBoxContents ) needs to be equal to a value retrieved from the object table. how can we do this?
notice how a result value is obtained in the example code (the values on the right are obtained from the object table)
ourStorage.cabinet["top drawer"].folder2;  // "secrets"
ourStorage.desk.drawer; // "stapler"
@oguzthedoc making more sense?
Ian
@A8236
Aug 10 2016 04:38
@ndburrus myStorage.car["inside"].glovebox;?
Kaan
@oguzthedoc
Aug 10 2016 04:38
@ndburrus you mean I should use "+=" ?
Ian
@A8236
Aug 10 2016 04:38
@ndburrus i've insert the code but its still wrong
this is my code
Norvin Burrus
@ndburrus
Aug 10 2016 04:38
@oguzthedoc depends... but i think you have the idea...
Ian
@A8236
Aug 10 2016 04:38

// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

// Only change code below this line
myStorage.car["inside"].glovebox;
var gloveBoxContents = ""; // Change this line

Norvin Burrus
@ndburrus
Aug 10 2016 04:39
@A8236 you want to sort of walk through the object table, pointing towards the value you want...
Kaan
@oguzthedoc
Aug 10 2016 04:39
@ndburrus yeah kind of, I just can't remember how did we do that before I should look into it, thanks!
CamperBot
@camperbot
Aug 10 2016 04:39
oguzthedoc sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 1505 | @ndburrus |http://www.freecodecamp.com/ndburrus
Ian
@A8236
Aug 10 2016 04:40

@ndburrus this is my code. what is wrong with it?
// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

// Only change code below this line
myStorage.car["inside"].glovebox;
var gloveBoxContents = ""; // Change this line

Norvin Burrus
@ndburrus
Aug 10 2016 04:40
@oguzthedoc you're welcome... do you see the string concatenation information?
@A8236 ok, we should use dot notation, here ( .inside )... this may be helpful: :sparkles:
Kaan
@oguzthedoc
Aug 10 2016 04:41
@ndburrus what do you mean?
Ian
@A8236
Aug 10 2016 04:42

@ndburrus you mean like this?

// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

// Only change code below this line
myStorage.car(.inside).glovebox;
var gloveBoxContents = ""; // Change this line

@ndburrus or you mean this?

// Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

// Only change code below this line
myStorage.car.inside.glovebox;
var gloveBoxContents = ""; // Change this line

Jack
@jh0l
Aug 10 2016 04:44
so when using ajax, the ajax code will run asynchronously beside the rest of the js being executed. Right what is the proper way to run code chronologically with ajax because right now, I just run latter functions in the success portion of ajax fucntions. Is this the best for maintainability and readability and all that?
Norvin Burrus
@ndburrus
Aug 10 2016 04:44
@A8236 ok, in your second code post... this is close. note that since glove box has a space in it, we need to use bracket notation... :point_up: August 10, 2016 12:40 AM
@oguzthedoc in the link :point_up: August 10, 2016 12:33 AM
Ian
@A8236
Aug 10 2016 04:46
@ndburrus
// Only change code below this line
myStorage.car.inside["glove box"];
var gloveBoxContents = ""; // Change this line
Kaan
@oguzthedoc
Aug 10 2016 04:47
@ndburrus oh sorry i haven't noticed that one
Norvin Burrus
@ndburrus
Aug 10 2016 04:48
@A8236 alright, we need assign a result to our variable (gloveBoxContents), right?
the purpose of the variable is to get (or extract) a value from the object table...
@oguzthedoc it has a couple of useful examples... that should refresh your memory :)
Ian
@A8236
Aug 10 2016 04:48
@ndburrus yup, i'm confused on how to do that
Norvin Burrus
@ndburrus
Aug 10 2016 04:49
@A8236 no you're not :) it's an assignment. you've done it a million times... :sparkles:
so, we have a variable, and a value. how do we assign (=) the value (obtained from the object table) to the variable?
Ian Hale
@coloradomountain
Aug 10 2016 04:50
Can someone help me with JS record collection
I am having issues with " After updateRecords(5439, "tracks", "Take a Chance on Me"), tracks should have "Take a Chance on Me" as the last element. "
WARN here is my code http://pastie.org/10933827
Kaan
@oguzthedoc
Aug 10 2016 04:51
@ndburrus it definitely helped thank you again I've been trying to get this done for at least an hour
CamperBot
@camperbot
Aug 10 2016 04:51
oguzthedoc sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:warning: oguzthedoc already gave ndburrus points
Norvin Burrus
@ndburrus
Aug 10 2016 04:52
@oguzthedoc ask, ask, ask! you're welcome! nicely done! :palm_tree:
... or as the advice goes: read, search, ask. :)
Ian Hale
@coloradomountain
Aug 10 2016 04:52
Everything else seems to check out, I just can't seem to add a property to the object.
Norvin Burrus
@ndburrus
Aug 10 2016 04:53
@A8236 how are we doing?
Abis Mal
@abisthecodermal
Aug 10 2016 04:53
guys help me out.
Ian
@A8236
Aug 10 2016 04:53
@ndburrus i've cracked my head but i just can't seem to know how for this case..
Norvin Burrus
@ndburrus
Aug 10 2016 04:53
@abisthecodermal ok, relax. we have this, so far
myStorage.car.inside["glove box"];
var gloveBoxContents = ""; // Change this line
Abis Mal
@abisthecodermal
Aug 10 2016 04:54
ok @ndburrus
Norvin Burrus
@ndburrus
Aug 10 2016 04:54
@abisthecodermal do we want the variable (gloveBoxContents) to be equal to "" ?
Ian
@A8236
Aug 10 2016 04:54
@ndburrus yup so how to i assign that variable
@ndburrus nope we want it to equal to the code above it
Norvin Burrus
@ndburrus
Aug 10 2016 04:55
@A8236 exactly! so, what is the assignment operator?
hint: in arithmetic, it's called an equals sign...
Abis Mal
@abisthecodermal
Aug 10 2016 04:55
Not unless we are initializing it @ndburrus . But I have crossed this milestone ages ago?
Ian
@A8236
Aug 10 2016 04:55
@ndburrus myStorage?
@ndburrus i have no idea... am i suppose to copy the whole code in?
@ndburrus doesnt work that way huh..
Abis Mal
@abisthecodermal
Aug 10 2016 04:56
Answer the question asked by @ndburrus and you will be closer to a solution than you think
@A8236
Norvin Burrus
@ndburrus
Aug 10 2016 04:56

@A8236 this may be helpful: :sparkles:

take a deep breath... relax...
what represents our value (or result of getting a value from the object table)?

denglongwu
@denglongku
Aug 10 2016 04:58
、、、
Norvin Burrus
@ndburrus
Aug 10 2016 04:59
''' @denglongku
  • using Shift + enter will give you additional line feeds (space) for pasting your code. also, the backticks (`) key is located to the left of the number one (#1) key.
  • further, you may find the two buttons (chat/compose & markdown - the chat/compose button alternates modes) to the right of the text entry area helpful.
  • you can also edit (reply, quote, edit, delete) text after it's been entered by clicking on the three (3) dots to the right of the text entry area (it will appear when you hover to the right of the time stamp). or, you can press the up arrow/key.
CamperBot
@camperbot
Aug 10 2016 04:59
:bulb: to format code use backticks! ``` more info
denglongwu
@denglongku
Aug 10 2016 04:59
This message was deleted
NixonRichard
@NixonRichard
Aug 10 2016 04:59
function diffArray(arr1, arr2) {
  var newArr = arr1.concat(arr2);
  return newArr.filter( function(val) {
    if ( val != arr1 || val != arr2) {
      return true;
    }

  });
  // Same, same; but different.

}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
hi there what s wrong with my code ?
Ian
@A8236
Aug 10 2016 05:00
@ndburrus thats the thing ! i have no idea! what represent the value??
Norvin Burrus
@ndburrus
Aug 10 2016 05:00
@A8236 ok, let's go the other way. what is our value?
what did we create to "look into" the object table?
hint: there are only 2 code lines, here - pick one.
myStorage.car.inside["glove box"];
var gloveBoxContents = ""; // Change this line
Ian
@A8236
Aug 10 2016 05:00
@ndburrus maps?
denglongwu
@denglongku
Aug 10 2016 05:01
This message was deleted
Ian
@A8236
Aug 10 2016 05:01
@ndburrus or is that our value
NixonRichard
@NixonRichard
Aug 10 2016 05:01
nvm
Norvin Burrus
@ndburrus
Aug 10 2016 05:02
@A8236 take a quick peek.... :point_up: August 10, 2016 1:00 AM
Ian
@A8236
Aug 10 2016 05:02
@ndburrus the first line
@ndburrus we want our gloveboxcontents to equal that line to find "maps"
@ndburrus but the problem is what represent that code?
Norvin Burrus
@ndburrus
Aug 10 2016 05:03
@A8236 ok, the 1st line is our value (sorry for the confusion). typo.
so, we assign the value to the variable (gloveBoxContents)
Ian
@A8236
Aug 10 2016 05:04
@ndburrus no prob, yup okay thats our value. So am i suppose to assign it to a varaible?
Norvin Burrus
@ndburrus
Aug 10 2016 05:04
@A8236 yes.
Ian
@A8236
Aug 10 2016 05:04
@ndburrus how do i do that?
Norvin Burrus
@ndburrus
Aug 10 2016 05:04
@A8236 = perhaps?
Ian
@A8236
Aug 10 2016 05:05
@'
@ndburrus myStorage.car.inside["glove box"] = var gloveBoxContents;?
Norvin Burrus
@ndburrus
Aug 10 2016 05:05
@A8236 turn it around.
Ian
@A8236
Aug 10 2016 05:06
@ndburrus gloveBoxContents = myStorage.car.inside["glove box"];
Norvin Burrus
@ndburrus
Aug 10 2016 05:06
@A8236 bingo! the value gets assigned to the variable. run tests.
Ian
@A8236
Aug 10 2016 05:06
@ndburrus doesnt work..
Norvin Burrus
@ndburrus
Aug 10 2016 05:07
@A8236 post?
Ian
@A8236
Aug 10 2016 05:07
@ndburrus it says it doesnt equals to maps

@ndburrus // Setup
var myStorage = {
"car": {
"inside": {
"glove box": "maps",
"passenger seat": "crumbs"
},
"outside": {
"trunk": "jack"
}
}
};

// Only change code below this line
gloveBoxContents = myStorage.car.inside["glove box"];
var gloveBoxContents = ""; // Change this line

Norvin Burrus
@ndburrus
Aug 10 2016 05:07
@A8236 delete this var gloveBoxContents = ""; :sparkles:
Ian
@A8236
Aug 10 2016 05:08
@ndburrus holy shit you're my savior
@ndburrus i almost gave up on life
@ndburrus THANK YOU SO MUCHHHH
CamperBot
@camperbot
Aug 10 2016 05:08
a8236 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 1506 | @ndburrus |http://www.freecodecamp.com/ndburrus
FM
@mafelix
Aug 10 2016 05:09
Q#
For loops in js are blocking or non blocking?
Norvin Burrus
@ndburrus
Aug 10 2016 05:09
@A8236 no, you didn't. you're welcome! excellent job! very well done! :palm_tree:
@mafelix do you want a non-blocking for loop?
FM
@mafelix
Aug 10 2016 05:11
No just natively.
Ian
@A8236
Aug 10 2016 05:11
@ndburrus still.. thanks alot bro!
CamperBot
@camperbot
Aug 10 2016 05:11
a8236 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:warning: a8236 already gave ndburrus points
Ian
@A8236
Aug 10 2016 05:11
@ndburrus if it isnt too much trouble, could you help me out with this code too?

@ndburrus var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
},
{
"artist": "1975",
"title": "Robbers",
"release_year": 1975,
"formats": [
"CD",
"Cassette",
"LP"
]
}

];// Add record here

];

FM
@mafelix
Aug 10 2016 05:12
So I can assume by ur statement for loops are by default blocking.
Norvin Burrus
@ndburrus
Aug 10 2016 05:12
@A8236 anytime! great work! :+1:
This message was deleted
Ian
@A8236
Aug 10 2016 05:13
@ndburrus var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
},
{
"artist": "1975",
"title": "Robbers",
"release_year": 1975,
"formats": [
"CD",
"Cassette",
"LP"
]
}
@ndburrus i'm suppose to Add a new album to the myMusic array. Add artist and title strings, release_year number, and a formats array of strings.
Norvin Burrus
@ndburrus
Aug 10 2016 05:13
@A8236 lesson?
Ian
@A8236
Aug 10 2016 05:14
@ndburrus i believe its the Manipulating Complex Objects challenge
Norvin Burrus
@ndburrus
Aug 10 2016 05:14
@mafelix moment
Rohit Yadav
@roh777
Aug 10 2016 05:16
@A8236 That challenge is a little tricky. But take you time.
Manjot Singh
@msingh18
Aug 10 2016 05:16
I was using the Geolocation in the Local Weather challenge. I noticed the 'coords' object has a key named "accuracy". Can someone tell me exactly what accuracy means in this context?
Ian
@A8236
Aug 10 2016 05:17
@roh777 {
"artist": "1975",
"title": "Robbers",
"release_year": 1975,
"formats": [
"CD",
"Cassette",
"LP"
]
}
Duc Nguyen Huu
@nguyen-huu-duc
Aug 10 2016 05:17
hi all, Please help me. I'm doing Build a Wikipedia Viewer and have a problem with No 'Access-Control-Allow-Origin' header is present on the requested resource
Norvin Burrus
@ndburrus
Aug 10 2016 05:17
@A8236 ok, so the 1st object ends w/ a curly, you have a comma to seperate the records. so the 2nd object ends w/ a curly. and the whole thing ends w/ ];
Ian
@A8236
Aug 10 2016 05:18
@roh777 that is the code i inserted, may i ask whats wrong with it?
so the 1st object ends w/ a curly, you have a comma to seperate the records. so the 2nd object ends w/ a curly. and the whole thing ends w/ ];
FM
@mafelix
Aug 10 2016 05:19
Duc. Use jsonp datatype
Ian
@A8236
Aug 10 2016 05:19

@ndburrus is this right then..?
var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
},
{
"artist": "1975",
"title": "Robbers",
"release_year": 1975,
"formats": [
"CD",
"Cassette",
"LP"]

  }

]

FM
@mafelix
Aug 10 2016 05:19
If the resource ure requesting is json format
Norvin Burrus
@ndburrus
Aug 10 2016 05:20
@mafelix ok, im not sure about "natively" or how a definition would be met.
for loops can be implemented in both ways, blocking & non-blocking.
these may be helpful:
FM
@mafelix
Aug 10 2016 05:20
Just a normal for loop.
I had a for loop that had an async ajax request nested in it.
Gave me some problems figuring out why for loop variable wasnt passed into ajax cb
Luis Amador
@MrLuisAmador
Aug 10 2016 05:22

var Car = function(wheels, seats, engines) {
  //Change this constructor
  this.wheels = 4;
  this.seats = 5;
  this.engines = 1;
};

//Try it out here
var myCar = new Car(6, 2, 3);
What won't this pass?
Norvin Burrus
@ndburrus
Aug 10 2016 05:22
@mafelix im not very well versed... im still learning.... :)
are you using timers?
Chovin
@Chovin
Aug 10 2016 05:23
the inspection
FM
@mafelix
Aug 10 2016 05:23
No worries. You good brah.
No timers. Just for loop nested inside an ajax call
So if you write a for loop and have jquery ajax call inside. And want to use the for loop variable for ex i in the success cb. It gets lost at times.
Duc Nguyen Huu
@nguyen-huu-duc
Aug 10 2016 05:25
@fm : i have changed to jsonnp but it's wrong
Norvin Burrus
@ndburrus
Aug 10 2016 05:25
Oxide Debbarma
@oxide94Git
Aug 10 2016 05:25
hey friends, how to get the city names with geolocation.coords?
FM
@mafelix
Aug 10 2016 05:26
Cuz ajax in js is non blocking. So the time which the ajax function calls the success your for loop variable is done.
Brandon Bowers
@Bowers96
Aug 10 2016 05:26
var string = "Split me into an array";
var array = [];

// Only change code below this line.

array = string.split();
You should split the string by its spaces.
What am I missing?
FM
@mafelix
Aug 10 2016 05:26
@oxide94Git Use a geolocator api or googlemaps
Norvin Burrus
@ndburrus
Aug 10 2016 05:27
@A8236 did that help?
Duc Nguyen Huu
@nguyen-huu-duc
Aug 10 2016 05:29
@mafelix
i have changed to jsonnp but it's wrong
http://codepen.io/nguyenhuuduc/pen/VjVWmd?editors=1010
Brandon Bowers
@Bowers96
Aug 10 2016 05:30
Anybody?
Oxide Debbarma
@oxide94Git
Aug 10 2016 05:30
thanks @mafelix :smile: . i m googling now.. :smile: :smile:
CamperBot
@camperbot
Aug 10 2016 05:30
oxide94git sends brownie points to @mafelix :sparkles: :thumbsup: :sparkles:
:cookie: 433 | @mafelix |http://www.freecodecamp.com/mafelix
pahosler
@pahosler
Aug 10 2016 05:30
just one n jsonp
#separator
pahosler
@pahosler
Aug 10 2016 05:31
var arr="mary had a little lamb".split(' ');
Ian
@A8236
Aug 10 2016 05:34

@ndburrus hi so whats wrong with this code of mine right now?
var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
},
{
"artist": "1975",
"title": "Robbers",
"release_year": 1975,
"formats": [
"CD",
"Cassette",
"LP"]

  }

]

Norvin Burrus
@ndburrus
Aug 10 2016 05:35
@A8236 need ; at the end :sparkles:
reference lesson example code...
looks like you need the last format criteria/value "gold": true (with your own value) for the added record
Jaren Escueta
@jarenescueta731
Aug 10 2016 05:50
@Bowers96
string.split(' ');
Ian
@A8236
Aug 10 2016 05:52

@ndburrus var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
},
{
"artist": "1975",
"title": "Robbers",
"release_year": 1975,
"formats": [
"CD",
"Cassette",
"LP"],
"gold": false;

  }

]
like this?

Norvin Burrus
@ndburrus
Aug 10 2016 05:53
@A8236 :point_up: August 10, 2016 1:35 AM
;? :sparkles:
Ian
@A8236
Aug 10 2016 05:54
@ndburrus is that a yes or a uh uh?

var myMusic = [
{
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP" ],
"gold": true
},
{
"artist": "1975",
"title": "Robbers",
"release_year": 1975,
"formats": [
"CD",
"Cassette",
"LP"],
"gold": false

  }

];

Norvin Burrus
@ndburrus
Aug 10 2016 05:54
@A8236 tests?
Ian
@A8236
Aug 10 2016 05:54
@ndburrus you mean like that?
@ndburrus still failed
Norvin Burrus
@ndburrus
Aug 10 2016 05:54
@A8236 yes
Ian
@A8236
Aug 10 2016 05:55
@ndburrus oh my bad it worked after i reset
@ndburrus would you care to explain why tho
Norvin Burrus
@ndburrus
Aug 10 2016 05:55
@A8236 why what?
Faisal Zulfiqar
@faisal1337
Aug 10 2016 05:56
http://codepen.io/faisal1337/pen/bZONag?editors=1100 I want to eliminate the horizontal scroll bar. How can I?
Chovin
@Chovin
Aug 10 2016 05:58
blob
does this do it?
Ian
@A8236
Aug 10 2016 05:59
@ndburrus why is the ; so important?
Chovin
@Chovin
Aug 10 2016 06:00
@faisal1337 see pic ^
Norvin Burrus
@ndburrus
Aug 10 2016 06:01
@A8236 that's just like var a = 5; we need to signify the end of the statement...
Faisal Zulfiqar
@faisal1337
Aug 10 2016 06:01
@Chovin um I didn't try that. Just found a thread on SO. Says that place rows inside the container-fluid class. Horizontal Scroll bar is gone now. Thanks anyway @Chovin :)
CamperBot
@camperbot
Aug 10 2016 06:01
faisal1337 sends brownie points to @chovin :sparkles: :thumbsup: :sparkles:
:cookie: 210 | @chovin |http://www.freecodecamp.com/chovin
Ian
@A8236
Aug 10 2016 06:01
@ndburrus but thats only when there are codes after isn't it? to prevent confusion for the next code. if there aren't any more codes subsquently, is the ; really that neccessary?
Chovin
@Chovin
Aug 10 2016 06:01
ah perhaps I should do the same :3
Faisal Zulfiqar
@faisal1337
Aug 10 2016 06:02
@Chovin yeah. Its more simple I guess.
Norvin Burrus
@ndburrus
Aug 10 2016 06:04
@A8236 i think the determining factor is what the engine will accept.
;'s are optional in cases..
Abis Mal
@abisthecodermal
Aug 10 2016 06:06
hey guys need some direction in the challenge: Roman Numeral Converter
Markus Kiili
@Masd925
Aug 10 2016 06:07
@abisthecodermal You could make two arrays with the basis of Roman numerals in numbers and letters, and then iterate the array of numbers and generate the result on the fly.
Ian
@A8236
Aug 10 2016 06:08
@ndburrus ooo alright i think i kinda get it now.. Thanks for all the help man! You're awesome for doing what you're doing!!
CamperBot
@camperbot
Aug 10 2016 06:08
a8236 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 1507 | @ndburrus |http://www.freecodecamp.com/ndburrus
Norvin Burrus
@ndburrus
Aug 10 2016 06:09
@A8236 you're welcome! nice work! i may need some help soon... i've got to get some lessons & projects completed, so i might come knocking! enjoy! :palm_tree:
Jack
@jh0l
Aug 10 2016 06:10
why do my ajax request for IBM bluemix weathercompany API JSON stuff fail and tell me that XMLHttpRequest cannot load https://twcservice.au-syd.mybluemix.net/api/weather/v1/geocode/-37.685860399999996/-37.685860399999996//observations/timeseries.json?hours=1&units=m. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s.codepen.io' is therefore not allowed access.
I have the username and password in the URL
thought that would work
doesn't
here is de codepen
Ian
@A8236
Aug 10 2016 06:13
@ndburrus yup sure no prob, i'll try to be any kind of help i can even though i seriously doubt so hahaha
Norvin Burrus
@ndburrus
Aug 10 2016 06:13
@A8236 :+1:
Abis Mal
@abisthecodermal
Aug 10 2016 06:14
@Masd925. So far I have is
  if(num>3999)
   return "Number out of range. Enter number less than 4000";

  else
  {
    var multiplicationfactor=1;
    var x=0;
    var numString=num.toString();
    var romanRef={
      1:"I",
      4:"IV",
      5:"V",
      9:"IX",
      10:"X",
      40:"XL",
      50:"L",
      90:"XC",
      100:"C",
      400:"CD",
      500:"D",
      900:"CM",
      1000:"M"
    };

    for(var i=0;i<numString.length-1;i++){
      multiplicationfactor*=10;
    }
    if()
    x=Math.floor(num/multiplicationfactor);

    //just to check what each variable returns on the FCC console
    return romanRef[multiplicationfactor];
  }
working on it... can answer questions though...
Markus Kiili
@Masd925
Aug 10 2016 06:15
@abisthecodermal Turning the num into a string is a bad idea.
The order of those numbers is of importance, so an array (or two) is better than a lookup object.
Jack
@jh0l
Aug 10 2016 06:17
pls help
Tilak Raj
@trdhiman
Aug 10 2016 06:18

hi friends , i need your help in Seek and Destroy challenge ,
code is as follows

function destroyer(arr) {
// Remove all the values
var secondArgument = [] ;
var firstArgument = arguments[0];
for (var i = 1 ; i < arguments.length; i++){
secondArgument.push( arguments[i]);
}

 var result =  firstArgument.filter ( function (n){
 return  n !== secondArgument;
 }

 );
 return result; 

instead of projecting filtered array it projected it whole array that is stored in firstArgument .
i tried it in for loop but the result is same .
any suggestion / improvement .........................

Rahul Nayak
@pragyes31
Aug 10 2016 06:19
Hi Guys, I ran into an interesting problem :
Markus Kiili
@Masd925
Aug 10 2016 06:19
@abisthecodermal The logic should be to first check if 1000 is less or equal to num and if it is, generate M and subtract 1000 from num. Repeat until 1000 is greater that num. Then move to 900 etc.
Rahul Nayak
@pragyes31
Aug 10 2016 06:19
var a = 10;

function test(a) { 
    return  this.a;
 } 

 test(); // outputs 10
 test(5); // outputs 10
Can anyone tell me why test(5) is returning 10 and not 5?
denglongwu
@denglongku
Aug 10 2016 06:20

why aren't these codes work?
、、、
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"
};

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

// Change this value to test
phoneticLookup("charlie");
、、、

Markus Kiili
@Masd925
Aug 10 2016 06:20
@pragyes31 Global variables are properties of the global object, and there value of this is the global object.
@pragyes31 The parameter a is not used at all in your code.
@pragyes31 this.a looks for property key "a" on the global object.
Jack
@jh0l
Aug 10 2016 06:22
bluemix won't take my ajax
Rahul Nayak
@pragyes31
Aug 10 2016 06:22
@Masd925 when I am passing a while calling the function, it should refer to a I passed right?
@masd925 I tried a variation and even that outputs to 10. :
function test() { 
var a=5;
    return  this.a;
 }
Markus Kiili
@Masd925
Aug 10 2016 06:23
@pragyes31 this.a is not using variable (parameter) a. It looks for property key "a"
Chen zi tian
@Renkosky
Aug 10 2016 06:23
i'm dealing with "Palindromes",but i can't alert the "\" in palindrome("0_0 (: /-\ :) 0-0");
Jack
@jh0l
Aug 10 2016 06:23
how can I request json from bluemix
Mateusz Szymański
@matszym
Aug 10 2016 06:24
@Jhollond Are you making request on serverside or browser?
Rahul Nayak
@pragyes31
Aug 10 2016 06:25
@Masd925 understood, so it will look for a inside the function scope and then move up to the scope. So Idefind a local variabl with the same name. Now this.a should refer the local object right?
Abis Mal
@abisthecodermal
Aug 10 2016 06:25
@Jhollond If you are working on the weather project. Try open weather's API. Its easier to work. But if you want to use bluemix, you must send a cross-origin request...
Jack
@jh0l
Aug 10 2016 06:25
serverside as in making an app on bluemix that acts as an ajax compatible API?
Rahul Nayak
@pragyes31
Aug 10 2016 06:25
@Masd925 learning how to use this is frustating, sorry for bugging you with silly things
Abis Mal
@abisthecodermal
Aug 10 2016 06:26
using callback=? function will return jsonp instead of json
Jack
@jh0l
Aug 10 2016 06:26
how do I do a cross-origin request?
Abis Mal
@abisthecodermal
Aug 10 2016 06:26
@Jhollond
Markus Kiili
@Masd925
Aug 10 2016 06:26
@pragyes31 this.a is not using a the variable a declared inside the function. this[a] would use variable a
Abis Mal
@abisthecodermal
Aug 10 2016 06:27
there is a cheat and there is lot of work. I cheated. @Jhollond. In your URL (https://whatever) append https://crossorigin.me ;)
for details check codepen.io/abismal @Jhollond
Jack
@jh0l
Aug 10 2016 06:28
but where do I put the username/password in the url?
Markus Kiili
@Masd925
Aug 10 2016 06:28
@pragyes31 Try to ask more specific questions if you need more explanation about that.
Abis Mal
@abisthecodermal
Aug 10 2016 06:29

@Masd925 what if the num is greater than 1000?

@abisthecodermal The logic should be to first check if 1000 is less or equal to num and if it is, generate M and subtract 1000 from num. Repeat until 1000 is greater that num. Then move to 900 etc.

Abis Mal
@abisthecodermal
Aug 10 2016 06:29
nopes @Jhollond
give me the url with http and www and everything
Jack
@jh0l
Aug 10 2016 06:29
okie
Markus Kiili
@Masd925
Aug 10 2016 06:30
@abisthecodermal If num is greater than 1000, you generate M and subtract 1000 from num.
Jack
@jh0l
Aug 10 2016 06:30
pls don't spam my credentials
Abis Mal
@abisthecodermal
Aug 10 2016 06:30
oh! @Masd925
ok wait then @Jhollond
go to this site https://crossorigin.met
and read up.
Rahul Nayak
@pragyes31
Aug 10 2016 06:30
@Masd925 this[a] notation is new to me. All around the web, I have seen this.a. I do not have any specific question. i am just trying to get a good understanding of this keyword. On the web, there are similar examples like the one I posted. the explanation they provide sometimes is vague and half baked atleast to me
Jack
@jh0l
Aug 10 2016 06:31
@abisthecodermal oh fair enough thanks dude
CamperBot
@camperbot
Aug 10 2016 06:31
jhollond sends brownie points to @abisthecodermal :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for abisthecodermal
Jack
@jh0l
Aug 10 2016 06:31
D:
Tilak Raj
@trdhiman
Aug 10 2016 06:31
??
Chovin
@Chovin
Aug 10 2016 06:31
this.something is equivalent to this['something']
object.something
DJ
@qualitymanifest
Aug 10 2016 06:33
@trdhiman secondArgument is an array... no piece of firstArgument is going to be equal to an array
Chovin
@Chovin
Aug 10 2016 06:33
a = 'something'
this.a is not equivalent to
this[a].
rather, it is equivalent to
this['a']
and this[a] would be equivalent to this.something
Rahul Nayak
@pragyes31
Aug 10 2016 06:34
@Chovin ohh...ok :+1:
DJ
@qualitymanifest
Aug 10 2016 06:35
@trdhiman you could use indexOf to check to see if the pieces of firstArgument are present in secondArgument.
Chovin
@Chovin
Aug 10 2016 06:36
apple = {
    cored: false,
    seeds: 4
}
seeds = 'cored'
console.log(apple.seeds)  // 4
console.log(apple['seeds'])  // 4
console.log(apple[seeds])  // false
get it?
Mateusz Szymański
@matszym
Aug 10 2016 06:37
@Jhollond you can add
dataType: 'jsonp',
to ajax options object
Max Zueff
@IvanBot
Aug 10 2016 06:37
Why Is it possible to writing the properties / methods separated by commas?
this.createjs = this.createjs || {},
createjs.extend = function(a, b) { ...
Jack
@jh0l
Aug 10 2016 06:37
@matszym thanks man :)
CamperBot
@camperbot
Aug 10 2016 06:37
jhollond sends brownie points to @matszym :sparkles: :thumbsup: :sparkles:
:cookie: 133 | @matszym |http://www.freecodecamp.com/matszym
Abis Mal
@abisthecodermal
Aug 10 2016 06:37
about @abisthecodermal
CamperBot
@camperbot
Aug 10 2016 06:37
:cookie: 327 | @abisthecodermal |http://www.freecodecamp.com/abisthecodermal
Yan Kozlovskiy
@YanKozlovskiy
Aug 10 2016 06:38
Could someone please pair up with me and explain to me how closures work?
Abis Mal
@abisthecodermal
Aug 10 2016 06:41
@Jhollond did you find what you were looking for?
Mateusz Szymański
@matszym
Aug 10 2016 06:41

@IvanBot
You can generate array of keys with this method
Object.keys(yourObject)
You can also iterate ofver all keys with for loop

for(var key in yourObject) { 
  console.log(key);
}

If you want only properties/methods that belongs to object, and not prototype, you can use hasOwnProperty method

for (var key in yourObject) {
  if(yourObject.hasOwnProperty(key) {
    console.log(key);
  }
}
Jack
@jh0l
Aug 10 2016 06:42
@abisthecodermal ya it seems to work but now I don't know how to refer to the JSON elements
Abis Mal
@abisthecodermal
Aug 10 2016 06:42
https://crossorigin.mehttps://www.google.com This is how you make a cross origin request using crossorigin.me.
Jack
@jh0l
Aug 10 2016 06:42
a bit different than quotes
Abis Mal
@abisthecodermal
Aug 10 2016 06:42
Thanks to @sorinr who came up with it
CamperBot
@camperbot
Aug 10 2016 06:42
abisthecodermal sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 646 | @sorinr |http://www.freecodecamp.com/sorinr
thank u @sorinr
CamperBot
@camperbot
Aug 10 2016 06:43
jhollond sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 647 | @sorinr |http://www.freecodecamp.com/sorinr
Abis Mal
@abisthecodermal
Aug 10 2016 06:43
anyways. What's the problem with json now?
Jack
@jh0l
Aug 10 2016 06:44
how do I use this
blob
I need to use the data in the observations element
Markus Kiili
@Masd925
Aug 10 2016 06:45
@matszym What you said is true, but iterating Object.keys() is much better than using for...in and .hasOwnProperty(), because the prototype chain is not considered.
pahosler
@pahosler
Aug 10 2016 06:47
@Jhollond var temp = data.observations.temp
data or whatever variable you did your call with
Tilak Raj
@trdhiman
Aug 10 2016 06:48
@qualitymanifest , but how to pass elements of secondArgument to filter ...
Jack
@jh0l
Aug 10 2016 06:48
@pahosler oh
dots instead of square brackets
righ
right
Mateusz Szymański
@matszym
Aug 10 2016 06:48
@pahosler he got array in response
Jack
@jh0l
Aug 10 2016 06:49
it's like an array within an object
idk
:grimacing:
Mateusz Szymański
@matszym
Aug 10 2016 06:49
@Jhollond var temp = data.observations[0].temp
DJ
@qualitymanifest
Aug 10 2016 06:49
@trdhiman you check to see if the elements of secondArgument are present in firstArgument using indexOf.
Jack
@jh0l
Aug 10 2016 06:50
@matszym sweet thanks so much dood!!!
CamperBot
@camperbot
Aug 10 2016 06:50
jhollond sends brownie points to @matszym :sparkles: :thumbsup: :sparkles:
:warning: jhollond already gave matszym points
pahosler
@pahosler
Aug 10 2016 06:50
oh yeah, I see teh array now
Jack
@jh0l
Aug 10 2016 06:53
@matszym wait but the console log says that the array with the weather data in it is Array[1] is it still xamarin/xamarin-android@a16673d?
Mohd Zafar
@zaifzafar
Aug 10 2016 06:53

// Setup
function abTest(a, b) {
// Only change code below this line
if(a < 0 || b<0)
{
return "undefined";
}

// Only change code above this line

return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}

// Change values below to test your code
abTest(2,2);

Jack
@jh0l
Aug 10 2016 06:53
  • [0[
Darth Skywalker
@adityaparab
Aug 10 2016 06:53

@zaifzafar :smile:

if(a < 0 || b<0)

Should be

if(a < 0 && b<0)
Mateusz Szymański
@matszym
Aug 10 2016 06:53
@Jhollond It is
Mohd Zafar
@zaifzafar
Aug 10 2016 06:54

// Setup
function abTest(a, b) {
// Only change code below this line
if(a < 0 || b<0)
{
return "undefined";
}

// Only change code above this line

return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}

// Change values below to test your code
abTest(2,2); I am getting this Error.. please Help me guys
abTest(2,2) should return a number
abTest(2,2) should return 8
abTest(-2,2) should return undefined (Error in this line)
abTest(2,-2) should return undefined (Error in this line)
abTest(2,8) should return 18
abTest(3,3) should return 12

Mark Todd
@Knochenmark
Aug 10 2016 06:56
@Jhollond which api you use?
Mohd Zafar
@zaifzafar
Aug 10 2016 06:56
guys help me to solve this problem
Norvin Burrus
@ndburrus
Aug 10 2016 06:56
@zaifzafar lesson name?
Sorin Ruse
@sorinr
Aug 10 2016 06:56
@abisthecodermal the fix its just temp coz if that site is down your app is down :)
Jack
@jh0l
Aug 10 2016 06:56
IBM bluemix weathercompany @Knochenmark
Mohd Zafar
@zaifzafar
Aug 10 2016 06:57
@ndburrus Return Early Pattern for Functions
@ndburrus in javaScript Chapter
Jack
@jh0l
Aug 10 2016 06:58
this is rly confusing
Darth Skywalker
@adityaparab
Aug 10 2016 06:58

@zaifzafar : There are two problems

1)

if(a < 0 || b<0)

Should be

if(a < 0 && b<0)

2)

return "undefined";

Should be

return undefined;
Sorin Ruse
@sorinr
Aug 10 2016 06:58
one more that its working both on http and https its http://www.apixu.com/ and they have also a free plan
Norvin Burrus
@ndburrus
Aug 10 2016 06:58
@zaifzafar ok, wait.... undefined is a keyword, no quotes
Jack
@jh0l
Aug 10 2016 06:58
data.observations works but any way I try to access specific stuff in observations does not
Darth Skywalker
@adityaparab
Aug 10 2016 06:59
@sorinr : You should really get their platinum plan :P
Mark Todd
@Knochenmark
Aug 10 2016 06:59
@Jhollond do you need some api key or so?
Jack
@jh0l
Aug 10 2016 06:59
@Knochenmark ya
Mark Todd
@Knochenmark
Aug 10 2016 06:59
crap
Mohd Zafar
@zaifzafar
Aug 10 2016 07:00
@adityaparab not fixed problem with your answer
Mateusz Szymański
@matszym
Aug 10 2016 07:00
@Jhollond send us codepen link and note with ocmment where to problem is
Mark Todd
@Knochenmark
Aug 10 2016 07:00
@Jhollond i think it was like data.observations[0].wx_phrase for example
Jack
@jh0l
Aug 10 2016 07:00
alright so I think it might work if I just assign the JSON.stringify observations element to another variable
Abis Mal
@abisthecodermal
Aug 10 2016 07:00
@sorinr, a project for me is like a mount everest. Once i scaled it, it does not matter if I flag is there. That flag can be thrown to winds for all I care :laughing:
Jack
@jh0l
Aug 10 2016 07:00
and then it's just an object
Norvin Burrus
@ndburrus
Aug 10 2016 07:00
@zaifzafar :point_up: August 10, 2016 2:58 AM
still need to apply fixes I just thought of
Mohd Zafar
@zaifzafar
Aug 10 2016 07:02
@ndburrus i change it with keuword
Mark Todd
@Knochenmark
Aug 10 2016 07:02
@Jhollond theres no output at all
@Jhollond i dont get anything in console
Jack
@jh0l
Aug 10 2016 07:02
@Knochenmark did u press the non-responsive gps button?
Norvin Burrus
@ndburrus
Aug 10 2016 07:02
@zaifzafar remove quotes from undefined... and test.
Darth Skywalker
@adityaparab
Aug 10 2016 07:02

@Jhollond

alert(err);

Should be

alert(JSON.stringify(err));
Mateusz Szymański
@matszym
Aug 10 2016 07:02
@Jhollond you transformed your response into string, no wonder you have problems. Why did you do that?
weather_Ob = JSON.stringify(data.observations);
Mark Todd
@Knochenmark
Aug 10 2016 07:03
@Jhollond haha ok, but the crossorigin isnt working for me
@Jhollond someone else used that thing too and wasnt working for me there too
Mohd Zafar
@zaifzafar
Aug 10 2016 07:03
@ndburrus i already remove quotes .. but i still get same error
Jack
@jh0l
Aug 10 2016 07:03
@matszym oh
idk
I'll undo that
Sorin Ruse
@sorinr
Aug 10 2016 07:04
@adityaparab nope. just make one call. grab the json put it in a var and work on that var not directly to the api until you have finished the app
Mateusz Szymański
@matszym
Aug 10 2016 07:04
@Jhollond less is better, try to write least ammount of code possible
Darth Skywalker
@adityaparab
Aug 10 2016 07:04

@sorinr :smile:

Well this is your problem

weather_Ob = JSON.stringify(data.observations);

Not need to stringify it

Jack
@jh0l
Aug 10 2016 07:05
okay I think I might have overloaded my quota
brb
Noor Sheikh
@noorsheikh
Aug 10 2016 07:06
Hi Friends, the Counting Cards in not working can u guys please help me in not parse from the step 4 and onward
Sorin Ruse
@sorinr
Aug 10 2016 07:08
@adityaparab as you saw. i'me returning data from a php file. i really don't remember why the h**l i was using stringify by that time but i will take a look back and make necessary changes. thank you
CamperBot
@camperbot
Aug 10 2016 07:08
sorinr sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 537 | @adityaparab |http://www.freecodecamp.com/adityaparab
Jack
@jh0l
Aug 10 2016 07:12
@matszym ya
: D
Mark Todd
@Knochenmark
Aug 10 2016 07:12
@noorsheikh can you link the code?
Jack
@jh0l
Aug 10 2016 07:12
okay so
I assigned the observations object of the data JSON object to another variable (without stringifying lol)
Norvin Burrus
@ndburrus
Aug 10 2016 07:13
@zaifzafar ok, evaluate a vs 0, and b vs 0 separately..
Jack
@jh0l
Aug 10 2016 07:13
but now I don't know how to access this new variables contents still
Norvin Burrus
@ndburrus
Aug 10 2016 07:13
@noorsheikh code?
Jack
@jh0l
Aug 10 2016 07:14
weather_Ob."feels_like" or weather_Ob.feels_like or weather_Ob["feels_like"] doesn't work
Mateusz Szymański
@matszym
Aug 10 2016 07:15
@Jhollond weather_Ob[0].feels_like
Jack
@jh0l
Aug 10 2016 07:17
[{"key":"SBPA","class":"observation","expire_time_gmt":1470819600,"obs_id":"SBPA","obs_name":"Porto Alegre","valid_time_gmt":1470812400,"day_ind":"N","temp":10,"wx_icon":33,"icon_extd":3300,"wx_phrase":"Fair","pressure_tend":null,"pressure_desc":null,"dewPt":9,"heat_index":10,"rh":94,"pressure":1022.64,"vis":9,"wc":10,"wdir":300,"wdir_cardinal":"WNW","gust":null,"wspd":4,"max_temp":null,"min_temp":null,"precip_total":null,"precip_hrly":null,"snow_hrly":null,"uv_desc":"Low","feels_like":10,"uv_index":0,"qualifier":null,"qualifier_svrty":null,"blunt_phrase":null,"terse_phrase":null,"clds":"CLR"}]
this is the object
Norvin Burrus
@ndburrus
Aug 10 2016 07:17
@zaifzafar how is it going?
Jack
@jh0l
Aug 10 2016 07:17
@matszym AYE IT WORKS
you da best
@matszym thank you
CamperBot
@camperbot
Aug 10 2016 07:18
jhollond sends brownie points to @matszym :sparkles: :thumbsup: :sparkles:
:warning: jhollond already gave matszym points
Jack
@jh0l
Aug 10 2016 07:21
@matszym thanks so much! it's working now :DDD
CamperBot
@camperbot
Aug 10 2016 07:21
jhollond sends brownie points to @matszym :sparkles: :thumbsup: :sparkles:
:warning: jhollond already gave matszym points
Abis Mal
@abisthecodermal
Aug 10 2016 07:21
 var romanRef={
      1:"I",
      4:"IV",
      5:"V",
      9:"IX",
      10:"X",
      40:"XL",
      50:"L",
      90:"XC",
      100:"C",
      400:"CD",
      500:"D",
      900:"CM",
      1000:"M"
    };
    if(romanRef.hasOwnPropery(num)){
      romanNum+=romanRef[num];
      return romanNum;
    }
Any idea why this returns the error : romanRef.hasOwnPropery is not a function
Markus Kiili
@Masd925
Aug 10 2016 07:22
@abisthecodermal Property not Propery
Max Zueff
@IvanBot
Aug 10 2016 07:24
How to track the order of function calls in JavaScript?
Mateusz Szymański
@matszym
Aug 10 2016 07:25
@IvanBot debugger?
Abis Mal
@abisthecodermal
Aug 10 2016 07:25
damn!!!
I must go and kill myself now...
Darth Skywalker
@adityaparab
Aug 10 2016 07:25
@IvanBot : Check call stack in your debugger tool
Abis Mal
@abisthecodermal
Aug 10 2016 07:26
thanks @Masd925
CamperBot
@camperbot
Aug 10 2016 07:26
abisthecodermal sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2267 | @masd925 |http://www.freecodecamp.com/masd925
Mateusz Szymański
@matszym
Aug 10 2016 07:26
@Masd925 See what you did? Give a man purpose to live now :D
Norvin Burrus
@ndburrus
Aug 10 2016 07:26
@matszym lol
Markus Kiili
@Masd925
Aug 10 2016 07:29
@matszym :)
z1991817
@z1991817
Aug 10 2016 07:48
hello
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "";
  // Your code below this line


  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
How to do this lesson
Bilyan Hadzhi
@bilyanhadzhi
Aug 10 2016 07:51
@z1991817 Update result's value to a string that contains the parameters (myNoun, myAdjective, myVerb, myAdverb)
@z1991817 Remember, you can concatenate a string with variables using +
var example = "Hello " + name; //note the space after "Hello"
Mark Todd
@Knochenmark
Aug 10 2016 07:54
@z1991817 on the left theres a description how the string should look, just combine the string together with the variables and whitespaces inbetween
@z1991817 some thing like result = "" + myNoun + " " + myAdjective + " " + "Blablabla" :D
z1991817
@z1991817
Aug 10 2016 07:56
Thank you, I try
Ahmad Abdolsaheb
@ahmadabdolsaheb
Aug 10 2016 08:10
hello everyone, one of my exercises freezes "Smallest Common Multiple" and i cannot press any button of insert any code , the other challenges are fine tho. does anyone know what to do?
Benjam Wondafrash
@BenjamWondafrash
Aug 10 2016 08:14
/Rant/ I found a thing I REALLY DON'T LIKE in js. We have two functions 'substr()' and 'substring()' with different functionality.
Tyler Conoff
@Yoplay8
Aug 10 2016 08:14
@ahmadabdolsaheb did you make an infinte loop?
Benjam Wondafrash
@BenjamWondafrash
Aug 10 2016 08:14
Is there more functions named like this?
@Yoplay8 must be
Tyler Conoff
@Yoplay8
Aug 10 2016 08:16
@ahmadabdolsaheb Try clicking on another challenge and then navagate back to the broken challenge and click on reset code
chapman2187
@chapman2187
Aug 10 2016 08:18
Looking for some help on Finding a remiander, don't know what to do?