These are chat archives for FreeCodeCamp/HelpJavaScript

20th
Mar 2017
Ray Martinez
@rayjrm
Mar 20 2017 00:02
whats the difference between a object property name being a string or not?
AstralWoof
@AstralWoof
Mar 20 2017 00:02
@sjames1958gm thanks for the help
CamperBot
@camperbot
Mar 20 2017 00:02
astralwoof sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6248 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Dan Couper
@DanCouper
Mar 20 2017 00:04
@rayjrm there are lots and lots of design pattern books, for OO design - head first design patterns is the one that gets recommended. However these are for general Object Oriented design. Best advice is find something you want to make and make it; it'll be very painful, and you'll fail a lot, but unless you're making a real thing, you're not going to understand why you might need a lot of things. Like frameworks: unless you're building an actual thing, it often difficult to see the point of them. They often abstract a common pattern/need. React is a mainly a pattern for structuring interface (UI) code, for example. The projects on FCC are pretty good; you can expand on them a lot - say the tic tac toe game, you could find out how to host that as an app, allow people to log in and play each other, and have their scores saved, etc. All that would make the project really hard, but you'd learn a lot. Or just work out how to get it running locally using a node development environment. Or simply try putting the project on glitch (https://glitch.com/) of codepen, figure out how a basic node server works
Jor
@joreyesl
Mar 20 2017 00:04
@rayjrm all object properties are strings
Ray Martinez
@rayjrm
Mar 20 2017 00:05
@DanCouper wow thank you
CamperBot
@camperbot
Mar 20 2017 00:05
rayjrm sends brownie points to @dancouper :sparkles: :thumbsup: :sparkles:
:cookie: 553 | @dancouper |http://www.freecodecamp.com/dancouper
Ray Martinez
@rayjrm
Mar 20 2017 00:06
@joreyesl In the object building exercise on FCC the example looks like this:
// Example
var ourDog = {
  "name": "Camper",
  "legs": 4,
  "tails": 1,
  "friends": ["everything!"]
};
Dan Couper
@DanCouper
Mar 20 2017 00:06
@rayjrm object property names are always either strings (or Symbols, but you're not likely to need to know about symbols at this stage), so treat them all as strings
Spyrantis Theodoros
@thodorisanta
Mar 20 2017 00:07

okay i dont understand this, wasnt it suppose to show anything in the console till now?cause nothings changes for me

http://codepen.io/oshikurou/pen/YZrqBy?editors=1011

Ray Martinez
@rayjrm
Mar 20 2017 00:07

why not

```
var obj = {
name: "Camper"
};

Jor
@joreyesl
Mar 20 2017 00:07
@rayjrm {"key" : "value"} is the same as {key: "value"}
Dan Couper
@DanCouper
Mar 20 2017 00:07
That's valid, but it's still a string underneath
Dan Couper
@DanCouper
Mar 20 2017 00:07
It's just to make it easier to type
Avery Biskup
@fraknard
Mar 20 2017 00:08
How can I test each name in the getJSON command?
Ray Martinez
@rayjrm
Mar 20 2017 00:08
is it ever neccesary to type the name out like a string?
Jor
@joreyesl
Mar 20 2017 00:08
@rayjrm no its not, but internally it will be a string
Dan Couper
@DanCouper
Mar 20 2017 00:08
If it's not a valid identifier
Gimme a sec, I'll get you a list
var myObj = { E̴̷̬͎̱̘͇͍̾ͦ͊͒͊̓̓̐_̫̠̱̩̭̤͈̑̎̋ͮͩ̒͑̾͋͘Ç̳͕̯̭̱̲̣̠̜͋̍O̴̦̗̯̹̼ͭ̐ͨ̊̈͘͠M̶̝̠̭̭̤̻͓͑̓̊ͣͤ̎͟͠E̢̞̮̹͍̞̳̣ͣͪ͐̈T̡̯̳̭̜̠͕͌̈́̽̿ͤ̿̅̑Ḧ̱̱̺̰̳̹̘̰́̏ͪ̂̽͂̀͠: 1 } that should work
Dunno how you'd type it like
var anObj = { ಠ_ಠ: 'im a property' };
Brian
@BrianCodes33
Mar 20 2017 00:13

function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  for (var i = 0; i < collection.length; i++) {
  if (collection[i].hasOwnProperty(source)) {
     arr.push(collection);   
   }
  return arr;
  }
}

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
any help here
Dan Couper
@DanCouper
Mar 20 2017 00:14
@rayjrm this lets you check if something is a valid identifier: https://mothereff.in/js-variables#%E0%B2%A0%5f%E0%B2%A0
If it isn't (for example if it's a number, or it starts with a number, etc) you surround it in quotes
JDW
@jd-wheaton
Mar 20 2017 00:15
@BrianCodes33 which challenge is that?
Ray Martinez
@rayjrm
Mar 20 2017 00:16
What about capitals, i noticed in lessons that Object constructors are always capitalized, is that just common practice?
Dan Couper
@DanCouper
Mar 20 2017 00:16
@rayjrm that's for variables, but basically same rules apply for object property names
For constructors
jonathangrieving
@jonathangrieving
Mar 20 2017 00:16
hi guys
Dan Couper
@DanCouper
Mar 20 2017 00:16
You use capitals as a con
vention
Ray Martinez
@rayjrm
Mar 20 2017 00:16
gotcha
jonathangrieving
@jonathangrieving
Mar 20 2017 00:17
i'm just starting the web development course
Dan Couper
@DanCouper
Mar 20 2017 00:17
It doesn't actually make any difference
Ray Martinez
@rayjrm
Mar 20 2017 00:17
just a good visual cue
Dan Couper
@DanCouper
Mar 20 2017 00:17
Yup yup
jonathangrieving
@jonathangrieving
Mar 20 2017 00:17
do you know why sublime text doesn't complete the HTML format when i press tab as Colt did at the beginning of the course?
i mean
i wrote html
after pressing tab it should've autocompleted
HTML format right?
Ray Martinez
@rayjrm
Mar 20 2017 00:19
and your preferences for auto complete are enabled currently?
Dan Couper
@DanCouper
Mar 20 2017 00:20
@rayjrm there aren't actually that many rules in JS, which is both good in that you're free to do anything, and bad in that you're free to do anything. Like a lot of other languages are strict about format of names; JS just lets you do what you want as long as it's a string, and often doesn't even tell you you're doing anything wrong, just silently does nothing :worried:
Ray Martinez
@rayjrm
Mar 20 2017 00:21
haha yeah ive read that js can be too lax
not so literal like csharp
Spyrantis Theodoros
@thodorisanta
Mar 20 2017 00:22

im working on the twitch api
where does it say in the console if the user is online or not?

http://codepen.io/oshikurou/pen/YZrqBy?editors=1011

Ray Martinez
@rayjrm
Mar 20 2017 00:23
I wanted to learn c# because I want to makes games ultimately, but javascript seems easier, even though its crazy difficult for as my first scripting language
Steven
@LemonTruth
Mar 20 2017 00:26
hey, can someone pls help?
Joseph
@revisualize
Mar 20 2017 00:26
With?
Steven
@LemonTruth
Mar 20 2017 00:26
umm, lemme send the link
JenimDacket
@JenimDacket
Mar 20 2017 00:26
Is there any advice anyone can give me before I start Ceasers Cipher?
Joseph
@revisualize
Mar 20 2017 00:26
@LemonTruth Okay.
JenimDacket
@JenimDacket
Mar 20 2017 00:27
Also, is anyone else starting this now and wants to work together?
Joseph
@revisualize
Mar 20 2017 00:27
@LemonTruth What have you done so far?
Steven
@LemonTruth
Mar 20 2017 00:27
my code:
function nextInLine(arr, item) {
// Your code here
testArr.push(item);
testArr.shift();
return arr[0]; // Change this line
}
Joseph
@revisualize
Mar 20 2017 00:27
@LemonTruth Question.
@LemonTruth Why are you using testArr?
Steven
@LemonTruth
Mar 20 2017 00:28
because I'm manipulating that array
Joseph
@revisualize
Mar 20 2017 00:28
@LemonTruth There is only 1 test where testArr is passed to the function as the arr parameter
Steven
@LemonTruth
Mar 20 2017 00:28
please elaborate
i would appreciate it
Joseph
@revisualize
Mar 20 2017 00:29
@LemonTruth Look:
Write a function nextInLine which has two parameters
an array (arr) and a number (item).
That part has been done for you here:
function nextInLine(arr, item) { }
@LemonTruth arr is the parameter .. not testArr
Jor
@joreyesl
Mar 20 2017 00:29
@JenimDacket look at charCodeAt() and String.fromCharCode() and use ascii table for reference.
Steven
@LemonTruth
Mar 20 2017 00:29
aaaaaaaah, I see
Joseph
@revisualize
Mar 20 2017 00:30
@LemonTruth Okay.. What do you have now?
Steven
@LemonTruth
Mar 20 2017 00:31
wait, are you saying testArr should be replaced with arr? @revisualize
Joseph
@revisualize
Mar 20 2017 00:31
@LemonTruth yes.
Steven
@LemonTruth
Mar 20 2017 00:31
okay, I did that exaclty
Joseph
@revisualize
Mar 20 2017 00:32
What do you have now?
@LemonTruth Okay. by removing the first element then returning arr[0] .. What are you actually returning?
@LemonTruth Actually... Let's handle this a different way.
Steven
@LemonTruth
Mar 20 2017 00:32
the latter arr[0]
Joseph
@revisualize
Mar 20 2017 00:33
@LemonTruth Do you have a little bit to answer some very quick to the point questions?
Steven
@LemonTruth
Mar 20 2017 00:33
so do I put arr[0] on top?
yshanker
@yshanker
Mar 20 2017 00:33
Your regular expression should find two occurrences of the word and.
Use regular expressions to find the word and in testString.
Steven
@LemonTruth
Mar 20 2017 00:33
@revisualize I do
Joseph
@revisualize
Mar 20 2017 00:33
Okay
yshanker
@yshanker
Mar 20 2017 00:33
how to write the code for this one
Joseph
@revisualize
Mar 20 2017 00:33
@LemonTruth Quick easy answers.. Just hit to it.. Okay?
Steven
@LemonTruth
Mar 20 2017 00:33
okeh
Joseph
@revisualize
Mar 20 2017 00:33

@LemonTruth

function getName() { return "Happy Feet" }
var name = getName();
console.log(name);

What do you think is output to the console when you log the variable name?

@LemonTruth Why do you think that is?
Steven
@LemonTruth
Mar 20 2017 00:34
wait, you can set return as a paremeter?
Joseph
@revisualize
Mar 20 2017 00:35
@LemonTruth No.
Steven
@LemonTruth
Mar 20 2017 00:35
oh wait, read it wrong
Joseph
@revisualize
Mar 20 2017 00:36
I need to go get some food.
Steven
@LemonTruth
Mar 20 2017 00:36
so does it simply return happy feet
Joseph
@revisualize
Mar 20 2017 00:36
@LemonTruth Why? <-- This is actually the answer that I need
Steven
@LemonTruth
Mar 20 2017 00:37
because you set name to the function itself, and the function itself returns happy feet
so name returns happy feet
Joseph
@revisualize
Mar 20 2017 00:38
@LemonTruth Great. All functions and methods return something.. You can choose to use it or not. When you did
arr.push(item); you're not actually using the value returned by the .push() method call.
But, in the case of this lesson..
You need to return the element that was removed from the arr

The push() method adds one or more elements to the end of an array and returns the new length of the array.

The pop() method removes the last element from an array and returns that element.

The unshift() method adds one or more elements to the beginning of an array and returns the new length of the array.

The shift() method removes the first element from an array and returns that element.

@LemonTruth You need to return the element removed from the array.
Steven
@LemonTruth
Mar 20 2017 00:39
so then I do put the return statement on top?
Joseph
@revisualize
Mar 20 2017 00:40
@LemonTruth No.
Steven
@LemonTruth
Mar 20 2017 00:40
okay, gimme a sec
Joseph
@revisualize
Mar 20 2017 00:40
@LemonTruth return statements cause the function to HALT
Steven
@LemonTruth
Mar 20 2017 00:40
yes, yes
Joseph
@revisualize
Mar 20 2017 00:40
Once a return statement is hit. It HALTS the function.
Steven
@LemonTruth
Mar 20 2017 00:41
okay, and I assume that's why you asked me that question x)
ahh okay, so I'd use shift to return the first value of the array
Joseph
@revisualize
Mar 20 2017 00:45
@LemonTruth Did you try it?
Joseph
@revisualize
Mar 20 2017 00:45
@LemonTruth You're not returning anything.
Ergo, you're returning undefined
Joseph
@revisualize
Mar 20 2017 00:47
@LemonTruth Now you're removing two elements from the array.
The shift() method removes the first element from an array and returns that element.
Steven
@LemonTruth
Mar 20 2017 00:49
So why can't I simply do this?
Joseph
@revisualize
Mar 20 2017 00:50
@LemonTruth Because your function has no RETURN statement. And when a function has no return statement it returns undefined
The return statement ends function execution and specifies a value to be returned to the function caller.
Syntax
return [[expression]];
expression
The expression to return. If omitted, undefined is returned instead.
Steven
@LemonTruth
Mar 20 2017 00:52
I see what you mean
so I must have a return but I cannot use shift again or it will shift the already shifted array
so...
Joseph
@revisualize
Mar 20 2017 00:55
@LemonTruth just return the shift
Moustapha
@moustaflo
Mar 20 2017 00:56

I am almost there but right now my final return echo's an array of just the first letters:

function titleCase(str) {
var toLower = str.toLowerCase();
var toArr = toLower.split(" ");
var secArr = [];
for(x=0; x<toArr.length;x++){
var newArr = toArr[x].charAt(0).toUpperCase();
secArr.push(newArr);
}

return secArr;
}

titleCase("I'm a little tea pot");

Joseph
@revisualize
Mar 20 2017 00:56
@LemonTruth You don't need to shift twice.
I need food. I'm going to get some.
Steven
@LemonTruth
Mar 20 2017 00:56
okay, enjoy the food
Joseph
@revisualize
Mar 20 2017 00:57
@LemonTruth You have the lesson solved you just need to solve it.
@LemonTruth Good luck.
Steven
@LemonTruth
Mar 20 2017 00:57
thx see yah ;)
Joseph
@revisualize
Mar 20 2017 00:58
Thanks @camperbot
CamperBot
@camperbot
Mar 20 2017 00:58
:star2: 3115 | @camperbot |http://www.freecodecamp.com/camperbot
revisualize sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
Steven
@LemonTruth
Mar 20 2017 00:59
thanks @revisualize
CamperBot
@camperbot
Mar 20 2017 00:59
lemontruth sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3553 | @revisualize |http://www.freecodecamp.com/revisualize
Samuel Culpepper
@qzdl
Mar 20 2017 01:26
finding this difficult

// Setup
var outerWear = "T-Shirt";

function myOutfit() {
  // Only change code below this line

  var myOutfit = outerWear;
  outerWear = "Sweater";


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

myOutfit();
"Do not change the value of the global outerWear
myOutfit should return "sweater"
Do not change the return statement"
Pagnito
@Pagnito
Mar 20 2017 01:28
damn ya'll gotta check out this website weedmaps.com....that shit is dope. i love the mobile nav bar
im not advertising lol
i just came across it and damn i cant wait till i can fully develop something like that
although i can do most of the frontend, theres afew things i cant, still love the color patterns there too
Samuel Culpepper
@qzdl
Mar 20 2017 01:30
@Pagnito look at this site http://apparatusstudio.com/
beautiful
Pagnito
@Pagnito
Mar 20 2017 01:32
@qzdl nice, i alrdy like the x lettin me know i can just click outside of the nav to close it
@qzdl do you know what html framework they used?
Moustapha
@moustaflo
Mar 20 2017 01:33

I am almost there but right now my final return echo's an array of just the first letters:

function titleCase(str) {
var toLower = str.toLowerCase();
var toArr = toLower.split(" ");
var secArr = [];
for(x=0; x<toArr.length;x++){
var newArr = toArr[x].charAt(0).toUpperCase();
secArr.push(newArr);
}

return secArr;
}

titleCase("I'm a little tea pot");

Pagnito
@Pagnito
Mar 20 2017 01:36
@qzdl im looking at the source code and i dunno if im crazy but it looks like they had they own apparatus framework
Samuel Culpepper
@qzdl
Mar 20 2017 01:37
@Pagnito Theme Name: Apparatus
Author: Jonathan Nicol
Author URI: http://jonathannicol.com
Description: Custom Wordpress theme for Apparatus
Version: 1.0
License: GNU General Public License
License URI: license.txt
Text Domain: apparatus
Domain Path: /languages/
native then?? in-house design
from scratch??
Pagnito
@Pagnito
Mar 20 2017 01:39
@qzdl looks like right? im lookin at the same link right now tryin figure out what im lookin at exactly, u think thats a css file?
Samuel Culpepper
@qzdl
Mar 20 2017 01:41
@Pagnito oh nah it's woocommerce lmao
Pagnito
@Pagnito
Mar 20 2017 01:42
oooh lol
@qzdl still those someone had to make it initially
@qzdl so is that a site where you just buy themes?
Samuel Culpepper
@qzdl
Mar 20 2017 01:43
@Pagnito yeah but it would have been more impressive if an inhouse designer did all of that with no framework haha
@Pagnito wordpress theme farms are easy money
Pagnito
@Pagnito
Mar 20 2017 01:44
@qzdl hell yea thats mad respect right there
Rada
@Radascript
Mar 20 2017 01:44
@qzdl I'm kinda not crazy about their design tbh. It's striking in some ways sure but I find the crosshairs pointer weird, and on desktop I want to be able to scroll and have menu easily accessible at the same time
Pagnito
@Pagnito
Mar 20 2017 01:44
@qzdl yea tho alot of emplyers seem to want ppl to kow how to use wordpress.
Rada
@Radascript
Mar 20 2017 01:45
@qzdl and the white space in the bottom right corner seems like a blunder
Pagnito
@Pagnito
Mar 20 2017 01:46
@Radascript yea i see that, tho it only seems on that one page. i think its cuz its rows like bootstrap
@Radascript check out weedmaps.com tho, that shit is mad dope
@Radascript on my mobile it even changed the whole color of my browser
@Pagnito aand my phone nav bar lol
@Pagnito oh nvm about the browser and phone nav bar, it changes with every site lol
Keon Samuel
@keonsam
Mar 20 2017 01:51

function nextInLine(arr, item) {
arr.shift();
arr.push(item);// Your code here

return arr.shift(); // Change this line
}

// Test Setup
var testArr = [1,2,3,4,5];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

Rada
@Radascript
Mar 20 2017 01:51
@Pagnito yeah I think when you need to catch your client's eye, it's probably a good solution, but for a content-based site it's an overkill
Keon Samuel
@keonsam
Mar 20 2017 01:51
someone help with that
Pagnito
@Pagnito
Mar 20 2017 01:52
@Radascript oh nice, never heard of pingdom before thanks
CamperBot
@camperbot
Mar 20 2017 01:52
:cookie: 397 | @radascript |http://www.freecodecamp.com/radascript
pagnito sends brownie points to @radascript :sparkles: :thumbsup: :sparkles:
Johnny
@JohnnyBizzel
Mar 20 2017 01:54
@keonsam Hi. What did you try?
Keon Samuel
@keonsam
Mar 20 2017 01:54
Stand in Line
I just need the code lol
Johnny
@JohnnyBizzel
Mar 20 2017 01:55
@keonsam what does shift do?
Keon Samuel
@keonsam
Mar 20 2017 01:55
take the first element off an array
Johnny
@JohnnyBizzel
Mar 20 2017 01:55
@keonsam you seem to be doing that twice
Keon Samuel
@keonsam
Mar 20 2017 01:56
what I got to do store it in a var?
Johnny
@JohnnyBizzel
Mar 20 2017 01:57
@keonsam You don't have to
@keonsam removing one line of code & it should pass.
Marie Walker
@LMarieWalker
Mar 20 2017 01:58
I am stuck on this excercise, can someone give me a hint or example? I don't understand what it is asking for. Thanks https://goo.gl/55WZYV
Johnny
@JohnnyBizzel
Mar 20 2017 01:59

@dRaGoN-LMW

Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.

Marie Walker
@LMarieWalker
Mar 20 2017 02:01
@JohnnyBizzel thanks
Johnny
@JohnnyBizzel
Mar 20 2017 02:02
@dRaGoN-LMW Do you understand now?
Marie Walker
@LMarieWalker
Mar 20 2017 02:02
this is what i have if ((a || b) < 0) {
console.log(a + b);
return "undefined";
}
eduwin7
@eduwin7
Mar 20 2017 02:04
hi all
need help

var oldArray = [1,2,3,4,5];

// Only change code below this line.
var newArray = oldArray.map(function(val){
newArray = val + 3;
return oldArray;
});
var newArray = oldArray;

my map function is not adding 3 to my oldArray
anyone knows hy ?
why
Johnny
@JohnnyBizzel
Mar 20 2017 02:05

@dRaGoN-LMW You can take undefined out of quotes. The hint is there.

Hint
Remember that undefined is a keyword, not a string.

HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 02:05
@eduwin7 quite a few reasons
eduwin7
@eduwin7
Mar 20 2017 02:05
can you help me please
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 02:06
do you undertand what the map method does?
Johnny
@JohnnyBizzel
Mar 20 2017 02:06
@eduwin7 Does map take a callback function?
Keon Samuel
@keonsam
Mar 20 2017 02:06
@JohnnyBizzel thanks man keep up the good work.
CamperBot
@camperbot
Mar 20 2017 02:06
keonsam sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1521 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Johnny
@JohnnyBizzel
Mar 20 2017 02:06
@keonsam :+1:
eduwin7
@eduwin7
Mar 20 2017 02:06
it suppose to iterate through the array

Iterate over Arrays with map
The map method is a convenient way to iterate through arrays. Here's an example usage:

var oldArray = [1, 2, 3];
var timesFour = oldArray.map(function(val){
return val * 4;
});
console.log(timesFour); // returns [4, 8, 12]
console.log(oldArray); // returns [1, 2, 3]
The map method will iterate through every element of the array, creating a new array with values that have been modified by the callback function, and return it. Note that it does not modify the original array.

koskaras
@koskaras
Mar 20 2017 02:07
why palindrome("1 eye for of 1 eye.") should return false?
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 02:07
@eduwin7 yes and apply the callback function to each element of the array
Johnny
@JohnnyBizzel
Mar 20 2017 02:08
@eduwin7 I would simplify the callback function
@eduwin7 MDN example:
var numbers = [1, 4, 9];
var doubles = numbers.map(function(num) {
  return num * 2;
});
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 02:08
@koskaras becuase it isnt a palindrome
look where the 1's are
koskaras
@koskaras
Mar 20 2017 02:09
@HeebieGeeBee yes but the exercise tells me to replace or numbers, special characters spaces etc...
if you look at it..it is..given these conditions
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 02:09
does it ask you to replace numbers?
koskaras
@koskaras
Mar 20 2017 02:10
you are right :)
Johnny
@JohnnyBizzel
Mar 20 2017 02:10
@koskaras a palindrome is a word or sentence that is written with the same letters forwards and backwards.
Moustapha
@moustaflo
Mar 20 2017 02:10

I am almost there but right now my final return echo's an array of just the first letters:

function titleCase(str) {
var toLower = str.toLowerCase();
var toArr = toLower.split(" ");
var secArr = [];
for(x=0; x<toArr.length;x++){
var newArr = toArr[x].charAt(0).toUpperCase();
secArr.push(newArr);
}

return secArr;
}

titleCase("I'm a little tea pot");

koskaras
@koskaras
Mar 20 2017 02:10
i get ticks to all and i wonder why i don't get on this one :D
Vikram
@vikramnr
Mar 20 2017 02:10
@HermanFassett @revisualize thanks all
CamperBot
@camperbot
Mar 20 2017 02:10
vikramnr sends brownie points to @hermanfassett and @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3554 | @revisualize |http://www.freecodecamp.com/revisualize
:star2: 1694 | @hermanfassett |http://www.freecodecamp.com/hermanfassett
Johnny
@JohnnyBizzel
Mar 20 2017 02:11
@moustaflo How are you testing each word?
eduwin7
@eduwin7
Mar 20 2017 02:12
@Jonny-x no luck here jonny

var oldArray = [1,2,3,4,5];

// Only change code below this line.
var newArray = oldArray.map(function(num){
return num * 3;
});
var newArray = oldArray;

Bachir Amadou
@BachAmadou
Mar 20 2017 02:12

hi guys, please l need help with this challenge.
l dont know what to do

Profile Lookup

//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
},
{
"firstName": "Sherlock",
"lastName": "Holmes",
"number": "0487345643",
"likes": ["Intriguing Cases", "Violin"]
},
{
"firstName": "Kristian",
"lastName": "Vos",
"number": "unknown",
"likes": ["Javascript", "Gaming", "Foxes"]
}
];

function lookUpProfile(firstName, prop){
// Only change code below this line

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");

Phillip Troutman
@troutman21
Mar 20 2017 02:13
@BachAmadou I'm stuck on the same challenge.
Johnny
@JohnnyBizzel
Mar 20 2017 02:13
@eduwin7 you were adding 3 before
Phillip Troutman
@troutman21
Mar 20 2017 02:13
I cant figure out how to access the objects inside the array.
eduwin7
@eduwin7
Mar 20 2017 02:13
it still return 12345
Johnny
@JohnnyBizzel
Mar 20 2017 02:13
@BachAmadou everyone's favourite that!
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 02:13
@eduwin7 var newArray = oldArray; why are you doing this?
Johnny
@JohnnyBizzel
Mar 20 2017 02:13
@eduwin7 are you using numbers or strings?
eduwin7
@eduwin7
Mar 20 2017 02:14
it should multiple it or add it but i am not getting any new action
numbers

var oldArray = [1,2,3,4,5];

// Only change code below this line.
var newArray = oldArray.map(function(num){
return num * 3;
});
var newArray = oldArray;

Phillip Troutman
@troutman21
Mar 20 2017 02:15
I tried the .hasOwnProperty method to try and access the name prop of the objects
Bachir Amadou
@BachAmadou
Mar 20 2017 02:15
@troutman21 , really? lollll. we will prevail
Phillip Troutman
@troutman21
Mar 20 2017 02:15
not working obviously
lol
Phillip Troutman
@troutman21
Mar 20 2017 02:16
no but how do you access the objects if they are not named? @JohnnyBizzel
Johnny
@JohnnyBizzel
Mar 20 2017 02:16
@eduwin7 5 + 3 = 9 and 5 * 3 = 15 so it's one or the other!
eduwin7
@eduwin7
Mar 20 2017 02:16
@JohnnyBizzel okay, I got it but i got an issue

var oldArray = [1,2,3,4,5];

// Only change code below this line.
var newArray = oldArray.map(function(num){
return num * 3;
});
var newArray = oldArray;

Johnny
@JohnnyBizzel
Mar 20 2017 02:17
@troutman21 Where is the object not named :/ ?
eduwin7
@eduwin7
Mar 20 2017 02:17
it says my original array should not change
how can I make that so
Phillip Troutman
@troutman21
Mar 20 2017 02:17
well the array is named "contacts"... but each object in the array doesnt have an actual name right?
or am i misunderstanding? @JohnnyBizzel
Johnny
@JohnnyBizzel
Mar 20 2017 02:18
@eduwin7 As you are doing apart from the last line, which me and @HeebieGeeBee have no idea what it is doing!
eduwin7
@eduwin7
Mar 20 2017 02:18
@JohnnyBizzel thanks
CamperBot
@camperbot
Mar 20 2017 02:18
eduwin7 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1522 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Bachir Amadou
@BachAmadou
Mar 20 2017 02:18
@JohnnyBizzel , yes l did them. but it is like l can remember anything as l go forward
Johnny
@JohnnyBizzel
Mar 20 2017 02:18
@troutman21 if it's any consolation, everyone goes wrong on this one.
eduwin7
@eduwin7
Mar 20 2017 02:18
this is my challange
You should not change the original array.
You should add three to each value in the array.
You should be making use of the map method.
You should only modify the array with map.
Johnny
@JohnnyBizzel
Mar 20 2017 02:18
@BachAmadou You need to review then!
eduwin7
@eduwin7
Mar 20 2017 02:19
Use the map function to add 3 to every value in the variable oldArray, and save the results into variable newArray. oldArray should not change.
Johnny
@JohnnyBizzel
Mar 20 2017 02:19
@eduwin7 add 3
@troutman21 contacts is an array of objects.
Bachir Amadou
@BachAmadou
Mar 20 2017 02:20
@JohnnyBizzel, l think l have to
Johnny
@JohnnyBizzel
Mar 20 2017 02:20
@BachAmadou ... or take notes
Bachir Amadou
@BachAmadou
Mar 20 2017 02:21
@JohnnyBizzel, ok
Johnny
@JohnnyBizzel
Mar 20 2017 02:21
@troutman21 so now I told you contacts is an array, how to you test it?
Phillip Troutman
@troutman21
Mar 20 2017 02:21
I understand that part. But how do indicate which object I want to look in ? Using Index? @JohnnyBizzel
Johnny
@JohnnyBizzel
Mar 20 2017 02:22
@troutman21 Yes!
Phillip Troutman
@troutman21
Mar 20 2017 02:22
hmmm ok. that is getting me a little closer. will i still be using the .hasOwnProperty() method?
@JohnnyBizzel
Johnny
@JohnnyBizzel
Mar 20 2017 02:23
Maybe check out some examples: https://www.w3schools.com/js/js_objects.asp
ahong08
@ahong08
Mar 20 2017 02:23

Working on the Title Case a Sentence exercise. My answer passes, but was wondering if there was a way to condense this/simplify it:
function titleCase(str) {
var array = str.toLowerCase().split(' ');
var newArray = [];
var finalArray = [];

for (var i = 0; i < array.length; i++) {
newArray.push(array[i].split(''));
}

for (var j = 0; j < newArray.length; j++) {
newArray[j][0] = newArray[j][0].toUpperCase();
}

for (var k = 0; k < newArray.length; k++) {
finalArray.push(newArray[k].join(""));
}

var final = finalArray.join(" ");
return final;
}

titleCase("I'm a little tea pot");

Johnny
@JohnnyBizzel
Mar 20 2017 02:24
@troutman21 I think the 2nd parameter you pass is a "prop" that you need to check for.
@ahong08 If you want optimised solutions, they are all to be found in the forum.
Phillip Troutman
@troutman21
Mar 20 2017 02:25
yes it is. Ok ill keep researching. Thanks @JohnnyBizzel
CamperBot
@camperbot
Mar 20 2017 02:25
troutman21 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1523 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:25
@JohnnyBizzel Can you help me with this challenge?
"Chaining If Else Statements"
Johnny
@JohnnyBizzel
Mar 20 2017 02:26
@troutman21 think about the problem. You are searching through a list to find a person and some details about that person.
@MathematicsCoding I can try
ahong08
@ahong08
Mar 20 2017 02:26
@JohnnyBizzel Thanks! Wasn't sure where to direct the question to
CamperBot
@camperbot
Mar 20 2017 02:26
ahong08 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1524 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:26
Well I have no idea where to start...
Johnny
@JohnnyBizzel
Mar 20 2017 02:27
@MathematicsCoding start with if
Moustapha
@moustaflo
Mar 20 2017 02:27
@JohnnyBizzel I am using the index x for the words, then charAt(0) for the first letter
Johnny
@JohnnyBizzel
Mar 20 2017 02:27
@moustaflo what about the other letters?
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:28

function testSize(num) {
  // Only change code below this line
  if (num < 5);
  if (num < 10);
  if (num < 15);
  if (num < 20);
  if (num >= 20);

  return "testSize";
  // Only change code above this line
}

// Change this value to test
testSize(7);
Johnny
@JohnnyBizzel
Mar 20 2017 02:30
@MathematicsCoding Read this: https://www.w3schools.com/js/js_if_else.asp
Joseph
@revisualize
Mar 20 2017 02:32
@MathematicsCoding Ummm..
Moustapha
@moustaflo
Mar 20 2017 02:32
@JohnnyBizzel I'm only altering the first letter but only the edited letters are coming out
ahong08
@ahong08
Mar 20 2017 02:32
@moustaflo Look at the pseudocode example on the side. How does that work?
@moustaflo whoops, sorry, wrong person
Johnny
@JohnnyBizzel
Mar 20 2017 02:32
@moustaflo I think you need to include the other letters somehow!
@ahong08 That applies to all challenges! :joy:
eduwin7
@eduwin7
Mar 20 2017 02:33
hi
ahong08
@ahong08
Mar 20 2017 02:33
@JohnnyBizzel haha, very true
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:33
@revisualize I think im close..
Riadh
@KWFE
Mar 20 2017 02:34
hey
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:34
 if (num < 5); {
    num = "Tiny";
    return "Tiny";
  }
  if (num < 10); {
    num = "Small";
    return  "Small";
  }
  if (num < 15);
  if (num < 20);
  if (num >= 20);
Im not done yet
Johnny
@JohnnyBizzel
Mar 20 2017 02:34
@MathematicsCoding Getting there but you can just return without setting num to a string
 if (num < 5); {
    num = "Tiny";  // not required
    return "Tiny";
  }
  if (num < 10); {
    num = "Small"; // not required
    return  "Small";
  }
  if (num < 15);
  if (num < 20);
  if (num >= 20);
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:35
Do I just return num
Rob Tieffenbacher III
@Tiff32
Mar 20 2017 02:35
// Example
var ourArr = [ 9, 10, 11, 12];
var ourTotal = 0;

for (var i = 0; i < ourArr.length; i++) {
  ourTotal += ourArr[i];
}

// Setup
var myArr = [ 2, 3, 4, 5, 6];

// Only change code below this line
var myTotal = 0;

for (var i = 0; i < myArr.length; i++) {
  myTotal += myArr[i];
}
I am not sure why this isn't working. Isn't total declared in my variable?
Johnny
@JohnnyBizzel
Mar 20 2017 02:35
@MathematicsCoding I don't know. Read the instructions
Rob Tieffenbacher III
@Tiff32
Mar 20 2017 02:36
Declare and initialize a variable total to 0. Use a for loop to add the value of each element of the myArr array to total.
Joseph
@revisualize
Mar 20 2017 02:36
@MathematicsCoding Okay. You have a bit of an issue.
@MathematicsCoding Let's break it down.
Johnny
@JohnnyBizzel
Mar 20 2017 02:37
@Tiff32 looks fine. What's the challenge name?
Rob Tieffenbacher III
@Tiff32
Mar 20 2017 02:37
@JohnnyBizzel Iterate Through an Array with a For Loop
Joseph
@revisualize
Mar 20 2017 02:37

@MathematicsCoding With this code block:

var num = 3; // adding this to be on the same page.
 if (num < 5); {
    return "Tiny";
  }

With that code block. "Tiny" is never returned.

@MathematicsCoding The problem that you're going to have is that the ; is a statement terminator.
Johnny
@JohnnyBizzel
Mar 20 2017 02:38
@Tiff32 I think it's just the naming... Declare and initialize a variable total to 0.
not myTotal
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:38
So that ; isn't required?
Joseph
@revisualize
Mar 20 2017 02:38
@MathematicsCoding and with if (num < 5); { } The if statement is terminated before you even get to the statement block
@MathematicsCoding Where you have the ; is not correct.
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:39
So what should I do?
Johnny
@JohnnyBizzel
Mar 20 2017 02:39
@MathematicsCoding clearly you didn't read the examples I recommended :| https://www.w3schools.com/js/js_if_else.asp
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:40
I did..
Joseph
@revisualize
Mar 20 2017 02:40

@MathematicsCoding With this code block:

var num = 3; // adding this to be on the same page.
//  if (num < 5); {       // incorrect due to statement termination.
 if (num < 5) {          // correct. .. No statement termination before the true statement block is reached.
    return "Tiny";
  }

With that code block. "Tiny" is never returned.

Riadh
@KWFE
Mar 20 2017 02:40
hello
Rob Tieffenbacher III
@Tiff32
Mar 20 2017 02:40
@JohnnyBizzel ay, it was the naming only! Thanks :)
CamperBot
@camperbot
Mar 20 2017 02:40
tiff32 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1525 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Joseph
@revisualize
Mar 20 2017 02:41
@MathematicsCoding Does that make sense?
Johnny
@JohnnyBizzel
Mar 20 2017 02:41
@Tiff32 Thought so! Be careful. Some challenges require specific variable naming. :+1:
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:41
I think so...
Because there is no variable Tiny?
Rob Tieffenbacher III
@Tiff32
Mar 20 2017 02:41
@JohnnyBizzel I should have realized it when i saw "total" sometimes I blindly follow the example. :\
Joseph
@revisualize
Mar 20 2017 02:41
@MathematicsCoding What? That has nothing to do with it.
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:41
hey guys, can anyone tell me why isn't this working?
function titleCase(str) {
  var string = str.split(" ");
  for (i = 0; i <= string.length; i++) {
    string[i][0].toUpperCase();
  }

  return string;
}
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:42
Oh..
Joseph
@revisualize
Mar 20 2017 02:42
@MathematicsCoding What is different about these two lines:
if (num < 5); {
if (num < 5) {
???
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:42
I dont know what happen without ;
Joseph
@revisualize
Mar 20 2017 02:42
@MathematicsCoding Without the ; ... it is correct syntax.
@MathematicsCoding What is the ; ?
Riadh
@KWFE
Mar 20 2017 02:43
any friends here !
Johnny
@JohnnyBizzel
Mar 20 2017 02:43
@MathematicsCoding one of the examples on W3schools:
if (hour < 18) {
    greeting = "Good day";
} else {
    greeting = "Good evening";
}
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:43
I think I get it
function testSize(num) {
  // Only change code below this line
  if (num < 5); {
    num = "Tiny";
  } 
  if (num < 10); {
    num = "Small";
  }
  if (num < 15); {
    num = "Medium";
  }
  if (num < 20); {
    num ="Large";
  }
  if (num >= 20) {
    num = "Huge";
  }

 return num;
Joseph
@revisualize
Mar 20 2017 02:43
@MathematicsCoding Every if condition is incorrect. exept the last one.
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:43
When I return the num and its only return Large not Huge
Johnny
@JohnnyBizzel
Mar 20 2017 02:43
@MathematicsCoding you don't get it :(
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:43
That Huge doesnt have the ;
Bryan Reese
@breese8009
Mar 20 2017 02:44
@G-4-R-Y whats the challenge want?
Joseph
@revisualize
Mar 20 2017 02:44
@MathematicsCoding Because that if block is CORRECT.
@MathematicsCoding In JavaScript what does the ; signify?
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:44
Well why is it not returning Huge...
Bryan Reese
@breese8009
Mar 20 2017 02:44
@G-4-R-Y it just wants the first letter in the string to be capitalized right?
if i remember right
Joseph
@revisualize
Mar 20 2017 02:44
@MathematicsCoding What's the value of num?
Kurtgerteisen
@Kurtgerteisen
Mar 20 2017 02:44

Can someone help me make object properties private? var Car = function() {
// this is a private variable
var speed = 10;

// these are public methods
this.accelerate = function(change) {
speed += change;
};

this.decelerate = function() {
speed -= 5;
};

this.getSpeed = function() {
return speed;
};
};

var Bike = function() {

// Only change code below this line.

};

var myCar = new Car();

var myBike = new Bike();

G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:45
@breese8009 first letter of all the words in the given string
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:45
testSize?
Joseph
@revisualize
Mar 20 2017 02:45
@MathematicsCoding What?
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:45
7*
Kurtgerteisen
@Kurtgerteisen
Mar 20 2017 02:45
i dont understand this one at all
Bryan Reese
@breese8009
Mar 20 2017 02:45
@G-4-R-Y whats the name of the challenge?
Joseph
@revisualize
Mar 20 2017 02:45
@MathematicsCoding Is 7 greater than or equal to 20?
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:45
@breese8009 "Title Case a Sentence"
Johnny
@JohnnyBizzel
Mar 20 2017 02:46
@Kurtgerteisen Yeah, it's tricky. I will have to look it up
drinkwaterman
@drinkwaterman
Mar 20 2017 02:46
Hello people,
I have a question about ECMAScript,
is it important to learn ECMA?
If we're able to do everthing using basic js,
why would someone be lazy and use ECMA?
and why learn JS in the first place if using ECMA?
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:46
No
Bryan Reese
@breese8009
Mar 20 2017 02:46
@G-4-R-Y u gotta take into account weather any of the other letters are uppcase
Joseph
@revisualize
Mar 20 2017 02:46
@MathematicsCoding Then why do you expect Huge to be returned?
Bryan Reese
@breese8009
Mar 20 2017 02:46
and u gotta make them lowercase
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:46
Oh..
Kurtgerteisen
@Kurtgerteisen
Mar 20 2017 02:46
@JohnnyBizzel thanks these are the instructions " Now try it yourself! Modify the Bike constructor to have a private property called gear and two public methods called getGear and setGear to get and set that value."
CamperBot
@camperbot
Mar 20 2017 02:46
kurtgerteisen sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1526 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:47
@breese8009 ooh, okay, ill do it, thanks!
CamperBot
@camperbot
Mar 20 2017 02:47
g-4-r-y sends brownie points to @breese8009 :sparkles: :thumbsup: :sparkles:
:cookie: 324 | @breese8009 |http://www.freecodecamp.com/breese8009
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:47
function testSize(num) {
  // Only change code below this line
  if (num < 5); {
    num = "Tiny";
  } 
  if (num < 10); {
    num = "Small";
  }
  if (num < 15); {
    num = "Medium";
  }
  if (num < 20); {
    num ="Large";
  }
  if (num >= 20) {
    num = "Huge";
  }

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

// Change this value to test
testSize(21);
Bryan Reese
@breese8009
Mar 20 2017 02:47
@G-4-R-Y also this is incorrect string[i][o]
Joseph
@revisualize
Mar 20 2017 02:47
@MathematicsCoding
function testSize(num) {
  // Only change code below this line
  if (num < 5); {  // incorrect
    num = "Tiny";
  } 
  if (num < 10); { // incorrect
    num = "Small";
  }
  if (num < 15); {  // incorrect
    num = "Medium";
  }
  if (num < 20); { // incorrect
    num ="Large";
  }
  if (num >= 20) {
    num = "Huge";
  }

 return num;
}
Bryan Reese
@breese8009
Mar 20 2017 02:47
that wont get u to the first letter
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:48
Oh the one with ; is incorrect?
Bryan Reese
@breese8009
Mar 20 2017 02:48
@G-4-R-Y i gotta go but i know @revisualize is a gangster at JS and can help u the rest the way
adios guys
Joseph
@revisualize
Mar 20 2017 02:48
@MathematicsCoding YES
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:48
Why?
Johnny
@JohnnyBizzel
Mar 20 2017 02:48
@Kurtgerteisen So the setter needs a variable and to set the private var and the getter just returns the private variable.
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:48
Whoa
Joseph
@revisualize
Mar 20 2017 02:48
@MathematicsCoding In JavaScript what does the ; signify?
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:49
I removed all ; and got green marks..
Sorry I dont really know...
Johnny
@JohnnyBizzel
Mar 20 2017 02:49
Legend!
Joseph
@revisualize
Mar 20 2017 02:49
@MathematicsCoding I told you 3 times in this chat.
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:49
Well you didnt ask me to remove ;
Joseph
@revisualize
Mar 20 2017 02:50
@MathematicsCoding No no I didn't I tried to explain to you why it was wrong instead of telling you it was wrong.
Johnny
@JohnnyBizzel
Mar 20 2017 02:50
@MathematicsCoding He told you it is a statement terminator.
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:50
@revisualize after helping @MathematicsCoding can u give me a little hand here?
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:50
Okay I got all green marks except one
Im supposed to have at least 4 else statements
Manish Giri
@Manish-Giri
Mar 20 2017 02:50
@G-4-R-Y what are you stuck on?
Saboor Malik
@MathematicsCoding
Mar 20 2017 02:51
Nvm I got it

function testSize(num) {
  // Only change code below this line
  if (num < 5) {
    num = "Tiny";
  } 
  else if (num < 10) {
    num = "Small";
  }
  else if (num < 15) {
    num = "Medium";
  }
  else if (num < 20) {
    num ="Large";
  }
  else if (num >= 20) {
    num = "Huge";
  }

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

// Change this value to test
testSize(21);
Johnny
@JohnnyBizzel
Mar 20 2017 02:51
@MathematicsCoding thanks for visiting!
CamperBot
@camperbot
Mar 20 2017 02:51
johnnybizzel sends brownie points to @mathematicscoding :sparkles: :thumbsup: :sparkles:
:cookie: 206 | @mathematicscoding |http://www.freecodecamp.com/mathematicscoding
Joseph
@revisualize
Mar 20 2017 02:51
@MathematicsCoding You know what.. I feel that I'm realizing something after the last few weeks of working with you. I feel that you're not focused on learning the material ... I get the feeling from our interactions that you're focused just on getting green check boxes on lessons. And I feel that you think that is learning.
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:52
@Manish-Giri Title Case a Sentence
Manish Giri
@Manish-Giri
Mar 20 2017 02:52
@G-4-R-Y okay, post your code..
Austin White
@Aeolionx
Mar 20 2017 02:53
Why doesnt this code filter out boolean values that are true?
function bouncer(arr) {
  return arr.filter(Boolean);
}

bouncer([7, "ate", "", false, true, 9]);
Joseph
@revisualize
Mar 20 2017 02:53
@Aeolionx Because .filter() doesn't remove values that are true.
@Aeolionx .filter() filters out values that evaluate to false.
Austin White
@Aeolionx
Mar 20 2017 02:54
so thats just a characteristic built into the filter method?
@revisualize thank you
CamperBot
@camperbot
Mar 20 2017 02:54
aeolionx sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3555 | @revisualize |http://www.freecodecamp.com/revisualize
Kurtgerteisen
@Kurtgerteisen
Mar 20 2017 02:54
@JohnnyBizzel im not to sure how to do that....
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:54

@Manish-Giri im still putting the first letter of each word in capital letter, but @breese8009 told me that was already wrong

```

function titleCase(str) {
  var string = str.split(" ");
  for (i = 0; i <= string.length; i++) {
    string[i][0].toUpperCase();
  }

  return string;
}
Joseph
@revisualize
Mar 20 2017 02:54

@Aeolionx

[true, true, false, false, true, false, false, true, true].filter(function (x) { return x });
[23,1,6,12,17,3,2,5,19,86,87].filter(function (x) { return x % 2 === 0 });
[23,1,6,12,17,3,2,5,19,86,87].filter(function (x) { console.log(arguments); return x % 2 === 0 });

https://repl.it/FBrn

Manish Giri
@Manish-Giri
Mar 20 2017 02:55
@G-4-R-Y do you know what array indexes are for?
like arr[0];
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:56
aren't they used to select a array or a character inside them?
Manish Giri
@Manish-Giri
Mar 20 2017 02:56
yes
so if var numbers = [1,2,3,4];
how would you get 1?
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:56
numbers[0]
right?
Manish Giri
@Manish-Giri
Mar 20 2017 02:56
right
Austin White
@Aeolionx
Mar 20 2017 02:57
@revisualize hmmm, interesting thank you for clarifying
CamperBot
@camperbot
Mar 20 2017 02:57
aeolionx sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:warning: aeolionx already gave revisualize points
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:57
so... what i did wrong there?
Manish Giri
@Manish-Giri
Mar 20 2017 02:57
so you use the index to access the position at that element
so then why do you have string[i][0]?
string is not a two dimensional array.
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:57
string is str.split(" ")
Manish Giri
@Manish-Giri
Mar 20 2017 02:57
it's just an array of elements, not array of arrays.
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:57
ohh, yes
Manish Giri
@Manish-Giri
Mar 20 2017 02:57
no I mean why do you have the [0]
Johnny
@JohnnyBizzel
Mar 20 2017 02:58
@G-4-R-Y string is str.split(" ") This will break the sentence into an array of words
Manish Giri
@Manish-Giri
Mar 20 2017 02:58
@G-4-R-Y here's a function to do what you're trying to do..
G-4-R-Y
@G-4-R-Y
Mar 20 2017 02:58
[i] was supposed to select a word and [0] the first letter
selecting with the [0] isn't the way to do it?
JenimDacket
@JenimDacket
Mar 20 2017 03:00
This is what the forum gave back as the solution to Caesar's cipher (i completed it by myself, just REALLY messy). What the hell?
function rot13(str) {
  // Split str into a character array
  return str.split('')
  // Iterate over each character in the array
    .map.call(str, function(char) {
      // Convert char to a character code
      x = char.charCodeAt(0);
      // Checks if character lies between A-Z
      if (x < 65 || x > 90) {
        return String.fromCharCode(x);  // Return un-converted character
      }
      //N = ASCII 78, if the character code is less than 78, shift forward 13 places
      else if (x < 78) {
        return String.fromCharCode(x + 13);
      }
      // Otherwise shift the character 13 places backward
      return String.fromCharCode(x - 13);
    }).join('');  // Rejoin the array into a string
}
G-4-R-Y
@G-4-R-Y
Mar 20 2017 03:01
ohhh @Manish-Giri i tried using charAt(0) but it returned something like "couldn't find chatAt(0) of undefined
so i started trying this other way
"Cannot read property 'chatAt' of undefined"
function titleCase(str) {
  var string = str.split(" ");
  for (i = 0; i <= string.length; i++) {
    string[i].charAt(0).toUpperCase();
  }

  return string;
}

titleCase("I'm a little tea pot");
Manish Giri
@Manish-Giri
Mar 20 2017 03:03
G-4-R-Y
@G-4-R-Y
Mar 20 2017 03:04
@Manish-Giri but mine is returning "TypeError: Cannot read property 'charAt' of undefined"
alrigth, i gotte sleep now, i have to stay 12 hours in school and study for a test when i arrive at home
thanks everyone!
Tom
@moT01
Mar 20 2017 03:06
anyone wanna help me with a problem? im making a couple loops, and not getting the results im hoping for
    createObjectsToPlace = () => {
        var index = 0, tempObj = {};
        var numberOfObjects = [
            ['pawn': 10],
            ['knight', 4],
            ['king', 1],
            ['health', 20],
            ['point', 20],
            ['sword', 1],
            ['player', 1]
        ];

        for (var i=0; i<numberOfObjects.length; i++) {
            tempObj = {};
            for(var j=0; j<numberOfObjects[i][1]; j++) {
                tempObj = object[numberOfObjects[i][0]];
                tempObj.index = index;
                objectsArray.push(tempObj);    
                index++;
                console.log(tempObj); //here each is logged with correct index
            } //end j
        } //end i
        console.log(objectsArray); //here logged with index of last in group (all the pawns show index 9, knights show 13 etc...)
        //this.setState({
          //  object: objectsArray 
        //}); //end setState 
    }; //end createObjectsToPlace()
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:06
if (par-1) {
    par = "Birdie";
    return "Birdie";
  }
Is there something wrong with this code?
Rohan Sharma
@RhnSharma
Mar 20 2017 03:07

can someone help me on this

var randomNumberBetween0and19 = Math.floor(Math.random() * 20);

function randomWholeNum() {

  // Only change code below this line.

  return Math.random();
}

plzz help

Manish Giri
@Manish-Giri
Mar 20 2017 03:07
@G-4-R-Y i <= string.length
gotta pay attention to the little things
this should be <
juni
@junipberry
Mar 20 2017 03:07
hey guys, Im having a bit of touble w the mad libs section w word blanks. Ive put in the wordBlanks(“dog”, “big”, “ran”, “quickly”);
but dont get what to do nxt
I have this so far:
result= ("My"+mynoun, "is"+myAdjective, "so he"+myVerb, "too"+myAdverb);
Tom
@moT01
Mar 20 2017 03:08
@RhnSharma return that variable? maybe
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:09
@moT01 They doesnt teach how to return before that challenge
juni
@junipberry
Mar 20 2017 03:09
is that the right approach?
Tom
@moT01
Mar 20 2017 03:09
@junipberry myNoun maybe?
Rohan Sharma
@RhnSharma
Mar 20 2017 03:09
@moT01 ok i will try
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:09
Have to be myNoun
Rohan Sharma
@RhnSharma
Mar 20 2017 03:09
@moT01 Thanks
CamperBot
@camperbot
Mar 20 2017 03:09
rhnsharma sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 581 | @mot01 |http://www.freecodecamp.com/mot01
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:09
@RhnSharma You need the spaces
Tom
@moT01
Mar 20 2017 03:09
return is what is sent back when you call that function
juni
@junipberry
Mar 20 2017 03:10
no..not it @moT01
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:10
Like "My" + "" + myNoun etc.
David Amanze
@GodKingShogun
Mar 20 2017 03:10
anyone still on
juni
@junipberry
Mar 20 2017 03:10
although nice catch
but its not the problem Im having
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:10
@junipberry Peopledon'twritelikethis
WHich is why you need the spaces
Tom
@moT01
Mar 20 2017 03:11
@junipberry the + needs to be used every time to switch to or from a variable or an actual string
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:11
Add " " between them
Manish Giri
@Manish-Giri
Mar 20 2017 03:11
@junipberry why do you have the ,
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:11
If you cannot answer to @Manish-Giri 's question maybe you should remove it
Manish Giri
@Manish-Giri
Mar 20 2017 03:12
lol
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:12
I ned help
on the challenge
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:12
help?
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:12
Change the provided string from double to single quotes and remove the escaping.
juni
@junipberry
Mar 20 2017 03:12
bc i need the comma
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:12
are you ok?
ned??
juni
@junipberry
Mar 20 2017 03:12
otherwise it gives me the red line
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:12
var myStr = "'<a href" + "= + http://www.example.comtarget= _blank> Link</a>'";
Only remove the backslashes \ used to escape quotes.
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:13
@junipberry but what are comma for?
juni
@junipberry
Mar 20 2017 03:13
how else would I separate the function wordBlanks?
Rohan Sharma
@RhnSharma
Mar 20 2017 03:13
@MathematicsCoding What
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:13
Spaces "" not the comma
comma means and
Comma wont make them space
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:13
can someone
help me with my problem
I arleady posted it.
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:14
Use \
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:14
me?
Rohan Sharma
@RhnSharma
Mar 20 2017 03:14
@MathematicsCoding ok
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:14
saboor
can you help me with my problem?
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:14
Yes?
juni
@junipberry
Mar 20 2017 03:14
@saboor, Im sorry Im not getting what you are saying
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:14
What is it
@junipberry You see the outputs?
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:15

Change the provided string from double to single quotes and remove the escaping.

Run tests (ctrl + enter)
Reset Help Bug

myStr = '<a href= + http://www.example.comtarget= _blank> Link</a>'

Remove all the backslashes ()
You should have two single quotes ' and four double quotes "
Only remove the backslashes \ used to escape quotes.

juni
@junipberry
Mar 20 2017 03:15
how is “” space..
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:15
When you run test it will say like this HiMyNameisStupid
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:15
Only remove the backslashes \ used to escape quotes.
I need help on that.
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:15
"" is spaces...
juni
@junipberry
Mar 20 2017 03:15
its not even running.
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:15
You see the blank inside ""
Just try to do it with ""..
myNoun + "" + "Run" + "" + etc..
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:16
"" isnt a space " " is a space
"" is an empty string
Manish Giri
@Manish-Giri
Mar 20 2017 03:17
@junipberry post your code.
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:17
You see the blank inside ""
A riddle...
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:17
" " is string of just a space
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:17
Yeah
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:17
Saboor
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:17
What up?
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:17
can you help me with my problem?
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:17
Sure I can try @siddarthk123
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:17
Only remove the backslashes \ used to escape quotes.
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:17
@siddarthk123 do you understand what a string is?
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:17
ar myStr = "'<a href" + "= + h
yes.
I do.

Quoting Strings with Single Quotes
String values in JavaScript may be written with single or double quotes, so long as you start and end with the same type of quote. Unlike some languages, single and double quotes are functionally identical in JavaScript.

"This string has \"double quotes\" in it"

The value in using one or the other has to do with the need to escape quotes of the same type. Unless they are escaped, you cannot have more than one pair of whichever quote type begins a string.

If you have a string with many double quotes, this can be difficult to read and write. Instead, use single quotes:

'This string has "double quotes" in it. And "probably" lots of them.'

Instructions
Change the provided string from double to single quotes and remove the escaping.

Run tests (ctrl + enter)
Reset Help Bug

myStr = '<a href= + http://www.example.comtarget= _blank> Link</a>'

Remove all the backslashes ()
You should have two single quotes ' and four double quotes "
Only remove the backslashes \ used to escape quotes.

Saboor Malik
@MathematicsCoding
Mar 20 2017 03:18
Why <a href?
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:18
that's not the points
this is my code
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:18
Okay
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:18
var myStr = "'<a href" + "= + h
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:18
+ h
Why is it there...
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:18
var myStr = "'<a href" + "= + http://www.example.comtarget= _blank> Link</a>'";
juni
@junipberry
Mar 20 2017 03:18
@HeebieGeeBee, could you point out what I should be doing differently
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:19
Remove all the backslashes ()
You should have two single quotes ' and four double quotes "
Only remove the backslashes \ used to escape quotes.
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:19
so in that excercise it wants you to use a ' single quotesto indicate that start and end of a string, so that when it sees " within that string it will ignore them and just treat them as part of that string
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:19
I am stuck on the third objectoive.
Tangtastic
@Tangtastic
Mar 20 2017 03:19
So, how do I debug properly in the freeCodeCamp editor? I console.log but it don't print.
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:19
@siddarthk123
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:19
Sorry but @HeebieGeeBee help you with that challenge @siddarthk123
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:20
I still do not get it.
So what would the solution be?
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:21
var myStr ='<a href="http://www.example.com" target="_blank">Link</a>';
@junipberry whats your code?
juni
@junipberry
Mar 20 2017 03:22
@HeebieGeeBee , now I deleted the commas bc I was asked why I have commas.. so now I have this:
wordBlanks("dog", "big", "ran", "quickly");
var result= ("My"+ myNoun "is" + myAdjective " so he"+ myVerb "too"+ myAdverb);
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:22
@junipberry frst offdont put it in parenthesis
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:22
@junipberry Comma is still there...
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:23
and you need to add spaces to your string parts where they are needed
@MathematicsCoding what commas?
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:23
Never mind I thought they are in result
var result=
juni
@junipberry
Mar 20 2017 03:24
@HeebieGeeBee, so the function words too?
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:24
@junipberry run your code and look at what you get as the output
juni
@junipberry
Mar 20 2017 03:24
@HeebieGeeBee Im not getting any output
“unexpected string"
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:25
did you get rid of the parenthesis?
demiclose
@demiclose
Mar 20 2017 03:25
Hi there, is there anyone working through learn.co bootcamp prep as well? I am stuck on one of the labs and their community isn't quite as extensive as FCC so I thought I would reach out here, even if it's a long shot.
juni
@junipberry
Mar 20 2017 03:25
yes
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:26
var result="My "+ myNoun + " is " + myAdjective + " so he " + myVerb + " too " + myAdverb;
@junipberry but try and figure out why thats the solution
and why its different to your code
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:26
Also run the test
Manish Giri
@Manish-Giri
Mar 20 2017 03:26
@demiclose I could give it a shot, what's the problem?
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:26
The outputs won't change if you change the code unless you run the test
Manish Giri
@Manish-Giri
Mar 20 2017 03:27
@HeebieGeeBee :wave:
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:27
@Manish-Giri :wave: yo
hows things?
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:27
@HeebieGeeBee :wave: :worried:
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:27
@MathematicsCoding :wave:
Manish Giri
@Manish-Giri
Mar 20 2017 03:27
@HeebieGeeBee slow and dull
your end?
David Amanze
@GodKingShogun
Mar 20 2017 03:28
@Manish-Giri :wave: 
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:28
pretty much the same
Manish Giri
@Manish-Giri
Mar 20 2017 03:28
@GodKingShogun :wave:
mpochiro
@mpochiro
Mar 20 2017 03:28
var remainder; 11 % 3=2; how should this lok if we are using the remainder operation?
Manish Giri
@Manish-Giri
Mar 20 2017 03:28
:japanese_ogre:
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:28
@mpochiro var remainder = 11 % 3;
David Amanze
@GodKingShogun
Mar 20 2017 03:28
@HeebieGeeBee :wave:
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:28
@GodKingShogun :wave:
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:28
Too many of :wave: (s)
David Amanze
@GodKingShogun
Mar 20 2017 03:29
my computer is going slow :cry:
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:29
@GodKingShogun what are you running on it?
David Amanze
@GodKingShogun
Mar 20 2017 03:29
its going fast now :smile:
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:29
lol
David Amanze
@GodKingShogun
Mar 20 2017 03:29
@HeebieGeeBee im on edge
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:30
Samsung edge?
David Amanze
@GodKingShogun
Mar 20 2017 03:30
@MathematicsCoding lol now microsoft
Herman Fassett
@HermanFassett
Mar 20 2017 03:30
xD
Avery Biskup
@fraknard
Mar 20 2017 03:30
http://codepen.io/fraknard/pen/ryYpoW?editors=0012 JS line 4 - Is this a good method of getting the channel and stream information?
Herman Fassett
@HermanFassett
Mar 20 2017 03:30
Livin' on the edge there
juni
@junipberry
Mar 20 2017 03:30
@HeebieGeeBee , I see I was missing the spaces in front of the added madlibs..and I rid the var in front of result..
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:31
@HermanFassett Hey wanna help me with this challenge?
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:31
@junipberry you were missing some + too
juni
@junipberry
Mar 20 2017 03:31
but Im still seeing:wordBlanks("","","","") should return a string.
wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
Herman Fassett
@HermanFassett
Mar 20 2017 03:31
@MathematicsCoding watcha workin' on?
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:31
Golf code
juni
@junipberry
Mar 20 2017 03:31
yes, true~ I made sure to put those additional +s in too
David Amanze
@GodKingShogun
Mar 20 2017 03:32
anyone want to give me a hint on how to complete the binary agents challenge :smile:
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:32
@junipberry what does your coe look like now?
David Amanze
@GodKingShogun
Mar 20 2017 03:32
@junipberry post what you have
juni
@junipberry
Mar 20 2017 03:32
// Your code below this line
wordBlanks("dog", "big", "ran", "quickly");
result= "My" + myNoun + " is" + myAdjective + " so he"+ myVerb + " too"+ myAdverb;
David Amanze
@GodKingShogun
Mar 20 2017 03:32
@junipberry you need space in your ""
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:32
@junipberry you still left out some spaces
Herman Fassett
@HermanFassett
Mar 20 2017 03:33
@MathematicsCoding Golf Code? What do you have? I believe I just made a quick if-else chain when I did it...
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:33

function golfScore(par, strokes) {
  // Only change code below this line
  if (1) {
    strokes = "Hole-in-one!";
      return "Hole-in-one!";
  }
  if (par -2) {
    strokes="Eagle";
    return "Eagle";
  }
if (par) {
  strokes = "Par";
  return "Par";
}

  // Only change code above this line
}

// Change these values to test
golfScore(5, 4);
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:33
@junipberry and why are you calling the function?
David Amanze
@GodKingShogun
Mar 20 2017 03:33
@junipberry as it is now all your words will be jumbled in one big word
Vikram
@vikramnr
Mar 20 2017 03:33
Hi all,
David Amanze
@GodKingShogun
Mar 20 2017 03:34
@vikramnr hi
Herman Fassett
@HermanFassett
Mar 20 2017 03:34
hi
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:34
Hi
juni
@junipberry
Mar 20 2017 03:34
I put a space in front of all the words after “My"
Herman Fassett
@HermanFassett
Mar 20 2017 03:34
@MathematicsCoding what are you trying to achieve with those if statements? They don't really make sense as they are. You'll be wanting to compare strokes to various values
juni
@junipberry
Mar 20 2017 03:34
im not seeing it..
Moisés Man
@moigithub
Mar 20 2017 03:34
@GodKingShogun read about what binary number is
what ascii code is
how to convert binary num to base10 num
how convert ascii code into ascii character
Vikram
@vikramnr
Mar 20 2017 03:35
i have doubt in counting cards .. how i'm supposed to display both count and 'hold/bet'??
can i use console.log or any clues??
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:35
@GodKingShogun parseInt might be useful too
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:35

function golfScore(par, strokes) {
  // Only change code below this line
  else if (1) {
    strokes = "Hole-in-one!";
      return "Hole-in-one!";
  }
  else if (par -2) {
    strokes="Eagle";
    return "Eagle";
  }
else if (par) {
  strokes = "Par";
  return "Par";
}

  // Only change code above this line
}

// Change these values to test
golfScore(5, 4);
Well?
David Amanze
@GodKingShogun
Mar 20 2017 03:35
@moigithub i know what binary number and ascii code is
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:35
@junipberry you need spaces before and after words
Avery Biskup
@fraknard
Mar 20 2017 03:36
@vikramnr Can't you use a comma in between two return statements arguments?
Moisés Man
@moigithub
Mar 20 2017 03:36
@GodKingShogun then skip those and read about other :)
David Amanze
@GodKingShogun
Mar 20 2017 03:36
@moigithub do you have suggested articles
Herman Fassett
@HermanFassett
Mar 20 2017 03:36
@MathematicsCoding well you can't start with an else-if. My first if statement in golfScore function was if (strokes === 1) if that helps.
Moisés Man
@moigithub
Mar 20 2017 03:36
google :+1: parseInt, fromCharCode
David Amanze
@GodKingShogun
Mar 20 2017 03:36
:cry:
lol ok
Avery Biskup
@fraknard
Mar 20 2017 03:36
can't you just do return "hello", "world" ?
juni
@junipberry
Mar 20 2017 03:37
@HeebieGeeBee , ohh didnt know I needed them after ..
Herman Fassett
@HermanFassett
Mar 20 2017 03:37
@vikramnr you can just return a concatenation of count and either string Hold or Bet.
Vikram
@vikramnr
Mar 20 2017 03:37
@fraknard like return('hello',count)
Avery Biskup
@fraknard
Mar 20 2017 03:37
Or add them together in an array, and then return that.
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:37

function golfScore(par, strokes) {
  // Only change code below this line
  if (strokes === 1) {
      return "Hole-in-one!";
  }
  else if (par -2) {
    strokes="Eagle";
    return "Eagle";
  }
else if (par) {
  strokes = "Par";
  return "Par";
}

  // Only change code above this line
}

// Change these values to test
golfScore(5, 4);
Herman Fassett
@HermanFassett
Mar 20 2017 03:37
e.g. return count + " Hold";
Avery Biskup
@fraknard
Mar 20 2017 03:37
@vikramnr Probably easier to make them a string, or use a + sign.
Vikram
@vikramnr
Mar 20 2017 03:38
@HermanFassett okay @fraknard got it
juni
@junipberry
Mar 20 2017 03:38

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
wordBlanks("dog", "big", "ran", "quickly");
result= " My " + myNoun + " is " + myAdjective + " so he " + myVerb + " too " + myAdverb;

// Your code above this line
return result;
}

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

Vikram
@vikramnr
Mar 20 2017 03:38
@HermanFassett @fraknard thanks
CamperBot
@camperbot
Mar 20 2017 03:38
:cookie: 270 | @fraknard |http://www.freecodecamp.com/fraknard
vikramnr sends brownie points to @hermanfassett and @fraknard :sparkles: :thumbsup: :sparkles:
:star2: 1695 | @hermanfassett |http://www.freecodecamp.com/hermanfassett
Kurtgerteisen
@Kurtgerteisen
Mar 20 2017 03:38

what is wrong with this? i am suppose to iterate over Arrays with Map. var oldArray = [1,2,3,4,5];

// Only change code below this line.

var newArray = oldArray;

var addThree = oldArray.map(function(val){
return + 3;
});
console.log(addThree); // returns [4,5,6,7,8]
console.log(oldArray); // returns {1,2,3,4,5}

Herman Fassett
@HermanFassett
Mar 20 2017 03:38
@MathematicsCoding yeah, first if looks good, now you need to add returning else-if statements... I believe all of them should make use of strokes.
Moisés Man
@moigithub
Mar 20 2017 03:38
@Kurtgerteisen ur final result should be on newArray variable
David Amanze
@GodKingShogun
Mar 20 2017 03:38
@moigithub @HeebieGeeBee okay thanks
CamperBot
@camperbot
Mar 20 2017 03:38
godkingshogun sends brownie points to @moigithub and @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1103 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
:star2: 2879 | @moigithub |http://www.freecodecamp.com/moigithub
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:38
@junipberry wordBlanks("dog", "big", "ran", "quickly"); get rid of this above your result line, this is calling the fucntion inside the function
Kurtgerteisen
@Kurtgerteisen
Mar 20 2017 03:39
@moigithub what do you mean by that
Moisés Man
@moigithub
Mar 20 2017 03:40
@Kurtgerteisen code executes from top to bottom
soo when ur code ends.. what value newArray have ?
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:40
function golfScore(par, strokes) {
  // Only change code below this line
  if (strokes === 1) {
      return "Hole-in-one!";
  }
  else if (par -2) {
    return "Eagle";
  }
else if (par -1) {
  return "Birdie";
}

  // Only change code above this line
}

// Change these values to test
golfScore(5, 4);
juni
@junipberry
Mar 20 2017 03:40
@HeebieGeeBee THANK YOU SO MUCH. I get what I was doing wrong now.. wow I was so confused. I’m so grateful~~
CamperBot
@camperbot
Mar 20 2017 03:40
junipberry sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1104 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:40
Why cant I return Birdie?
Joseph
@revisualize
Mar 20 2017 03:41
@MathematicsCoding Because you're not doing a comparison.
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:41
@MathematicsCoding your conditionals should be comparing strokes to par
Herman Fassett
@HermanFassett
Mar 20 2017 03:41
@MathematicsCoding why are you doing else if (par -1)? Isn't par - 1 always true? There's no comparison of anything there. Try comparing against strokes
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:41
@revisualize yo
Kurtgerteisen
@Kurtgerteisen
Mar 20 2017 03:41

@moigithub so like this? var newArray = oldArray;

var addThree = newArray.map(function(val){
return + 3;
});
console.log(addThree); // returns [4,5,6,7,8]
console.log(newArray); // returns {1,2,3,4,5}

Joseph
@revisualize
Mar 20 2017 03:41
@HeebieGeeBee Hi.
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:42
get your selfie stick mount sorted?
Joseph
@revisualize
Mar 20 2017 03:43
@HeebieGeeBee I didn't have to do anything. It has a 1/4 x 20 attachment.
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:43
oh ok
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:44
var myStr = "FirstLine\n\SecondLine\\nThirdLine";
I need help.
Saboor Malik
@MathematicsCoding
Mar 20 2017 03:45
...
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:45

Instructions
Assign the following three lines of text into the single variable myStr using escape sequences.

FirstLine
\SecondLine\
ThirdLine
You will need to use escape sequences to insert special characters correctly. You will also need to follow the spacing as it looks above, with no spaces between escape sequences or words.

Here is the text with the escape sequences written out.

FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine

Run tests (ctrl + enter)
Reset Help Bug

myStr = "FirstLine\n\SecondLine\\nThirdLine"

myStr should have encoded text with the proper escape sequences and no spacing.
myStr should have one newline character \n
myStr should have one carriage return character \r
myStr should have two correctly escaped backslash characters \

Saboor Malik
@MathematicsCoding
Mar 20 2017 03:45
Im so confused with if and else if statements..
demiclose
@demiclose
Mar 20 2017 03:45
@Manish-Giri thanks for offering to help on the learn.co lab question I had a bit ago, it was over functions and making them lowercase and uppercase, I ended up just winging it until the code passed. Story of my life. Thanks again!
CamperBot
@camperbot
Mar 20 2017 03:45
demiclose sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4837 | @manish-giri |http://www.freecodecamp.com/manish-giri
Siddarth Krishnan
@siddarthk123
Mar 20 2017 03:45
can someone help me?
Scroll above and see what I posted.
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:46
@siddarthk123 read what the challenge asked you to do and then see what you have put in your code
Manish Giri
@Manish-Giri
Mar 20 2017 03:46
var myStr = "FirstLine\n\\SecondLine\\\nThirdLine";
@siddarthk123
you need a carriage return
not new lines in both places
Joseph
@revisualize
Mar 20 2017 03:50
@HeebieGeeBee Before the Light Stand arrived. i thought it was going to only have a 3/8 attachment.
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:50
@revisualize oh right
Brian
@BrianCodes33
Mar 20 2017 03:52
function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  for (var i = 0; i < collection.length; i++) {
  if (collection[i].hasOwnProperty(source)) {
     arr.push(collection);   
   }
  return arr;
  }
}

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
any help
Fabian Jacott
@doctorneon
Mar 20 2017 03:54
var myStr = "First\t.Line\n\"Second\t.Line\"\rThird\t.Line"; // Change this line I am stuck at this challenge. Any solutions?
Jason Luboff
@JLuboff
Mar 20 2017 03:57
Too many quotes, too many periods, you're breaking apart the words..
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:57
@JLuboff :wave:
Jason Luboff
@JLuboff
Mar 20 2017 03:58
What's up Heebs?
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 03:58
@JLuboff not much
hows you?
Jason Luboff
@JLuboff
Mar 20 2017 03:59
Good...playing some gears of war
Herman Fassett
@HermanFassett
Mar 20 2017 04:00
gears of war ost is pretty good
Jason Luboff
@JLuboff
Mar 20 2017 04:02
I play far too much of it
But mass effect andromeda is out in a few days so that will probably take my time
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:04
800 hours
Jason Luboff
@JLuboff
Mar 20 2017 04:06
Nah...not that much. Probably 100 some odd. I think I had close to 800 in Destiny though
Actually..169 total for gears...634 for destiny...fuck..
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 04:09
over one month of your life
but meh
Jason Luboff
@JLuboff
Mar 20 2017 04:12
True...destiny was over 1.5-2 year span I think. Gears since beginning of October so eh
Traek Wells
@TraekWells
Mar 20 2017 04:18
function addFriend(user, newFriend) {
  //user has a property called friends that is an array
  //add newFriend to the end of the friends array
  //return the user object
  user.friends = user.friends.push(newFriend);
  return user;
}
no idea what I’m doing wrong here
Jason Luboff
@JLuboff
Mar 20 2017 04:19
Why user.friends = portion?
Traek Wells
@TraekWells
Mar 20 2017 04:19
mmmmmm
good question
guess I dont need it?
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:20
It says push?
Traek Wells
@TraekWells
Mar 20 2017 04:20
@MathematicsCoding what do you mean?
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:20
Why user.friends = portion?
Manish Giri
@Manish-Giri
Mar 20 2017 04:20
user.friends.push(newFriend);
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:20
It says user.friends.push
Jason Luboff
@JLuboff
Mar 20 2017 04:20
Not really needed
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:21
Oh nvm didnt see the =
Traek Wells
@TraekWells
Mar 20 2017 04:21
yeah, taking off the first part of it fixed it
Manish Giri
@Manish-Giri
Mar 20 2017 04:21
@TraekWells by doing this
user.friends = user.friends.push(newFriend);
you're making user.friends a number, which is the new length of the modified array.
Jason Luboff
@JLuboff
Mar 20 2017 04:21
I think that would set the property to a number
Manish Giri
@Manish-Giri
Mar 20 2017 04:21
you just want to .push().
Jason Luboff
@JLuboff
Mar 20 2017 04:21
Bam! @Manish-Giri dropping the knowledge
Traek Wells
@TraekWells
Mar 20 2017 04:21
ahh
lmao
thanks everyone!
lemme send some cookies
Manish Giri
@Manish-Giri
Mar 20 2017 04:22
:joy:
lol
Traek Wells
@TraekWells
Mar 20 2017 04:22
thanks @JLuboff @MathematicsCoding and @Manish-Giri
CamperBot
@camperbot
Mar 20 2017 04:22
traekwells sends brownie points to @jluboff and @mathematicscoding and @manish-giri :sparkles: :thumbsup: :sparkles:
:cookie: 209 | @mathematicscoding |http://www.freecodecamp.com/mathematicscoding
:star2: 1197 | @jluboff |http://www.freecodecamp.com/jluboff
:star2: 4841 | @manish-giri |http://www.freecodecamp.com/manish-giri
Traek Wells
@TraekWells
Mar 20 2017 04:22
lol
Jason Luboff
@JLuboff
Mar 20 2017 04:22
I mean, I "thought" I knew but @Manish-Giri came in with conviction!
Manish Giri
@Manish-Giri
Mar 20 2017 04:22
@JLuboff just 3 to go!
Joseph
@revisualize
Mar 20 2017 04:23
@TraekWells Are you working on LambdaSchool's Mini-bootcamp?
Traek Wells
@TraekWells
Mar 20 2017 04:23
I am indeed
Joseph
@revisualize
Mar 20 2017 04:23
@TraekWells They have help on their slack.
Traek Wells
@TraekWells
Mar 20 2017 04:23
true, I find this community way better and quicker to respond though
Jason Luboff
@JLuboff
Mar 20 2017 04:23
And only 2600 to catch you 😂
Manish Giri
@Manish-Giri
Mar 20 2017 04:24
lol
how many more do I need
let's see
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:24
@Manish-Giri thanks
CamperBot
@camperbot
Mar 20 2017 04:24
mathematicscoding sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4842 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Mar 20 2017 04:24
about @rphares
CamperBot
@camperbot
Mar 20 2017 04:24
:star2: 6557 | @rphares |http://www.freecodecamp.com/rphares
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:25
Wow
Manish Giri
@Manish-Giri
Mar 20 2017 04:25
about 1600
Joseph
@revisualize
Mar 20 2017 04:25
@TraekWells I'm on their slack and I don't see your question anywhere.
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:25
@camperbot thanks
CamperBot
@camperbot
Mar 20 2017 04:25
mathematicscoding sends brownie points to @camperbot :sparkles: :thumbsup: :sparkles:
:star2: 3116 | @camperbot |http://www.freecodecamp.com/camperbot
Traek Wells
@TraekWells
Mar 20 2017 04:25
@revisualize because I didn’t ask it in there. I like this community better. If no one responds in here then I’ll ask it in there
Jason Luboff
@JLuboff
Mar 20 2017 04:25
About @sjames1958gm
CamperBot
@camperbot
Mar 20 2017 04:25
:star2: 6248 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:26
:star2: 7000 | @MathematicsCoding |
Catch me
Jason Luboff
@JLuboff
Mar 20 2017 04:26
Dang even sjames is behind
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:26
(Evil Laugh)
Joseph
@revisualize
Mar 20 2017 04:26
OMG.
FreeCodeCamp/HelpJavaScript
Get help on our basic JavaScript and Algorithms Challenges.
Jim
@JLOSS1
Mar 20 2017 04:26
holy sh*t
Joseph
@revisualize
Mar 20 2017 04:27
We should make a gitter chat for getting help with other website's JavaScript Challenges.
Herman Fassett
@HermanFassett
Mar 20 2017 04:27
codewars
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:27
@HermanFassett thanks
CamperBot
@camperbot
Mar 20 2017 04:27
mathematicscoding sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star2: 1698 | @hermanfassett |http://www.freecodecamp.com/hermanfassett
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:27
Wtf?
1698? I thought you are working on last certificate...
Herman Fassett
@HermanFassett
Mar 20 2017 04:27
I'm a super slacker in brownie points.
Most of these points are from over a year ago
I used to be one of the top xD
Joseph
@revisualize
Mar 20 2017 04:28
about @revisualize
CamperBot
@camperbot
Mar 20 2017 04:28
:star2: 3555 | @revisualize |http://www.freecodecamp.com/revisualize
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:28
about @camperbot
CamperBot
@camperbot
Mar 20 2017 04:28
:star2: 3116 | @camperbot |http://www.freecodecamp.com/camperbot
Joseph
@revisualize
Mar 20 2017 04:28
I don't have any certs.
Herman Fassett
@HermanFassett
Mar 20 2017 04:28
This is the most active I've been in awhile
I doubt I'll ever get the 4th certificate xd
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:28
about @freecodecamp
CamperBot
@camperbot
Mar 20 2017 04:28
:warning: no user found for freecodecamp
Jason Luboff
@JLuboff
Mar 20 2017 04:29
I only got my front end last week
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:29
about @mydigitalself
CamperBot
@camperbot
Mar 20 2017 04:29
:warning: no user found for mydigitalself
Manish Giri
@Manish-Giri
Mar 20 2017 04:29
I gotta get my data viz soon
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:29
Hm
AKS
@amitkumarsarangi
Mar 20 2017 04:29
@JLuboff congrats
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:29
about @me
CamperBot
@camperbot
Mar 20 2017 04:29
:warning: no user found for me
Jason Luboff
@JLuboff
Mar 20 2017 04:29
@amitkumarsarangi thanks!
CamperBot
@camperbot
Mar 20 2017 04:29
jluboff sends brownie points to @amitkumarsarangi :sparkles: :thumbsup: :sparkles:
:cookie: 343 | @amitkumarsarangi |http://www.freecodecamp.com/amitkumarsarangi
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:29
about @MathematicsCoding
CamperBot
@camperbot
Mar 20 2017 04:29
:cookie: 209 | @mathematicscoding |http://www.freecodecamp.com/mathematicscoding
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:29
..
Why cant I get "Getting Started Certification?!"
Herman Fassett
@HermanFassett
Mar 20 2017 04:31
This certifies that you can register for an account on a website.
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:31
..
Good one
Joseph
@revisualize
Mar 20 2017 04:31
Why can't I get a trophy for "Just showing up"?
Why can't I get someone else to wipe my ass?
Why can't I get someone else to chew my food?
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:32
lol
Herman Fassett
@HermanFassett
Mar 20 2017 04:32
I outsource all my projects
xD
Mario Lukic
@pasuljG
Mar 20 2017 04:32
Hi guys. Im doing Quote Machine and all is good. Only problem is that codepen link is included when I tweet the quote? any ideas why?
Saboor Malik
@MathematicsCoding
Mar 20 2017 04:35
Good night
Bye guys
Herman Fassett
@HermanFassett
Mar 20 2017 04:35
Bye
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 04:35
@pasuljG its cus of the way youre creating the text for the tweet
Manish Giri
@Manish-Giri
Mar 20 2017 04:37
prepare the text from the API return directly
  success: function(data){
    $("#quote").html("<h5>" + data.quoteText + "</h5>" + "<br>" + "--" + data.quoteAuthor + "--");
Mario Lukic
@pasuljG
Mar 20 2017 04:37
thank you @Manish-Giri !
CamperBot
@camperbot
Mar 20 2017 04:37
pasuljg sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 4843 | @manish-giri |http://www.freecodecamp.com/manish-giri
Mario Lukic
@pasuljG
Mar 20 2017 04:45
@Manish-Giri I'm not really sure what do you mean with prepare text from api return directly.
jamiebutt16
@jamiebutt16
Mar 20 2017 04:50
hey can someone please help me with finding a remainder in js i have no idea what im doing
Jim
@JLOSS1
Mar 20 2017 04:53
@jamiebutt16 instead of / for divide to get a whole number without the remainder, use % to only return the remainder
Miguel Vasquez
@mivasquez386
Mar 20 2017 04:56
hi all. are there any experts on for loop here?
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 04:56
@mivasquez386 whats the problem?
Herman Fassett
@HermanFassett
Mar 20 2017 04:56
Ask a question and hopefully someone will know the answer :D
Miguel Vasquez
@mivasquez386
Mar 20 2017 04:58
@HeebieGeeBee using i < arr.length versus using i < myArrLength when you give var myArrLength the value of arr.length.
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 04:58
well its less efficient
Herman Fassett
@HermanFassett
Mar 20 2017 04:58
Well, if arr actual length changes then the for loop could also be affected.
Instead of a static length
Miguel Vasquez
@mivasquez386
Mar 20 2017 04:59
the value of arr.length changes?
Herman Fassett
@HermanFassett
Mar 20 2017 05:00
Not necessarily.
But say you push an item to the array inside the for loop, then the arr length will be changed and the loop will run longer
Miguel Vasquez
@mivasquez386
Mar 20 2017 05:00
doing the chunkyMonkey. I figured out the solution but was stumped when arr.length was not giving me the right solution.
@HermanFassett got it
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 05:01
@mivasquez386 how so?
what was your code?
Miguel Vasquez
@mivasquez386
Mar 20 2017 05:02
code was:

function chunkArrayInGroups(arr, size) {
  var myArr = [];
  if(size <= 0) {
    return arr;
  }
  for(var i = 0; i < arr.length; i += size) {
    myArr.push(arr.splice(0, size));
  }

  return myArr;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
Herman Fassett
@HermanFassett
Mar 20 2017 05:02
;)
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 05:03
@mivasquez386 so what was the problem with that?
Miguel Vasquez
@mivasquez386
Mar 20 2017 05:03
not giving me the correct solution
that's why i was stumped.
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 05:03
what does it give you when it runs?
Miguel Vasquez
@mivasquez386
Mar 20 2017 05:04
only giving me [["a","b"]]
Rohan Sharma
@RhnSharma
Mar 20 2017 05:04
help me on this
this is my code
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();
Miguel Vasquez
@mivasquez386
Mar 20 2017 05:04
versus [["a","b"],["c","d"]]
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 05:05
@mivasquez386 probably cus youre doing i += size
@mivasquez386 after the first iteration i becomes 2 and arr.length becomes 2
so the loop stops running
Miguel Vasquez
@mivasquez386
Mar 20 2017 05:07
how would this be fixed without using var myArrLength = arr.length? of how would the i+= size need to be changed?
Rohan Sharma
@RhnSharma
Mar 20 2017 05:09
???????~
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 05:09
@mivasquez386 maybe a while loop would be better
@RhnSharma whats the problem with the code?
Rohan Sharma
@RhnSharma
Mar 20 2017 05:09
@HeebieGeeBee i dont understand,its isnt working.Dont know why
HeebieGeeBee
@HeebieGeeBee
Mar 20 2017 05:10
@RhnSharma what are you meant to do in the challenge?
Rohan Sharma
@RhnSharma
Mar 20 2017 05:11
@HeebieGeeBee is is the "Make Unique Objects by Passing Parameters to our Constructor" challenge.
Herman Fassett
@HermanFassett
Mar 20 2017 05:11
Are you supposed to set up the function so it assigns the parameters to the object fields perhaps?
Miguel Vasquez
@mivasquez386
Mar 20 2017 05:11
@HeebieGeeBee as always, thanks
CamperBot
@camperbot
Mar 20 2017 05:11
mivasquez386 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1105 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Miguel Vasquez
@mivasquez386
Mar 20 2017 05:11
@HermanFassett thank you for your insight as well
CamperBot
@camperbot
Mar 20 2017 05:11
mivasquez386 sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star2: 1702 | @hermanfassett |http://www.freecodecamp.com/hermanfassett
Rohan Sharma
@RhnSharma
Mar 20 2017 05:11
@HermanFassett yes
Herman Fassett
@HermanFassett
Mar 20 2017 05:12
@RhnSharma in that case, you need to change the function so it isn't hardcoding with 4, 5, and 1, but instead assigning wheels, seats, and engines parameters to the object fields.
Rohan Sharma
@RhnSharma
Mar 20 2017 05:12
@HermanFassett ok i will try
@HermanFassett Thanks
CamperBot
@camperbot
Mar 20 2017 05:13
rhnsharma sends brownie points to @hermanfassett :sparkles: :thumbsup: :sparkles:
:star2: 1703 | @hermanfassett |http://www.freecodecamp.com/hermanfassett
Rohan Sharma
@RhnSharma
Mar 20 2017 05:13
@HermanFassett now its done
Herman Fassett
@HermanFassett
Mar 20 2017 05:14
:thumbsup:
Rohan Sharma
@RhnSharma
Mar 20 2017 05:15
:smile:
Pinguincommander
@Pinguincommander
Mar 20 2017 05:24
change.push([cid[i][0] ,toDollar(ret)])