These are chat archives for FreeCodeCamp/HelpJavaScript

6th
Jul 2016
Boris
@boris-in-london
Jul 06 2016 00:00
@jkron87 hey your code is good
so you want arrange them in each array from smallest to largest? or largest to smallest?
then you want the largest one of each array in one array?
greg
@wearenotgroot
Jul 06 2016 00:01
@jltx113 remember you are trying to convert celsius into fahrenheit.
jkron87
@jkron87
Jul 06 2016 00:01
@boris-in-london Arrange the largest to smallest and take index[0]
Will
@Will-is-Coding
Jul 06 2016 00:02
@lettda I don't think there's point in storing the str in words. Split it with '' as some of the strs have words and other are just one word. Also I think you have the right idea with pop but check it against target letter by letter too. Or you could use the length of target to your advantage too.
jkron87
@jkron87
Jul 06 2016 00:03
@boris-in-london It should be returning an array of the largest numbers of each individual array
greg
@wearenotgroot
Jul 06 2016 00:03

@jltx113

function convertToF(celsius) //<--------- you see that function parameter "celsius", that hold the value you passed when you called the function


convertToF(30); //<---------- value 30 will be stored in celsius parameter

now just plug in that parameter into the formula instead of hard-coding the value
formula: T(F) = T(C) * 9/5 + 32

fahrenheit = celsius * (9/5) + 32; //remember multiplication opertor is *
Boris
@boris-in-london
Jul 06 2016 00:03
@jkron87 thats what i am getting from you code, no changes made
This message was deleted
jkron87
@jkron87
Jul 06 2016 00:05
@boris-in-london Hmm for some reason it says its not passing the tests
Boris
@boris-in-london
Jul 06 2016 00:06
oh i see, one second.
Davey Morales
@davey08
Jul 06 2016 00:06
var myStr= "This is the start." + "This is the end.";
What am i doing wrong?
Moisés Man
@moigithub
Jul 06 2016 00:06
missing a space probably ?? @davey08
Angelo Julioth Valderrama
@angelojulioth
Jul 06 2016 00:06
I don't understand the instructions given by https://www.freecodecamp.com/challenges/record-collection
jkron87
@jkron87
Jul 06 2016 00:07
Oooo the numbers in the array are out of order. It should return [27,5,39,1001]
@boris-in-london Oooo the numbers in the array are out of order. It should return [27,5,39,1001]
lettda
@lettda
Jul 06 2016 00:08
@Will-is-Coding i wanted to save the string split by '' and 'spaces' because some are just single strings while other inputs are sentences
Boris
@boris-in-london
Jul 06 2016 00:08
lol @jkron87 there you go!
Davey Morales
@davey08
Jul 06 2016 00:08
@moigithub it comes out exactly how they want it tho
Moisés Man
@moigithub
Jul 06 2016 00:09
@davey08 the code above output like this
This is the start.This is the end.
This is the start. This is the end. r u sure it shouldnt be like this instead??
Boris
@boris-in-london
Jul 06 2016 00:09
@jkron87 why though? isnt 27 larger than 5?
Will
@Will-is-Coding
Jul 06 2016 00:09
@lettda Well yes, but it isn't necessary for solving it. Simply storing it split by every character is more than feasible.
jkron87
@jkron87
Jul 06 2016 00:09
It's the "Return Largest Numbers in Arrays" @boris-in-london
@boris-in-london These are the tests: largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]) should return an array.
largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]) should return [27,5,39,1001].
largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]) should return [9, 35, 97, 1000000].
Angelo Julioth Valderrama
@angelojulioth
Jul 06 2016 00:10
Can somebody help me with the records challenge from basic javascript section? I swear I'm following instructions, instructions are not clear enough
Davey Morales
@davey08
Jul 06 2016 00:11
@moigithub i dont think so becaise it needs the +
Moisés Man
@moigithub
Jul 06 2016 00:11
im only showing the result.. not the code u should write :) @davey08
Will
@Will-is-Coding
Jul 06 2016 00:11
@lettda That last code snippet you posted has it so you're checking if if (storedString == target) but the input is confirmEnding("Bastian", "n") SO you're checking if( Bastian === n )
Boris
@boris-in-london
Jul 06 2016 00:11
@jkron87 so you're code is fine, is there still an error?
Hassaan Hafeez
@HassHz
Jul 06 2016 00:11

@angelojulioth

if (!collection[id].hasOwnProperty("tracks")){
      collection[id].tracks = [];
    }

This should only be done if prop === "tracks" so try putting it in your esle statement before you push

jkron87
@jkron87
Jul 06 2016 00:11
@boris-in-london Yes. It won't pass the tests
Moisés Man
@moigithub
Jul 06 2016 00:12
@boris-in-london @jkron87 move ur global variables inside the function :)
Boris
@boris-in-london
Jul 06 2016 00:12
sortedArray = [];
biggestNumbers =[];
firstNumber=0;
var largestNumber = 0;
function largestOfFour(arr) {
  for (var i = 0; i<arr.length; i++){
    sortedArray[i] = arr[i].sort(function(a, b) {
  return b- a;});
  }
  for (var j = 0; j<arr.length; j++){
    firstNumber = sortedArray[j];
    biggestNumbers.push(firstNumber[0]);
  }
  return biggestNumbers;
}
```
Will
@Will-is-Coding
Jul 06 2016 00:12
@moigithub May be able to explain better than me, my explaining on this challenge without giving away too much is not working so well. @lettda
jkron87
@jkron87
Jul 06 2016 00:12
@boris-in-london ahhh! just figured it out. the variables needed to be in the function for some reason
Moisés Man
@moigithub
Jul 06 2016 00:12
@Will-is-Coding my english is crap :)
jkron87
@jkron87
Jul 06 2016 00:13
@boris-in-london

function largestOfFour(arr) {
  var sortedArray= [];
  var biggestNumbers =[];
  var firstNumber=0;
  var largestNumber = 0;
  for (var i = 0; i<arr.length; i++){
    sortedArray[i] = arr[i].sort(function(a, b) {
  return b- a;});
  }
  for (var j = 0; j<arr.length; j++){
    firstNumber = sortedArray[j];
    biggestNumbers.push(firstNumber[0]);
  }
  return biggestNumbers;
} 



largestOfFour([[13, 27, 18, 26], [4, 5, 1, 3], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
@boris-in-london Do you know why that is?
Boris
@boris-in-london
Jul 06 2016 00:13
nice.... that looks good @jkron87
Angelo Julioth Valderrama
@angelojulioth
Jul 06 2016 00:13
@HassHz I already did that, there are various instructions to be done
Will
@Will-is-Coding
Jul 06 2016 00:13
@moigithub But your coding skills are not heh
Hassaan Hafeez
@HassHz
Jul 06 2016 00:14
@angelojulioth Can you post your code here? Only the function you are editing
Moisés Man
@moigithub
Jul 06 2016 00:14
@jkron87 FCC tests call ur function multiples times.. if u have global var it will KEEP their values for the next call
@boris-in-london moving inside.. it will make local variables.. so it will reset everytime u call ur function
Leon Dragan
@leondragan
Jul 06 2016 00:14
I am ripping my hair out with the "Exact Change" challenge. The test wants the results to comeback as [["QUARTER", 0.50]] but mine comes back as [["QUARTER", 0.5]]. I can't figure out a way to store a number while preserving the trailing 0. When I try toFixed(2), I get the correct output but only as a String, thus failing the Unit test. Any thoughts would be much appreciated
Boris
@boris-in-london
Jul 06 2016 00:15
@moigithub does that mean global variables can never be over written?
shamieya
@shamieya
Jul 06 2016 00:15
I'm on the same challenge @leondragan
jkron87
@jkron87
Jul 06 2016 00:15
@moigithub Thanks!
CamperBot
@camperbot
Jul 06 2016 00:15
jkron87 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 1653 | @moigithub |http://www.freecodecamp.com/moigithub
Angelo Julioth Valderrama
@angelojulioth
Jul 06 2016 00:16
@HassHz
function updateRecords(id, prop, value) {
  if (prop != "tracks" && value) {
    collection[id][prop] = value;
  }
  else if(!collection[id].hasOwnProperty("tracks")) {
    collection[id].tracks = [];
    collection[id].tracks.push(value);
  }
  else if(collection[id].hasOwnPropery("tracks") && value) {
    collection[id].tracks.push(value);
  }
  else {
    delete collection[id][prop];
  }

  return collection;
}
Moisés Man
@moigithub
Jul 06 2016 00:16
@boris-in-london they can.. but.. they dont reset if u dont write code specifically to do that
Hassaan Hafeez
@HassHz
Jul 06 2016 00:17
@angelojulioth Should add val!== "" && with your .hasOwnPropertys..
Boris
@boris-in-london
Jul 06 2016 00:17
@moigithub i see what you mean, so FFC runs the function with different arugments, but that doent matter becuase the broweser keeps the same first global variables.
Hassaan Hafeez
@HassHz
Jul 06 2016 00:17
Otherwise it could be calling that code if value === ""
Moisés Man
@moigithub
Jul 06 2016 00:17
@boris-in-london yep :)
Boris
@boris-in-london
Jul 06 2016 00:17
lol @moigithub how did you ever figure that out?
redixhumayun
@redixhumayun
Jul 06 2016 00:18
This message was deleted
Hassaan Hafeez
@HassHz
Jul 06 2016 00:18
Sorry I meant, add val !== "" && collection[id]...
lettda
@lettda
Jul 06 2016 00:18
you know what maybe I'll just save it for tomorrow I've done 2 algorithms today
it's mostly done save that last bit
Moisés Man
@moigithub
Jul 06 2016 00:18
@boris-in-london ...been some time around here :)
Angelo Julioth Valderrama
@angelojulioth
Jul 06 2016 00:19
@HassHz damn it, it was a typo ;_; I had it for like 5 min ago and it was just a typo, sometimes programming makes me want to cut my balls off, well, thank you for trying to help me
CamperBot
@camperbot
Jul 06 2016 00:19
angelojulioth sends brownie points to @hasshz :sparkles: :thumbsup: :sparkles:
:cookie: 519 | @hasshz |http://www.freecodecamp.com/hasshz
Wali Gauvin
@Docwali777
Jul 06 2016 00:19
Is there a place to read a logical and clear explanation of the Counting Cards lesson.... I had to find the answer to be able to move on.... I barely understand the verbage of the instructions...
Hassaan Hafeez
@HassHz
Jul 06 2016 00:20
@angelojulioth What's the final code?
Moisés Man
@moigithub
Jul 06 2016 00:20
@lettda u not really need to split or pop
but works with strings functions
like substr, substring or slice and length
Angelo Julioth Valderrama
@angelojulioth
Jul 06 2016 00:20
@HassHz
// Only change code below this line
function updateRecords(id, prop, value) {
  if (prop != "tracks" && value !== "") {
    collection[id][prop] = value;
  }
  else if(!collection[id].hasOwnProperty("tracks")) {
    collection[id].tracks = [];
    collection[id].tracks.push(value);
  }
  else if(collection[id].hasOwnProperty("tracks") && value) {
    collection[id].tracks.push(value);
  }
  else {
    delete collection[id][prop];
  }

  return collection;
}
Hassaan Hafeez
@HassHz
Jul 06 2016 00:22
@angelojulioth :+1:
Btw you could combine your 2nd and 3rd if's:
else if(value) {
    if(!collection[id].hasOwnProperty("tracks"))
        collection[id].tracks = [];
    collection[id].tracks.push(value);
  }
}
Jose
@MageTank
Jul 06 2016 00:23

function testLogicalOr(val) {
// Only change code below this line

if (val > 10 || val <20) {
return "Outside";
}

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

// Change this value to test
testLogicalOr(15);

opps what the heck?
Hassaan Hafeez
@HassHz
Jul 06 2016 00:23
@MageTank val > 10 || val < 20 will always return true
Angelo Julioth Valderrama
@angelojulioth
Jul 06 2016 00:24
@HassHz actually I did that, but I thought I was having a problem for not following the instructions exactly, can I do it how I want? I mean, if I want to simplify the code, does the challenge lets me do that?
Jose
@MageTank
Jul 06 2016 00:25
it has to be "outside" if val is not between 10 and 20 so ?
Hassaan Hafeez
@HassHz
Jul 06 2016 00:25
@angelojulioth If you go back to the challenge and simplify it, and run +tests, and move on the next challenge again, it will update it
Hassaan Hafeez
@HassHz
Jul 06 2016 00:26
@MageTank Still have < 20..
You fixed > 10 to < 10 :+1:
Now fix < 20
Angelo Julioth Valderrama
@angelojulioth
Jul 06 2016 00:27
@MageTank if(val < 10 && val > 20) { return "outside"}
@HassHz thanks, I'll do that
CamperBot
@camperbot
Jul 06 2016 00:27
angelojulioth sends brownie points to @hasshz :sparkles: :thumbsup: :sparkles:
:warning: angelojulioth already gave hasshz points
Hassaan Hafeez
@HassHz
Jul 06 2016 00:27
@angelojulioth val can't be less than 10 AND be greater than 20 :P
Jose
@MageTank
Jul 06 2016 00:28
@angelojulioth i have to use ||
Angelo Julioth Valderrama
@angelojulioth
Jul 06 2016 00:28
sorry ;_; I've been here for 5 hours, I think I need a nap or something
Jose
@MageTank
Jul 06 2016 00:28
its fine
Hassaan Hafeez
@HassHz
Jul 06 2016 00:29
@MageTank Did you fix it?
@angelojulioth It happens :)
Jose
@MageTank
Jul 06 2016 00:29
yes i did thanks @HassHz
CamperBot
@camperbot
Jul 06 2016 00:29
:cookie: 520 | @hasshz |http://www.freecodecamp.com/hasshz
magetank sends brownie points to @hasshz :sparkles: :thumbsup: :sparkles:
Jose
@MageTank
Jul 06 2016 00:30
you have been doing this for a while @HassHz how do you stay motivated?
amran16
@amran16
Jul 06 2016 00:30
hi there, can someone tell me what is wrong this code #193:
Hassaan Hafeez
@HassHz
Jul 06 2016 00:31
@MageTank Well I've done minor programming before I started learning JS on FreeCodeCamp, so the challenges weren't that hard for me. Just had to get used to the syntax
@amran16 The numbers refer to a user's brownie points, they have no correlation with challenges
Jose
@MageTank
Jul 06 2016 00:32
@HassHz I have done some C++ at school this is very similar to that
matthew3454
@matthew3454
Jul 06 2016 00:32
I working on Diff Two Arrays and I already completed most of the activity. However, with the help that I got by searching online I can't quite understand the code I found could someone break it down for me please? Here it is : ```function diff(arr1, arr2) { var newArr = arr1.concat(arr2); function check(item) { if (arr1.indexOf(item) === -1 || arr2.indexOf(item) === -1) { return item; } } return newArr.filter(check); }
Thanks
amran16
@amran16
Jul 06 2016 00:33
// 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);
Hassaan Hafeez
@HassHz
Jul 06 2016 00:34
@matthew3454 Could you format it using the three backticks? It's hard to understand like that
help format
CamperBot
@camperbot
Jul 06 2016 00:34

: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

amran16
@amran16
Jul 06 2016 00:34
this is #193
Hassaan Hafeez
@HassHz
Jul 06 2016 00:34
@amran16 undefined is a keyword, it doesn't have quotes. You are returning a string "undefined" X
amran16
@amran16
Jul 06 2016 00:34
thanks @HassHz
CamperBot
@camperbot
Jul 06 2016 00:34
amran16 sends brownie points to @hasshz :sparkles: :thumbsup: :sparkles:
:cookie: 521 | @hasshz |http://www.freecodecamp.com/hasshz
Hassaan Hafeez
@HassHz
Jul 06 2016 00:37
This message was deleted
Wait... nevermind return item also works..
acres164
@acres164
Jul 06 2016 00:43
i dont even know how i got to this point but i cant figure it out
Julian-Prince
@Julian-Prince
Jul 06 2016 00:43
hey quick question. I'm on the lesson about escape sequences and my code is supposed to print a backslash, new line and two tabs, the code line <var myStr = 'Here is a backslash:\\.\n\t\t Here is a new line with two tabs.';> gives me the error to not have any spaces between consecutive sequences but im pretty sure i just removed the spaces
acres164
@acres164
Jul 06 2016 00:43

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

// Only change code below this line
function updateCollectionCopy(id, prop, value){
if (value === ''){
delete collection[value];
}
else if (value !== [""]){
collection = [id][prop][value];
} else {
collection[value][prop].push(id);
}
return collection;
}
// Alter values below to test your code
updateRecords(5439, "artist", "ABBA");

Tim McIntire
@tmcintire
Jul 06 2016 00:44
I'm on the "Ends with' algorithm challenge and one of my cases is returning the wrong thing. confirmEnding("He has to give me a new name", "me") should return true. That doesn't seem like it should return true though
that first argument does not end with "me"
oh wait yes it does, ignore me
Moisés Man
@moigithub
Jul 06 2016 00:45
@Julian-Prince add space after colon
remove space before Here
Boris
@boris-in-london
Jul 06 2016 00:45
lol
acres164
@acres164
Jul 06 2016 00:47
im on the Record Collection text
test*
Hassaan Hafeez
@HassHz
Jul 06 2016 00:49
(value !== [""])
Why is "" in []? Should be prop !== "tracks"
collection = [id][prop][value];
Makes no sense, collection[id][prop] = value; think about it
collection[value][prop].push(id)
Switch id and value
Julian-Prince
@Julian-Prince
Jul 06 2016 00:49
ah jeez um '< var myStr = 'Here is a backslash :\\n\t\tHere is a new line with two tabs.'; > still has the same error um
Hassaan Hafeez
@HassHz
Jul 06 2016 00:49
@Julian-Prince Add a space after : and remove space before it
acres164
@acres164
Jul 06 2016 00:50
i was at the point where i was just switching them around to see if it would work
Julian-Prince
@Julian-Prince
Jul 06 2016 00:52
thaaaank you @HassHafeez
acres164
@acres164
Jul 06 2016 00:56

function updateRecords(id, prop, value) {
if (value === '') {
delete collection[id][prop];
} else if (prop !== 'tracks') {
collection[id][prop] = value;
} else {
collection[id][prop].push(value);
}

return collection;
}

this doesnt work either
Beim
@Beim
Jul 06 2016 00:59
I'm on the "Exact Change" algorithm challenge,
and my problem is that the fourth check requires [["QUARTER", 0.50]] to be returned,
but I can only return [["QUARTER", 0.5]],
how can I change 0.5 to 0.50 ?
(I have tried to change Number 0.5 to String "0.50", but it still can not pass the check)
Greg Duncan
@GregatGit
Jul 06 2016 00:59
@acres164 you can't push into a property if it does not exist
collection[id][prop].push(value);
@acres164 check if it exists - if it doesn't you have to create the property tracks - put an empty array in it - then push the value
matthew3454
@matthew3454
Jul 06 2016 01:01
This message was deleted
David Halls
@DavidHalls
Jul 06 2016 01:01
@Beim try using .toFixed(2)
matthew3454
@matthew3454
Jul 06 2016 01:02
function diff(arr1, arr2) {
  var newArr = arr1.concat(arr2);

  function check(item) {
    if (arr1.indexOf(item) === -1 || arr2.indexOf(item) === -1) {
      return item;
    }
  }

  return newArr.filter(check);
}
@HassHz it's above this message
Beim
@Beim
Jul 06 2016 01:03
@Byzgig Thank you! well, I have tried it, but I get '0.50', the String '0.50' can not pass
CamperBot
@camperbot
Jul 06 2016 01:03
beim sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:cookie: 361 | @byzgig |http://www.freecodecamp.com/byzgig
acres164
@acres164
Jul 06 2016 01:04
i dont know what an empty array means.
does that mean i have to apply() and array??
David Halls
@DavidHalls
Jul 06 2016 01:05
@beim is your currency written as strings or numbers?
@Beim
Margaret
@Mgtei
Jul 06 2016 01:06
Would someone mind giving me a hint on the Word Blanks exercise? I just need to know if I'm miles off or just need to "fix my before statement" (whatever that means...).
Beim
@Beim
Jul 06 2016 01:06
@Byzgig numbers
tylerprosper
@removed~tylerprosper
Jul 06 2016 01:06
Hey guys, having trouble solving the 'Stand in Line' exercise. This is my code:

function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  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));
David Halls
@DavidHalls
Jul 06 2016 01:07
@tylerprosper shift is missing something
Margaret
@Mgtei
Jul 06 2016 01:07
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "";
  // Your code below this line
  result = "The "+ myAdjective +" "+ myNoun +" "+ myVerb +" "+ myAdverb".";

  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
David Halls
@DavidHalls
Jul 06 2016 01:08
@Mgtei looks like it should pass
Will
@Will-is-Coding
Jul 06 2016 01:08
@Mgtei You're missing a + before the end after myAdverb
tylerprosper
@removed~tylerprosper
Jul 06 2016 01:08
@Byzgig '()' ah thx
CamperBot
@camperbot
Jul 06 2016 01:08
tylerprosper sends brownie points to @byzgig :sparkles: :thumbsup: :sparkles:
:cookie: 362 | @byzgig |http://www.freecodecamp.com/byzgig
Margaret
@Mgtei
Jul 06 2016 01:08
@Will-is-Coding Oh, DUH. Thank you!
CamperBot
@camperbot
Jul 06 2016 01:08
mgtei sends brownie points to @will-is-coding :sparkles: :thumbsup: :sparkles:
:cookie: 457 | @will-is-coding |http://www.freecodecamp.com/will-is-coding
Will
@Will-is-Coding
Jul 06 2016 01:08
No problem, happens
acres164
@acres164
Jul 06 2016 01:09
@GregatGit i dont get how to put in an empty arry and push it.
do i have t use apply()?
Davey Morales
@davey08
Jul 06 2016 01:09

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");
what am i suppose to do?
Hassaan Hafeez
@HassHz
Jul 06 2016 01:10
myNoun, myAdjective, myVerb, myAdverb
Use ^ to make a sentence
Greg Duncan
@GregatGit
Jul 06 2016 01:11
@acres164
obj.hasOwnProperty(prop); // to check if the property is there
obj[id].tracks = [];
obj[id].tracks.push("she loves you");
Will
@Will-is-Coding
Jul 06 2016 01:11
@davey08 Strings can be added together via the + between them. The parameters myNoun, myAdjective, myVerb, myAdverb act as place holders for what strings are being passed in and you can use them as though they were strings.
Emanuel Quimper
@EQuimper
Jul 06 2016 01:11

I think I have find Title Case a Sentence

function titleCase(str) {

  var arr = str.split(' ');

  var newStr = '';

  for (var i = 0; i < arr.length; i++) {
    var lower = arr[i].toLowerCase();
    newStr += lower.charAt(0).toUpperCase() + lower.slice(1) + ' '; 
  }

  return newStr;
}

titleCase("HERE IS MY HANDLE HERE IS MY SPOUT”);

All my result are the response I’m suppose but nothing pass

Hassaan Hafeez
@HassHz
Jul 06 2016 01:12
@EQuimper Because you will have an extra " " at the end
What you could do is
arr[i] = arr[i].toLowerCase();
arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].slice(1);
Emanuel Quimper
@EQuimper
Jul 06 2016 01:13
so I have a space at the end ?
Hassaan Hafeez
@HassHz
Jul 06 2016 01:13
That way you will not have to introduce the + " ";
Emanuel Quimper
@EQuimper
Jul 06 2016 01:14
i dont understand
Hassaan Hafeez
@HassHz
Jul 06 2016 01:14
But you will have to use arr.join(' '); to make it back into a string
@EQuimper You see how you have:
lower.slice(1) + ' ':
The + ' ' will render an extra space after your last word
Emanuel Quimper
@EQuimper
Jul 06 2016 01:15
Yes I figured out you help me to find I have a whitespace at the end so I did
function titleCase(str) {

  var arr = str.split(' ');

  var newStr = '';

  for (var i = 0; i < arr.length; i++) {
    var lower = arr[i].toLowerCase();
    newStr += lower.charAt(0).toUpperCase() + lower.slice(1) + ' '; 
  }

  return newStr.trim();
}

titleCase("HERE IS MY HANDLE HERE IS MY SPOUT”);
I have use trim()
Hassaan Hafeez
@HassHz
Jul 06 2016 01:15
I see
Emanuel Quimper
@EQuimper
Jul 06 2016 01:15
but thank you a lot
really appreciate it
Hassaan Hafeez
@HassHz
Jul 06 2016 01:16
:+1:
CamperBot
@camperbot
Jul 06 2016 01:16

:point_right: back end project resources [wiki]

Getting Started with Back End Projects

The curriculum lead-up to the first Back End Project is not very comprehensive. Here are a number of common resources which other campers have found helpful.

:pencil: read more about back end project resources on the FCC Wiki

Davey Morales
@davey08
Jul 06 2016 01:23
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "";
  // Your code below this line
  result = (myNoun,myAdjective,myVerb,myAdverb);
  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog"+ "big"+ "ran"+"quickly");
@Will-is-Coding i am so confused on what to do
Michael Morris
@micshot
Jul 06 2016 01:27
Am I the only one that gets frustrated that I can't figure it out and then spends hours looking at someone elses results online just to stare at it like WTF how?
emmanoelmorais
@emmanoelmorais
Jul 06 2016 01:28
hello
96street
@96street
Jul 06 2016 01:28
Can someone tell me why my if statement isn't working here? http://codepen.io/kingdezz/pen/zBzBaZ?editors=0110
emmanoelmorais
@emmanoelmorais
Jul 06 2016 01:28
good evening

someone could help me with the bellow challenge?
https://www.freecodecamp.com/challenges/exact-change

i dont pass in the test because it expect the return:
[["QUARTER", 0.50]]

and i return:
[["QUARTER", 0.5]]

Hassaan Hafeez
@HassHz
Jul 06 2016 01:29
@davey08 Not like that, myNoun myAdjective myVerb myAdverb are variables? Do you remembe rthe challenge concatenating variables in strings or something along those lines?
Diego Mayer
@Chrono79
Jul 06 2016 01:29
@emmanoelmorais that's not the problem
console.log(0.50 == 0.5); //true
Greg Duncan
@GregatGit
Jul 06 2016 01:29
@emmanoelmorais
var numObj = 12345.6789;

numObj.toFixed();       // Returns '12346': note rounding, no fractional part
numObj.toFixed(1);      // Returns '12345.7': note rounding
numObj.toFixed(6);      // Returns '12345.678900': note added zeros
(1.23e+20).toFixed(2);  // Returns '123000000000000000000.00'
(1.23e-10).toFixed(2);  // Returns '0.00'
2.34.toFixed(1);        // Returns '2.3'
2.35.toFixed(1);        // Returns '2.4'. Note that it rounds up in this case.
-2.34.toFixed(1);       // Returns -2.3 (due to operator precedence, negative number literals don't return a string...)
(-2.34).toFixed(1);     // Returns '-2.3' (...unless you use parentheses)
David Halls
@DavidHalls
Jul 06 2016 01:31
@96street take the . out before online and offline in your css
Davey Morales
@davey08
Jul 06 2016 01:31
@HassHz with using the + to seperate them?
David Halls
@DavidHalls
Jul 06 2016 01:32
@96street or add a . to your jquery addClass
Gregory Garzon
@chibieee
Jul 06 2016 01:32
anyone want to pair up and tackle the intermediate alogrithm section?
emmanoelmorais
@emmanoelmorais
Jul 06 2016 01:33
@Chrono79 @GregatGit but in the challenge is wrong
Diego Mayer
@Chrono79
Jul 06 2016 01:33
@emmanoelmorais let's see your code
emmanoelmorais
@emmanoelmorais
Jul 06 2016 01:34
This message was deleted
sorry
Greg Duncan
@GregatGit
Jul 06 2016 01:35
@emmanoelmorais you can edit it - your link above
Hassaan Hafeez
@HassHz
Jul 06 2016 01:35
@davey08 Yeah!
Diego Mayer
@Chrono79
Jul 06 2016 01:35
@emmanoelmorais use gist if it's long
96street
@96street
Jul 06 2016 01:35
didn't work @Byzgig
Hassaan Hafeez
@HassHz
Jul 06 2016 01:36
@davey08 But you also have to make sure the words are separated by spaces, otherwise it will look like dogbigranquickly
Which won't be enough to pass the challenge
Greg Duncan
@GregatGit
Jul 06 2016 01:36
@Chrono79 what is the 'gist'
emmanoelmorais
@emmanoelmorais
Jul 06 2016 01:36
@GregatGit thanks
CamperBot
@camperbot
Jul 06 2016 01:37
emmanoelmorais sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 658 | @gregatgit |http://www.freecodecamp.com/gregatgit
Diego Mayer
@Chrono79
Jul 06 2016 01:39
@emmanoelmorais it's returning Insufficient funds in almost all cases
emmanoelmorais
@emmanoelmorais
Jul 06 2016 01:41
@Chrono79 if you look at the end of file, you see the call where the error occourr
Diego Mayer
@Chrono79
Jul 06 2016 01:41
@emmanoelmorais https://repl.it/C7nW/7
emmanoelmorais
@emmanoelmorais
Jul 06 2016 01:41
@Chrono79 if you paste my code in the https://www.freecodecamp.com/challenges/exact-change
you will see the error
Davey Morales
@davey08
Jul 06 2016 01:41

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result =("dog "+"big "+" ran "+" quickly");
  // 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");
@HassHz so I got this right but I still have to switch the words am I suppose to create something new now?
Diego Mayer
@Chrono79
Jul 06 2016 01:42
@emmanoelmorais I already did that
Hassaan Hafeez
@HassHz
Jul 06 2016 01:43
@davey08 I told you to use the variables, not the words directly..
emmanoelmorais
@emmanoelmorais
Jul 06 2016 01:44
@Chrono79 dont use === because 'change' is a string use ==
Hassaan Hafeez
@HassHz
Jul 06 2016 01:45
@davey08 Don't change the last line.
wordBlanks("dog", "big", "ran", "quickly");
This statement ^ calls the wordBlanks function with FOUR arguments which are all strings (the function you are to implement)
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb)
This ^ is the function declaration for wordBlanks which takes in FOUR ;) parameters.
so in this case, myNoun will be equal to "dog", myAdjective will be equal to "big", and so on..
so you can do:
var result = myNoun + " " + myAdjective
This^ will make result = "dog big"
Diego Mayer
@Chrono79
Jul 06 2016 01:47
@emmanoelmorais return arr, not JSON.stringify(arr)
emmanoelmorais
@emmanoelmorais
Jul 06 2016 01:48
@Chrono79 THANKSSSSSSSSS!!!
@Chrono79 I was more than two hours without knowing the problem... thanks a lot
CamperBot
@camperbot
Jul 06 2016 01:49
emmanoelmorais sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1431 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jul 06 2016 01:49
no problem :+1:
Davey Morales
@davey08
Jul 06 2016 01:51
I got it man thanks you are a life saver!! @HassHz
CamperBot
@camperbot
Jul 06 2016 01:51
davey08 sends brownie points to @hasshz :sparkles: :thumbsup: :sparkles:
:cookie: 522 | @hasshz |http://www.freecodecamp.com/hasshz
Hassaan Hafeez
@HassHz
Jul 06 2016 01:55
@davey08 Hope you have a better understanding of how the functions work now :+1:
jrandallhansen
@jrandallhansen
Jul 06 2016 01:56
Hey everyone. I am having trouble using javascript objects for lookups. Could someone take a look at this and spot my error(s)?
David Halls
@DavidHalls
Jul 06 2016 01:56
word
jrandallhansen
@jrandallhansen
Jul 06 2016 01:56

// 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",
  };
  result = lookup.val;

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

// Change this value to test
phoneticLookup("charlie");
Diego Mayer
@Chrono79
Jul 06 2016 01:56
@jrandallhansen use bracket notation
jrandallhansen
@jrandallhansen
Jul 06 2016 01:57
@Chrono79 you have to use bracket for variables?
Diego Mayer
@Chrono79
Jul 06 2016 01:57
yes
jrandallhansen
@jrandallhansen
Jul 06 2016 01:57
thank you. i thought dot notation was ok too :/
lol
thanks @Chrono79
CamperBot
@camperbot
Jul 06 2016 01:57
jrandallhansen sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1432 | @chrono79 |http://www.freecodecamp.com/chrono79
Hassaan Hafeez
@HassHz
Jul 06 2016 01:58
@jrandallhansen Reason is because lookup.val is the same as lookup["val"] which will look for a "val" property
Diego Mayer
@Chrono79
Jul 06 2016 01:58
val is not a property of lookup, val contains a string and you need bracket notation with strings
jltx113
@jltx113
Jul 06 2016 02:00
@wearenotgroot thank you
CamperBot
@camperbot
Jul 06 2016 02:00
jltx113 sends brownie points to @wearenotgroot :sparkles: :thumbsup: :sparkles:
:star2: 1207 | @wearenotgroot |http://www.freecodecamp.com/wearenotgroot
falconpunch12
@falconpunch12
Jul 06 2016 02:11
anyone available to assist with the card counting javascript challenge? not sure if i need to use a switch or if else
Diego Mayer
@Chrono79
Jul 06 2016 02:11
@falconpunch12 you can use either one for card evaluation
falconpunch12
@falconpunch12
Jul 06 2016 02:13
for some reason its not recognizing the count variable inside of the switch... kind of odd
Diego Mayer
@Chrono79
Jul 06 2016 02:14
@falconpunch12 you have to evaluate card in one block and count in another
Claude
@claudiga
Jul 06 2016 02:15
hey guys
falconpunch12
@falconpunch12
Jul 06 2016 02:15
@Chrono79 can you provide a bit more clarification?
Diego Mayer
@Chrono79
Jul 06 2016 02:16
show your code @falconpunch12 and I'll see what's wrong with it
Claude
@claudiga
Jul 06 2016 02:17
$( ".handle" ).on( "click", function() {
        $("nav ul").toggleClass("showing");
    });
Im trying to learn javascript
This is jquery how do i convert it into a jscript equivalent?
Hassaan Hafeez
@HassHz
Jul 06 2016 02:19

@claudiga

window.document.getElementsByClassName("handle").addEventListener('click', function(){ 
    this.classList.toggle("showing");
});

?

Will
@Will-is-Coding
Jul 06 2016 02:19
@davey08 Did you get it or need more assistance?
Claude
@claudiga
Jul 06 2016 02:20
@HassHz thanks dude i will give it a try
CamperBot
@camperbot
Jul 06 2016 02:20
claudiga sends brownie points to @hasshz :sparkles: :thumbsup: :sparkles:
:cookie: 523 | @hasshz |http://www.freecodecamp.com/hasshz
Diego Mayer
@Chrono79
Jul 06 2016 02:20
Hassaan Hafeez
@HassHz
Jul 06 2016 02:20
I'm not sure about the toggleClass
Claude
@claudiga
Jul 06 2016 02:21
@Chrono79 great website definitely going in my bookmarks
Diego Mayer
@Chrono79
Jul 06 2016 02:22
mine too now ;)
Tarun sehgal
@FCCtarun
Jul 06 2016 02:34
Counting Cards
I have used multiple identical switch statements and only 3 statements have executed out of 7. what should I Change in my code.
var count = 0;

function cc(card) {
  // Only change code below this line
  switch(card){
  case 2:
  case 3:
  case 4:
  case 5:
  case 6:
  return "5 Bet";


      case 7:
  case 8:
  case 9:
 return "0 Hold";

    case 10:
  case 'J':
  case 'Q':
  case 'K':
  case 'A':
  return "-5 Hold";  


  case 3:
  case 7:
  case 'Q':
  case 8:
  case 'A':
  return "-1 Hold";

      case 2:
  case 'J':
  case 9:
  case 2:
  case 7:
  return "1 Bet";


  case 2:
  case 2:
  case 10:

  return "1 Bet";

      case 3:
  case 2:
  case 'A':
  case 10:
  case 'K':
  return "-1 Hold";
  }
  return "Change Me";
  // 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');
David Halls
@DavidHalls
Jul 06 2016 02:36
you are not supposed to hard code the valuse for '1 bet' etc
you need to use a counter
Tarun sehgal
@FCCtarun
Jul 06 2016 02:37
how should I use counter. I didnt use counter before.
David Halls
@DavidHalls
Jul 06 2016 02:38
when you enter the switch depending on the card, you should either count++ or count-- or count stays the same
falconpunch12
@falconpunch12
Jul 06 2016 02:38
any idea what im doing wrong here?

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 = count + 1;
break;

case 7:
case 8:
case 9:
  count = count + 0;
  break;

case 10:
case "J":
case "Q":
case "K":
case "A":
  count = count - 1;
  break;

}

return "Change Me";
// Only change code above this line
}

David Halls
@DavidHalls
Jul 06 2016 02:38
you have count declared in your first line
falconpunch12
@falconpunch12
Jul 06 2016 02:39
sorry not sure why it looks like that..
Moisés Man
@moigithub
Jul 06 2016 02:39
@falconpunch12 after ur switch u need to evaluate count variable.. n return count with Bet or Hold
according tot he instructions
falconpunch12
@falconpunch12
Jul 06 2016 02:41
so i need to add a second switch/if-else below that one?
@moigithub also, it was my understanding that a switch doesnt work like a while look. shouldnt it end after one card value has been entered?
bitgrower
@bitgrower
Jul 06 2016 02:43
@falconpunch12 -- no ... you do the case statement to figure out how to manipulate the count variable ... and then, after doing that, you have to evaluate the count variable to determine what, if any, message to send ...
@falconpunch12 in this particular challenge ... the count variable is a global variable ... so the test cases will 'build' upon what happened in the past ...
Diego Mayer
@Chrono79
Jul 06 2016 02:44
@falconpunch12 your function evaluates only one card at a time, it's called multiple times
MeonAigeanta
@MeonAigeanta
Jul 06 2016 02:52
Steamroller Challenge -- my code times out. Any ideas why?
var code = "formatted"
function steamrollArray(arr) {
  var newArr = [];
  for(i = 0; i < arr.length; i++){
    if(Array.isArray(arr[i])){
      newArr = newArr.concat(steamrollArray(arr[i]));
    }else{
      newArr.push(arr[i]);
    }
  }
  return newArr;
}

steamrollArray([1, [2], [3, [[4]]]]);
falconpunch12
@falconpunch12
Jul 06 2016 02:53
ok, so i was able to adjust the code and it worked but i still dont completely understand how the function moves to the second card -_- regardless.. thank you @moigithub @bitgrower @Chrono79
CamperBot
@camperbot
Jul 06 2016 02:53
falconpunch12 sends brownie points to @moigithub and @bitgrower and @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1433 | @chrono79 |http://www.freecodecamp.com/chrono79
:star2: 1130 | @bitgrower |http://www.freecodecamp.com/bitgrower
:star2: 1654 | @moigithub |http://www.freecodecamp.com/moigithub
Diego Mayer
@Chrono79
Jul 06 2016 02:54
@falconpunch12 the test calls your function 5 times in a row, and because count is a global var it stores the value of your "hand", the console only shows the last call
falconpunch12
@falconpunch12
Jul 06 2016 03:02
@Chrono79 re-read it several times and your explanation makes sense now.. thanks!
CamperBot
@camperbot
Jul 06 2016 03:02
falconpunch12 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:warning: falconpunch12 already gave chrono79 points
Facundo Rojo
@ucaf
Jul 06 2016 03:05
Hey guys, im doing the WORD BLANKS activity for the java part, im kind of confused on what to do, can u give me a hand?
MeonAigeanta
@MeonAigeanta
Jul 06 2016 03:07
This message was deleted
Mike Haslam
@Ongomobile
Jul 06 2016 03:07
Hello Campers! I am trying to wrap my head around jQuery I have a form that tallies a quantity then calculates a price qty * price then stores in total field. Works except it does not persist gets overwritten by other quantity selector here is a codepen. Check it out tell me what you think I am doing wrong! Thanks Very Much http://codepen.io/Ongomobile/pen/LkLaqP
Facundo Rojo
@ucaf
Jul 06 2016 03:09
I got it ty anyways
Greg Duncan
@GregatGit
Jul 06 2016 03:15
@Ongomobile I would remove field='quantity' price='0.95'
Mike Haslam
@Ongomobile
Jul 06 2016 03:16
@GregatGit Thanks why do you say that?
CamperBot
@camperbot
Jul 06 2016 03:16
ongomobile sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 659 | @gregatgit |http://www.freecodecamp.com/gregatgit
Greg Duncan
@GregatGit
Jul 06 2016 03:16
@Ongomobile try the aproach of everything being stored in the js and use the html to display.
Mike Haslam
@Ongomobile
Jul 06 2016 03:18
So would I save those to a global variable in js?
Greg Duncan
@GregatGit
Jul 06 2016 03:19
@Ongomobile yes - you would have variables declared at the start of doc ready
@Ongomobile if you give the everything an id that makes sense like id='total' then you can do simple make like
var myTotal = 0;
$('#plus').click(function(){
  myTotal = $('#box1').val() + $('#box2').val();
  $('#total').html(myTotal);
}
Mike Haslam
@Ongomobile
Jul 06 2016 03:22
do i need a variable for each price?
Cameron Bass
@cameronbass
Jul 06 2016 03:22
finding a Remainder in Javascript - What am I doing wrong?

```var remainder = 11/3;

remainder = 2;```

Greg Duncan
@GregatGit
Jul 06 2016 03:24
@Ongomobile you could make a var for each - that would make it easy to follow
Mike Haslam
@Ongomobile
Jul 06 2016 03:24
Thanks Cool I will give that a try sure seams a lot simpler
MeonAigeanta
@MeonAigeanta
Jul 06 2016 03:25
Everything be true -- Am I on the right path for testing truthiness using (collection[i].pre >=1)?
var code ="formatted"
function truthCheck(collection, pre) {
  'use strict'
   var boolArr = [];
  for(var i = 0; i< collection.length; i++){
    if( collection[i].pre >=1)
     return true;
    else
      return false;
  }
  return boolArr;
}

truthCheck([{"single": "yes"}], "single");
Greg Duncan
@GregatGit
Jul 06 2016 03:25
@Ongomobile make sure you name all your variable well - dont call them x and y -
Nick Neuman
@neecholaus
Jul 06 2016 03:28
can someone tell me what exactly the + does in regular expression matches in examples like this. /\d+/g
the exercise is a little confusing on that part
Jose
@MageTank
Jul 06 2016 03:31
how to i get the count displayed along with the hold or bet?

switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
break;
case 7:
case 8:
case 9:
break;
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count--;

}

if (count > 0){
return "count bet";
}

the last part
Greg Duncan
@GregatGit
Jul 06 2016 03:33
@neecholaus n+ Matches any string that contains at least one n
Nick Neuman
@neecholaus
Jul 06 2016 03:35
@GregatGit so it doesnt just go through the string you specify? it looks through every string?
Jose
@MageTank
Jul 06 2016 03:36
anybody?
lWolfl
@lWolfl
Jul 06 2016 03:36

Can someone help me? i'm stumped on this code, im trying to define var a and var b with numbers 6 and 15. However it keeps giving me error I dont know if i am missing a code or what id did was entirely wrong

// Initialize these three variables
var a = 6;
var b = 15;
var c = "I am a";

// Do not change code below this line

a = a + 1;
b = b + 5;
c = c + " String!";

Greg
@gsc229
Jul 06 2016 03:37
can someone tell me why this returns an empty array?
function myReplace(str, before, after) {
    var upCase= after.charAt(0).toUpperCase();
    if(before.charAt(0) == before.charAt(0).toUpperCase()){ }
     //return true;

      //after.split(",").splice(0,1).join(",");

      var Split = after.split("");

      return Split.splice(0,0);


            //return after.splice(0,after.charAt(0).toUpperCase());

}

myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
Greg Duncan
@GregatGit
Jul 06 2016 03:37
@neecholaus try playing around with your strings here - https://repl.it/
MeonAigeanta
@MeonAigeanta
Jul 06 2016 03:38
@GregatGit Thanks for the tip.
CamperBot
@camperbot
Jul 06 2016 03:38
meonaigeanta sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 660 | @gregatgit |http://www.freecodecamp.com/gregatgit
Greg
@gsc229
Jul 06 2016 03:39
Sorry, here's a cleaned up version of my code...why does this return an empty array?

function myReplace(str, before, after) {
    var upCase= after.charAt(0).toUpperCase();


      var Split = after.split("");

      return Split.splice(0,0);




}

myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
Donovan
@dnvn999
Jul 06 2016 03:39
hi guys, i aint sure why my code wont solve the first requirement in challenge - mutations, can anyone help me?
function mutation(arr) {
  var str1 = arr[0].toLowerCase();
  var str2 = arr[1].toLowerCase();

  for (var i = 0; i < str1.length; i++){
  var Boo = str1.indexOf(str2[i]);

  if (Boo === -1){
    return false;

  }else {
   return true; 

  }

  }

}

mutation(["hello", "hey"]);
Greg Duncan
@GregatGit
Jul 06 2016 03:40
@gsc229 I think you can do this simpler http://www.w3schools.com/jsref/jsref_replace.asp
Greg
@gsc229
Jul 06 2016 03:42
@GregatGit thanks Greg. I read that. The reason I'm using split() / splice() is because part of the exercise is changing one of the string parameters to upper case when needed.
CamperBot
@camperbot
Jul 06 2016 03:42
gsc229 sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 661 | @gregatgit |http://www.freecodecamp.com/gregatgit
Nick Neuman
@neecholaus
Jul 06 2016 03:43
@GregatGit okay sweet thanks.
CamperBot
@camperbot
Jul 06 2016 03:43
neecholaus sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 662 | @gregatgit |http://www.freecodecamp.com/gregatgit
Hassaan Hafeez
@HassHz
Jul 06 2016 03:43
@dnvn999 Should be iterating over str2.length
str2[i] will be undefined for i > 3
Greg Duncan
@GregatGit
Jul 06 2016 03:44
@gsc229 what is the challenge called?
Greg
@gsc229
Jul 06 2016 03:44
@GregatGit it's the Search and Replace exercise btw. For whatever reason, it seems that my code cause the splice() array method to do the inverse of what it's supposed to do.
Donovan
@dnvn999
Jul 06 2016 03:45
@HassHz do you meant, var Boo = str2.indexOf(str1[i]);?
Hassaan Hafeez
@HassHz
Jul 06 2016 03:47
@dnvn999 Nope, i<str1.length -> i<str2.length
If you have str1.length, str2[i] will be undefined (in your original code) at i > 3
@gsc229 I just redid that challenge with the .replace() method and it's way shorter than before :P
  if(before.charAt(0) == before.charAt(0).toUpperCase())
    return str.replace(before, after.charAt(0).toUpperCase() + after.slice(1));
  return str.replace(before, after);
Donovan
@dnvn999
Jul 06 2016 03:49
@HassHz got it but still couldnt passed the challenges
Hassaan Hafeez
@HassHz
Jul 06 2016 03:49
@gsc229 splice kind of returns the opposite of what it modifies the array to be.
Donovan
@dnvn999
Jul 06 2016 03:49

function mutation(arr) {
  var str1 = arr[0].toLowerCase();
  var str2 = arr[1].toLowerCase();

  for (var i = 0; i < str2.length; i++){
  var Boo = str1.indexOf(str2[i]);

  if (Boo === -1){
    return false;

  }
   return true; 

  }



}

mutation(["hello", "hey"]);
Hassaan Hafeez
@HassHz
Jul 06 2016 03:50
@dnvn999 You are returning true or false on your first iteration no matter what, which means your for loop wont go past i = 0;
You should move return true to outside the for loop,
Greg
@gsc229
Jul 06 2016 03:50
@HassHz yeah, i don't understand why that is when I look at the examples on W3schools and MDN.
Hassaan Hafeez
@HassHz
Jul 06 2016 03:51
I guess it returns what it removes from the array
Greg Duncan
@GregatGit
Jul 06 2016 03:51
@gsc229 I would start by just checking if before is uppercase - then change after if needed - then a simple replace(before, after)
Greg
@gsc229
Jul 06 2016 03:51
@HassHz thanks! That's way simpler.
CamperBot
@camperbot
Jul 06 2016 03:51
:cookie: 524 | @hasshz |http://www.freecodecamp.com/hasshz
gsc229 sends brownie points to @hasshz :sparkles: :thumbsup: :sparkles:
Donovan
@dnvn999
Jul 06 2016 03:52
@HassHz Thanks, i solve it already.
CamperBot
@camperbot
Jul 06 2016 03:52
dnvn999 sends brownie points to @hasshz :sparkles: :thumbsup: :sparkles:
:cookie: 525 | @hasshz |http://www.freecodecamp.com/hasshz
Hassaan Hafeez
@HassHz
Jul 06 2016 03:52
:sparkles: :+1: :sparkles:
Greg
@gsc229
Jul 06 2016 03:53
@HassHz I tried something like that earlier but I didn't think about concatenating it like that.
tezbo
@tezbo
Jul 06 2016 03:54
hey campers
Emanuel Quimper
@EQuimper
Jul 06 2016 03:54
Chunky monkey I got everything but cannot pass the first test

function chunkArrayInGroups(arr, size) {
  var masterArr = [];
  var newArr = [];

  for (var i = 0; i < arr.length; i++) {
    console.log(arr[i]);
    if ((arr[i] % size) !== size - 1) {
      newArr.push(arr[i]);
    } else {
      newArr.push(arr[i]);
      masterArr.push(newArr);
      newArr = [];
    }
  }

  if (newArr.length !== 0) {
    masterArr.push(newArr);
  }

  return masterArr;

}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
tezbo
@tezbo
Jul 06 2016 03:54
oh @EQuimper I'm having an issue with the same exercise too atm!
Emanuel Quimper
@EQuimper
Jul 06 2016 03:54
;)
Hassaan Hafeez
@HassHz
Jul 06 2016 03:54
@gsc229 I guess you could just modify after before replacing it
after = after.replace(first letter, first letter uppercase);
Then you don't have to concat, but you had one extra line :P
tezbo
@tezbo
Jul 06 2016 03:55

I thought it'd be as easy as going:

```function chunkArrayInGroups(arr, size) {

var splitArray = new Array(size);

for(var i=0;i<splitArray.length-1;i+=size){
for(var j=0;j<size;j++){
splitArray[i] += arr[j];
}
}

return splitArray;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);

oops!

function chunkArrayInGroups(arr, size) {

var splitArray = new Array(size);

for(var i=0;i<splitArray.length-1;i+=size){
for(var j=0;j<size;j++){
splitArray[i] += arr[j];
}
}

return splitArray;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);

dammit
function chunkArrayInGroups(arr, size) {

  var splitArray = new Array(size);

  for(var i=0;i<splitArray.length-1;i+=size){
    for(var j=0;j<size;j++){
      splitArray[i] += arr[j];
    }
  }


  return splitArray;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
Hassaan Hafeez
@HassHz
Jul 06 2016 03:57
This message was deleted
I guess the answer doesn't really help lol mb
Emanuel Quimper
@EQuimper
Jul 06 2016 03:57
what is your issues @tezbo
tezbo
@tezbo
Jul 06 2016 03:58
everything :'( haha. it's splitting it but filling it with nonsense
atm it's returning ["undefinedab",null]
sooo the ab part is kindaaa working
Hassaan Hafeez
@HassHz
Jul 06 2016 03:58
You can use slice to slice the array into pieces
Emanuel Quimper
@EQuimper
Jul 06 2016 03:58
me I just don’t get the first one pass and I don’t understand
@HassHz can we multiply a slice ?
Hassaan Hafeez
@HassHz
Jul 06 2016 04:00
Multiply?
Emanuel Quimper
@EQuimper
Jul 06 2016 04:01
can we make a function who slice and call it the arr.length / size
Angelo Julioth Valderrama
@angelojulioth
Jul 06 2016 04:01
please someone explain me this formula, the one used in the JS section to generate a random number within a range, I understand the Math functions but not how or why the min and max variables are used:
Math.floor(Math.random() * (max - min + 1)) + min
Hassaan Hafeez
@HassHz
Jul 06 2016 04:02
@EQuimper No, but you can use slice within a for loop to do that, idk do you want to see my solution so I can explain it or would you rather work through it
tezbo
@tezbo
Jul 06 2016 04:05
@EQuimper I've made some headway
@EQuimper Now it's returning [["a","b"],null] :D
Ashlee Hayes
@shleehayes
Jul 06 2016 04:06
completely stumped on the word blanks lesson in the Javascript module, can someone please help!
tezbo
@tezbo
Jul 06 2016 04:06

function chunkArrayInGroups(arr, size) {

  var splitArray = new Array(size);

  for(var i=0;i<splitArray.length;i+=size++){
    for(var j=0;j<size;j++){
      splitArray[i] = arr.slice(i,i+size);
    }
  }


  return splitArray;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
just gotta get the iteration right
Hassaan Hafeez
@HassHz
Jul 06 2016 04:06
@shleehayes Recall variable concatenation in strings
Ashlee Hayes
@shleehayes
Jul 06 2016 04:07
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
function wordBlanks(dog, big, ran, quickly) {
var result = "dog + big + ran + quickly";
Hassaan Hafeez
@HassHz
Jul 06 2016 04:07
@tezbo i+=size++ -> i+=size
Ashlee Hayes
@shleehayes
Jul 06 2016 04:08
@HassHz I'm still not following ):
tezbo
@tezbo
Jul 06 2016 04:08
oh i missed that typo (i assume that was meant for me)
Hassaan Hafeez
@HassHz
Jul 06 2016 04:08
@shleehayes
Don't change the last line.
wordBlanks("dog", "big", "ran", "quickly");
This statement ^ calls the wordBlanks function with FOUR arguments which are all strings (the function you are to implement)
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb)
This ^ is the function declaration for wordBlanks which takes in FOUR ;) parameters.
so in this case, myNoun will be equal to "dog", myAdjective will be equal to "big", and so on..
so you can do:
var result = myNoun + " " + myAdjective
This^ will make result = "dog big"

@tezbo Yeah that was for you haha
Ashlee Hayes
@shleehayes
Jul 06 2016 04:09
i will try it, thank you !
tezbo
@tezbo
Jul 06 2016 04:09
@HassHz no probs. man i feel lik i'm so close :D
Ashlee Hayes
@shleehayes
Jul 06 2016 04:09
@HassHz
Hassaan Hafeez
@HassHz
Jul 06 2016 04:10
@tezbo I don't think your second loop is really doing anything, try without it?
tezbo
@tezbo
Jul 06 2016 04:11
@HassHz will do. i think my train of thought was "i need to iterate over the first dimension, then dig into the second dimension to add the elements there, and then jump out into the first dimension again to continue adding elements to the second dimension if they exist"
Kerry Ruddock (Eggs)
@KerryRuddock
Jul 06 2016 04:11
please someone explain me this formula, the one used in the JS section to generate a random number within a range, I understand the Math functions but not how or why the min and max variables are used:
```
Math.floor(Math.random() * (max - min + 1)) + min
... so Math.random is going to generate some number between 0 and 1 and say you want the number to between 10 and 100 then you would need the formula that you presented here.
Mike Haslam
@Ongomobile
Jul 06 2016 04:11
@GregatGit can't seam to wrap my head around getting steppers to increment & decrement separately without field attr in form and getting MyTotal function to work. what am I goofing up? Thanks http://codepen.io/Ongomobile/pen/LkLaqP
CamperBot
@camperbot
Jul 06 2016 04:11
ongomobile sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:warning: ongomobile already gave gregatgit points
Hassaan Hafeez
@HassHz
Jul 06 2016 04:12
@tezbo Also, since you are not incrementing i by 1 anymore, I think you should push() to the array instead of doing splitArray[i]
Because it will do splitArray[0], then splitArray[2].. and will skip 1
tezbo
@tezbo
Jul 06 2016 04:12
@HassHz but yeah, still getting the same result without the second loop so it was obviously not doing much
ahh
Rob
@ravenstudios
Jul 06 2016 04:13
anyone got a sec to help me with Record Collection?
Hassaan Hafeez
@HassHz
Jul 06 2016 04:13
@ravenstudios Sure, what's up?
thuytn
@Sophia-nguyen
Jul 06 2016 04:13

Hi, when I use lambda

`function Person(){
     this.age = 0;

    setInterval(() => {
    this.age++; // |this| properly refers to the person object
  }, 1000);
}`

. How to refer this to itself?

Greg Duncan
@GregatGit
Jul 06 2016 04:15

@Ongomobile

var Price1 =  0.95;
$("#Price1").html(Price1);

when you change the value of price1 in the js you then update what is being diplayed in the html

Rob
@ravenstudios
Jul 06 2016 04:15
@HassHz im failing one of the tests, my code looks right but somethings wrong, this is my first time asking for help so im not sure how to go about it
Dan
@dcgoings
Jul 06 2016 04:16
hey guys! could someone tear apart my roman numeral converter and tell me how i could better improve this? i know there are obviously more efficient ways, so i would love to hear them. but also if there is something i could have done better (but still using my method), i would love to hear that as well.

function convertToRoman(num) {
  var t1 = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
  var t2 = ["X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"];
  var t3 = ["C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"];
  var t4 = ["M"];

  var romanized = [];

  while (num >= 1000) {
    romanized.push(t4[0]);
    num -= 1000;    
  }

  if (num >= 100) {
    var t3quotient = Math.floor(num / 100);
    romanized.push(t3[t3quotient-1]);
    num -= (t3quotient * 100);
  }

  if (num >= 10) {
    var t2quotient = Math.floor(num / 10);
    romanized.push(t2[t2quotient-1]);
    num -= (t2quotient * 10);
  }

  if (num > 0) {
    romanized.push(t1[num-1]);
    num -= (num);
  }

  return romanized.join("");

}

convertToRoman(2201);
MeonAigeanta
@MeonAigeanta
Jul 06 2016 04:16
Everything Be True Challenge
How do I test for the properties value being true? I think my problem is in the else if(collection[i][pre]!==true) line.
var code = "formatted"
function truthCheck(collection, pre) {
  'use strict'
   var boolArr = [];
  for(var i = 0; i< collection.length; i++){
    if(!collection[i].hasOwnProperty(pre)){
        return false;
    }else if(collection[i][pre] !== true){
        return false;
    }
  }
  return true;
 }
Hassaan Hafeez
@HassHz
Jul 06 2016 04:17
@ravenstudios Post your code here (only the function you worked on) and I can probably see the error?
Rob
@ravenstudios
Jul 06 2016 04:17

function updateRecords(id, prop, value) {
if(prop === "tracks"){
if(collection.hasOwnProperty([id][prop]) === false){
collection[id][prop] = [];

}

collection[id][prop].push(value);

}

if(value === ""){
delete collection[id][prop];
}

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

//if(collection.hasOwnProperty(prop))

return collection;
}

how do i format?
Hassaan Hafeez
@HassHz
Jul 06 2016 04:17
help format
CamperBot
@camperbot
Jul 06 2016 04:17

: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

Hassaan Hafeez
@HassHz
Jul 06 2016 04:18
@MeonAigeanta It seems right..
thuytn
@Sophia-nguyen
Jul 06 2016 04:18

Hi, when I use lambda

`function Person(){
     this.age = 0;

    setInterval(() => {
    this.age++; // |this| properly refers to the person object
  }, 1000);
}`

. How to refer this to itself?

MeonAigeanta
@MeonAigeanta
Jul 06 2016 04:19

@HassHz It is failing two tests which have strings.

truthCheck([{"user": "Tinky-Winky", "sex": "male"}, {"user": "Dipsy", "sex": "male"}, {"user": "Laa-Laa", "sex": "female"}, {"user": "Po", "sex": "female"}], "sex") should return true.

truthCheck([{"single": "yes"}], "single") should return true

Hassaan Hafeez
@HassHz
Jul 06 2016 04:20
@MeonAigeanta Oh, change collection[i][pre] !== true -> !collection[id][pre]
I thought those would be the same thing, but apparently not.
Mike Haslam
@Ongomobile
Jul 06 2016 04:20
@GregatGit Ok I see thanks again!
CamperBot
@camperbot
Jul 06 2016 04:20
ongomobile sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 663 | @gregatgit |http://www.freecodecamp.com/gregatgit
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:21
hi all
MeonAigeanta
@MeonAigeanta
Jul 06 2016 04:21
@HassHz Thanks.
CamperBot
@camperbot
Jul 06 2016 04:21
meonaigeanta sends brownie points to @hasshz :sparkles: :thumbsup: :sparkles:
:cookie: 526 | @hasshz |http://www.freecodecamp.com/hasshz
Rob
@ravenstudios
Jul 06 2016 04:21

```function updateRecords(id, prop, value) {
if(prop === "tracks"){
if(collection.hasOwnProperty([id][prop]) === false){
collection[id][prop] = [];

}

collection[id][prop].push(value);

}

if(value === ""){
delete collection[id][prop];
}

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

//if(collection.hasOwnProperty(prop))

return collection;
}

Stefan Bekirov
@bekir0v
Jul 06 2016 04:21
Hi
I need help abot this code

// 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("");
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:21
need help in java-script
Hassaan Hafeez
@HassHz
Jul 06 2016 04:22
@ravenstudios Make sure the ``` are on their own line
Greg Duncan
@GregatGit
Jul 06 2016 04:22
@Ongomobile Try to use the html as a simply a display - and the js is where everything is stored
MeonAigeanta
@MeonAigeanta
Jul 06 2016 04:22
@dcgoings I don't know enough to dig into your code, but this is how I solved it.
var code = "formatted"

function convertToRoman(num) {
  var romanNum = "";


  while(num >= 1000){
    num -= 1000;
    romanNum += "M";
  }

  while(num >= 900){
    num -= 900;
    romanNum += "CM";
  }

  while(num >= 500){
    num -= 500;
    romanNum += "D";
  }

  while(num >= 400){
    num -= 400;
    romanNum += "CD";
  }
  while(num >= 100){
    num -= 100;
    romanNum += "C";
  }
  while(num >= 90){
    num -= 90;
    romanNum += "XC";
  }
  while(num >= 50){
    num -= 50;
    romanNum += "L";
  }

  while(num >= 40){
    num -= 40;
    romanNum += "XL";
  }

  while(num >= 10){
    num -= 10;
    romanNum += "X";
  }


  while(num >= 9){
    num -= 9;
    romanNum += "IX";
  }

  while(num >= 5){
    num -= 5;
    romanNum += "V";
  }

    while(num >= 4){
    num -= 4;
    romanNum += "IV";
  }

    while(num >= 1){
    num -= 1;
    romanNum += "I";
  }

 console.log(romanNum);    
 return romanNum;
}

convertToRoman(44);
Hassaan Hafeez
@HassHz
Jul 06 2016 04:23
@bekir0v Recall
https://www.freecodecamp.com/challenges/accessing-objects-properties-with-variables
In this challenge, lookup acts like testObj, and val acts like playerNumber :)
huynhmatt
@huynhmatt
Jul 06 2016 04:23
how can i make text retrieved from a textbook appear on one line on a page? i want the text to scroll left to right instead of adjusting based on the window size
retrieved from a textbox*
Luis Carlos Garcia Barajas
@Luiko
Jul 06 2016 04:25
@bekir0v 'echo' is a reserved word.
Dan
@dcgoings
Jul 06 2016 04:25
@MeonAigeanta thank you for that! it looks like you took a very similar approach as me, i just shortened up the thousands, hundreds, tens, and singles into their own if statement. very similar though. thanks!
CamperBot
@camperbot
Jul 06 2016 04:25
dcgoings sends brownie points to @meonaigeanta :sparkles: :thumbsup: :sparkles:
:cookie: 302 | @meonaigeanta |http://www.freecodecamp.com/meonaigeanta
Stefan Bekirov
@bekir0v
Jul 06 2016 04:25
@Luiko what do you mean reseved word
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:25
@bekir0v use quotation on string
Rob
@ravenstudios
Jul 06 2016 04:27
@HassHz i typed , then hit shift enter which entered at the bottom. I pasted in my code then tried to hit enter and shift enter and still cant post
Emelin GUtierrez
@emelinpg
Jul 06 2016 04:27
Can someone help me with the "Storing values with assigment operator" part in the javascript part...i have no idea what to do
Rob
@ravenstudios
Jul 06 2016 04:28
function updateRecords(id, prop, value) {
  if(prop === "tracks"){
    if(collection.hasOwnProperty([id][prop]) === false){
       collection[id][prop] = [];

    }

    collection[id][prop].push(value);
  }

  if(value === ""){
    delete collection[id][prop];
  }

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

  //if(collection.hasOwnProperty(prop))


  return collection;
}
Luis Carlos Garcia Barajas
@Luiko
Jul 06 2016 04:28
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:28
@bekir0v then assign lookup[val] to return
Hassaan Hafeez
@HassHz
Jul 06 2016 04:29
@ravenstudios
if(collection.hasOwnProperty([id][prop]) === false)
First of all collection won't have an [id][prop] property, it only has an [id] property, so do:
if(collection[id].hasOwnProperty(prop) === false)
Notice brackets
Rob
@ravenstudios
Jul 06 2016 04:31
@HassHz thats it, thanks
CamperBot
@camperbot
Jul 06 2016 04:31
ravenstudios sends brownie points to @hasshz :sparkles: :thumbsup: :sparkles:
:cookie: 527 | @hasshz |http://www.freecodecamp.com/hasshz
Stefan Bekirov
@bekir0v
Jul 06 2016 04:32
@abhishekdevinfo Thank you
CamperBot
@camperbot
Jul 06 2016 04:32
bekir0v sends brownie points to @abhishekdevinfo :sparkles: :thumbsup: :sparkles:
:cookie: 255 | @abhishekdevinfo |http://www.freecodecamp.com/abhishekdevinfo
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:32
@emelinpg whats your challenge name FCC
@bekir0v anytime
Emelin GUtierrez
@emelinpg
Jul 06 2016 04:33
@abhishekdevinfo Storing Values with the Assignment Operator
Hassaan Hafeez
@HassHz
Jul 06 2016 04:33
@emelinpg var x = 1;
= is the assignment operator
In this example we are storing the value 1 into the variable x
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:34
@emelinpg ok so whats the prob
Hassaan Hafeez
@HassHz
Jul 06 2016 04:34
So assign 7 to a first of all (don't use the var keyword, the variable is already defined for you above, just update it to the value of 7)
huynhmatt
@huynhmatt
Jul 06 2016 04:34
anyone know how to make text appear on one line on a page? when i split the text at the space, it looks like a long run-on sentence with commas after each word that can scroll left and right. i want to get rid of the commas but keep the text on one page. when i join at the commas, it makes the text resizable based on the window
not really sure how to explain it
Emelin GUtierrez
@emelinpg
Jul 06 2016 04:35
@HassHz so would it would it be var a=7;? for the first part?
Damnme
@Damnme
Jul 06 2016 04:36
how do I make factorialize(0) return 1?
Hassaan Hafeez
@HassHz
Jul 06 2016 04:36
@emelinpg I said not to use the var keyword, they already defined the variable above var a; at this point you only need to update a to 7, a = 7
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:37
it works but var a; this means we declare a variable
and var a = 7; means we defined and assigned valued in it
Hassaan Hafeez
@HassHz
Jul 06 2016 04:37
@Damnme Depends which way are yo doing it? Recursion or for loop?
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:37
@emelinpg it works but var a; this means we declare a variable
and var a = 7; means we defined and assigned valued in it
Damnme
@Damnme
Jul 06 2016 04:40
@HassHz for
Tarun sehgal
@FCCtarun
Jul 06 2016 04:40

Accessing Objects Properties with Variables

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

// Only change code below this line;

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

How can I lookup player 16 by using var playerNumber?

Emelin GUtierrez
@emelinpg
Jul 06 2016 04:40
@HassHz @abhishekdevinfo oooh okay! got it!!! thank you guys i was very confused! lol
CamperBot
@camperbot
Jul 06 2016 04:40
emelinpg sends brownie points to @hasshz and @abhishekdevinfo :sparkles: :thumbsup: :sparkles:
:cookie: 528 | @hasshz |http://www.freecodecamp.com/hasshz
:cookie: 256 | @abhishekdevinfo |http://www.freecodecamp.com/abhishekdevinfo
Hassaan Hafeez
@HassHz
Jul 06 2016 04:40
@Damnme Mind posting your code?
@FCCtarun Just assign 16 to playerNumber, and use it inside the brackets instead :P
Damnme
@Damnme
Jul 06 2016 04:40
function factorialize(num) {
for (var i = num - 1; i > 0; i--) {
num*=i;
// more statements
}
return num;
}
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:40
@emelinpg so in challenge the code is var a; var b = 2;
and then u have to assign the value to variable like a = 5;
when u already declarer variable like var = a; then there is no need to use var again
Hassaan Hafeez
@HassHz
Jul 06 2016 04:41
@Damnme Never seen it done that way before :shipit: Let me see
Damnme
@Damnme
Jul 06 2016 04:41
@HassHz what is the usual way?
Hassaan Hafeez
@HassHz
Jul 06 2016 04:42
@Damnme Recursion or a for loop that iterates num amount of times
Damnme
@Damnme
Jul 06 2016 04:42
@HassHz it just do it backwards
does
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:42
need help in javascript code
Hassaan Hafeez
@HassHz
Jul 06 2016 04:42
@Damnme Your code won't run for factorialize(0) or (1) because var i = num - 1 will make i either -1 or 0,
so your for loop wouldn't even run
You could make special cases for those maybe above the for loop? See if that works, or if you want to see the usual ways I could show you that
@abhishekdevinfo What type?
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:44
How i can take only alphanumeric characters in this string 2_A3*3#A2
96street
@96street
Jul 06 2016 04:44
Hey guys something weird happening on my twitch viewer, the last <li> in <ul> never has <span> appended to it http://codepen.io/kingdezz/full/zBzBaZ/
Hassaan Hafeez
@HassHz
Jul 06 2016 04:44
@abhishekdevinfo there is regexp:
/[a-zA-Z0-9]/ can I see the context in which you're trying to use it?
Damnme
@Damnme
Jul 06 2016 04:44
@HassHz factorialize(1) returns 1
ok show the common way
me
Hassaan Hafeez
@HassHz
Jul 06 2016 04:45
Maybe add an if statement for if (num === 0 ) return 1?
Alright
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:45
@HassHz i am stuck in Check for Palindromes
Hassaan Hafeez
@HassHz
Jul 06 2016 04:46
//recursion:
function factorialize(num){
    if(num <= 1){
        return 1;
    } else {
        return num * factorialize(num - 1);
    }
Damnme
@Damnme
Jul 06 2016 04:47
@HassHz and with a for loop?
Hassaan Hafeez
@HassHz
Jul 06 2016 04:48
//for loop:
function factorialize(num){
    var ans = 1;
    for(var i = 1, i <= num; i++){
        ans *= i;
    }
    return ans
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:48
@HassHz when i use regexp then it only give me the first alphanumeric character
but i want all
Hassaan Hafeez
@HassHz
Jul 06 2016 04:48
@abhishekdevinfo
replace(/[^a-z0-9]/gi, '')
Will remove anything that isn't alphanumeric from your string
if you use the /g it will check the entire string I believe and not just the first match.
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:50
@HassHz ok thanks for the help
CamperBot
@camperbot
Jul 06 2016 04:50
abhishekdevinfo sends brownie points to @hasshz :sparkles: :thumbsup: :sparkles:
:cookie: 529 | @hasshz |http://www.freecodecamp.com/hasshz
Hassaan Hafeez
@HassHz
Jul 06 2016 04:50
and the i ignores case, so you don't have to worry about doing a-zA-Z
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:51
@HassHz ok
Hassaan Hafeez
@HassHz
Jul 06 2016 04:52
@Damnme If you want to do it your method:
function factorialize(num) {
  if(num === 0){
    return 1;
  }
  for (var i = num - 1; i > 0; i--) {
    num*=i;
  }
  return num;
}

factorialize(1);
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 04:53
@HassHz its working really appreciate
kuldeep
@gurukd
Jul 06 2016 04:53
@96street why don't you put console.log(span); to know which object is not showing. I think OgamingSC2 is not present.
Joe Carmona
@jcarmona1978
Jul 06 2016 04:59

Hey guys I am having trouble with the "double quotes" string with removal of . I got rid of the \ and put in the single quotes twice as specified and even removed spaces


var myStr ='<ahref="http:www.example.com"target="_blank">Link</a>';

but I get a message i still need to get rid of the \, I am at a loss here.

96street
@96street
Jul 06 2016 04:59
just did, it's got the span class but it's not showing @gurukd
and it's always the last one, regardless if they're online or not
Stefan Bekirov
@bekir0v
Jul 06 2016 05:06
I need a help about this function
I'm not sure how I should do it
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  var checkProp = myObj;
checkProp.hasOwnProperty('myObj');
  return "Change Me!";
}

// Test your code by modifying these values
checkObj("gift");
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:10
@bekir0v what is your challenge name
Stefan Bekirov
@bekir0v
Jul 06 2016 05:11
@abhishekdevinfo checkProp
Ken Nawrocki
@nawrockp
Jul 06 2016 05:11
@bekir0v shouldnilt it bve var myObj=checkProp?
0
Oh wait just saw the rest of the code...
Yeah. You are overwriting checkProp
Stefan Bekirov
@bekir0v
Jul 06 2016 05:14
@nawrockp
I don't know how to start
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:14
@bekir0v u should apply if statement
Ken Nawrocki
@nawrockp
Jul 06 2016 05:14
Yup
Stefan Bekirov
@bekir0v
Jul 06 2016 05:15
if else you mean
Mike Haslam
@Ongomobile
Jul 06 2016 05:15
@GregatGit Ok I must be hard headed just can't get myTotal function to work? http://codepen.io/Ongomobile/pen/LkLaqP?editors=1010
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:15
@abhishekdevinfo in if u check by hasOwnPro
@bekir0v myobj is a object so
myObj.hasOwnProperty(checkProp) then in () u have to write the name of property which u want to chaeck
Ken Nawrocki
@nawrockp
Jul 06 2016 05:16
@bekir0v yes as abhishek says
kuldeep
@gurukd
Jul 06 2016 05:17
@96street I found below object which is not offline or online.
Object {
error: "Unprocessable Entity",
message: "Channel 'comster404' is unavailable",
status: 422
}
Ken Nawrocki
@nawrockp
Jul 06 2016 05:17
I just dont see what this is forvar checkProp = myObj;
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:18
This message was deleted
Stefan Bekirov
@bekir0v
Jul 06 2016 05:18
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
myObj.hasOwnProperty(checkProp);


  return "Change Me!";
}

// Test your code by modifying these values
checkObj("gift");
I did this still nothing
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:18
@bekir0v apply the if
Ken Nawrocki
@nawrockp
Jul 06 2016 05:19
Because it does not have the gift property
Stefan Bekirov
@bekir0v
Jul 06 2016 05:19
where to apply if
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:19
@abhishekdevinfo u first check the condition whether the property is available or not
@bekir0v in the starting of function
@bekir0v myObj.hasOwnProperty(checkProp); this line should be the condition of if
Stefan Bekirov
@bekir0v
Jul 06 2016 05:21
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  if(myObj.hasOwnProperty(checkProp);){

  }



  return "Change Me!";
}

// Test your code by modifying these values
checkObj("gift");
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:21
@bekir0v if (myObj.hasOwnProperty(checkProp)) {
no need for ;
in if statement return the property value by return object[value]; @bekir0v
Nick Neuman
@neecholaus
Jul 06 2016 05:23

quick question. my code is returning the correct data that the requirements says it should, but it is not letting me pass.

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 gear = 0;
  this.setGear = function(change) {
    gear += change;
  };
  this.getGear = function() {
    return gear;
  };

};

any ideas as to what im doing wrong? this is for the Make Object Properties Private exercise.

Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:23
and in the else statement return "Not Found"; @bekir0v
96street
@96street
Jul 06 2016 05:24
@gurukd i'll try make an else if
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:24
This message was deleted
Stefan Bekirov
@bekir0v
Jul 06 2016 05:25
@abhishekdevinfo
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  if(myObj.hasOwnProperty(checkProp)){
    return object[value];

  }
  else{
    return "Not Found";
  }



  return "Change Me!";
}

// Test your code by modifying these values
checkObj("gift");
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:25
@bekir0v object is myObj and value is checkProp
@bekir0v and remove this line return "Change Me!";
Stefan Bekirov
@bekir0v
Jul 06 2016 05:27
@abhishekdevinfo Thank you Sir
CamperBot
@camperbot
Jul 06 2016 05:27
bekir0v sends brownie points to @abhishekdevinfo :sparkles: :thumbsup: :sparkles:
:warning: bekir0v already gave abhishekdevinfo points
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:28
@bekir0v i am not sir i am like u just say bro
and anytime
Stefan Bekirov
@bekir0v
Jul 06 2016 05:28
ok Bro
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:29
@bekir0v if u have time then read these books
kuldeep
@gurukd
Jul 06 2016 05:29

@96street OK i Got it.

var names = $('ul').append("<li><a href='" + link + "'" + " class='" + status + "'>" + channel + "</a><span" + " class='" + span + "'>"+ status +"</span></li>");

U didn't provide the status in span tag
<span" + " class='" + span + "'>"+ status +"</span>

Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:29
best book for beginner
achi-lles
@achi-lles
Jul 06 2016 05:29

"Firstline\n\SecondLine\\rThirdLine";

this is showing as incorrect myStr should have encoded text with the proper escape sequences and no spacing.
What mistake am I making

Stefan Bekirov
@bekir0v
Jul 06 2016 05:30
ok I will check them thanks
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 05:31
ok
achi-lles
@achi-lles
Jul 06 2016 05:32

"Firstline\n\SecondLine\\rThirdLine";

this is showing as incorrect myStr should have encoded text with the proper escape sequences and no spacing.
What mistake am I making

Anybody?
kuldeep
@gurukd
Jul 06 2016 05:33
@96street i don't know why
$('.spanOn').html('Online');
$('.spanOff').html('Offline'); this not working for you.
@96street it would be best if you just clear it and put the status in span tag that will do the work.
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 06 2016 05:35
@achi-lles I think it should be "Firstline\nSecondLine\nThirdLine"
Nick Neuman
@neecholaus
Jul 06 2016 05:36
can anyone tell me why this isnt working for the make object properties private exercise?
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 gear = 0;
  this.setGear = function(change) {
    gear += change;
  };
  this.getGear = function() {
    return gear;
  };

};
Coy Sanders
@coymeetsworld
Jul 06 2016 05:37
@neecholaus your object has private variables, but something wrong with your setGear function
NixonRichard
@NixonRichard
Jul 06 2016 05:37
function destroyer(arr) {
  // Remove all the values
  var newArr = [];
  for (var i = 1;i<arguments.length;i++){
    newArr.push(arr[i]);
  }
  arr.filter(function(abc){
    return arr.indexOf(newArr) == -1;
  });
  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
fix my code plz thx
Markus Kiili
@Masd925
Jul 06 2016 05:38
@NixonRichard You are looping arguments indices but pushing arr elements.
omega-lova
@omega-lova
Jul 06 2016 05:38

need help on Check for Palindromes challenge, my code below doesn't pass. Could anyone please explain why?

function palindrome(str) {

var trueDrome = str.replace(/[\W_]/g, '').toLowerCase().split("").reverse().join("");
  if (str === trueDrome){
    return true;
  } else {
    return false;
  }
}

palindrome("eye");

https://www.freecodecamp.com/challenges/check-for-palindromes

achi-lles
@achi-lles
Jul 06 2016 05:38
blob
blob
Nick Neuman
@neecholaus
Jul 06 2016 05:39
@coymeetsworld okay so how do i make the gear a private property?
Coy Sanders
@coymeetsworld
Jul 06 2016 05:39
it is private @neecholaus, that's not the problem
Markus Kiili
@Masd925
Jul 06 2016 05:39
@NixonRichard abc is the arr element being iterated. Check if it is found on the array of arguments.
DJ
@qualitymanifest
Jul 06 2016 05:39
@omega-lova because you're never actually changing str... trueDrome is str cleansed of non-alphanumerics, reversed... but then you're comparing it to str which still has all the non-alphanumerics left in
Markus Kiili
@Masd925
Jul 06 2016 05:40
@NixonRichard Use return arr.filter(...);
Ian Arsenault
@ianarsenault
Jul 06 2016 05:40
Hoping someone could help me out with some insight as to the Mutations problem. I'm getting all the trues right, but none of the false ones. I'm kind of lost, and I'm unsure if the ones I'm getting right are just luck somehow, or if I'm actually on the right track.

function mutation(arr) {
  /* Set each index to lower case */
  var a = arr[0].toLowerCase(); // hello
  var b = arr[1].toLowerCase(); // hey

  if (b.indexOf(a) > -1 || b.indexOf(a) == -1 ) {
    return true;
  }
   else if (!b.indexOf(a)) {
     return false;
   }
}
// Not getting false for these 3
mutation(["hello", "hey"]);
//mutation(["hello", "neo"]);
//mutation(["voodoo", "no"]);


/* Getting True here  */
//mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]);
//mutation(["floor", "for"]);
//mutation(["hello", "Hello"]);
Markus Kiili
@Masd925
Jul 06 2016 05:41
@GorgonsMaze You need to loop or iterate the second string characters.
Ian Arsenault
@ianarsenault
Jul 06 2016 05:41
blob
@Masd925 Ok I was trying that earlier, but getting hte same result.
I'll try again, and post my code if I can't figure it out with the loop
omega-lova
@omega-lova
Jul 06 2016 05:42
@qualitymanifest I changed the line to
if (str.replace(/[\W_]/g, '').toLowerCase() === trueDrome)
Ian Arsenault
@ianarsenault
Jul 06 2016 05:42
But, there is no way to do that without looping?
omega-lova
@omega-lova
Jul 06 2016 05:42
@qualitymanifest and it works, thanks so much!
CamperBot
@camperbot
Jul 06 2016 05:42
omega-lova sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star2: 1255 | @qualitymanifest |http://www.freecodecamp.com/qualitymanifest
Nick Neuman
@neecholaus
Jul 06 2016 05:42
@coymeetsworld what is wrong with the setGear function? cuz when i run the program it returns the correct data that the requirements say but its not letting me pass.
achi-lles
@achi-lles
Jul 06 2016 05:43
blob
DJ
@qualitymanifest
Jul 06 2016 05:43
@omega-lova :+1:
Coy Sanders
@coymeetsworld
Jul 06 2016 05:43
setGear doesn't increment the gear like it does with the Car accelerate function, it as the name says, "sets" it to a new value
NixonRichard
@NixonRichard
Jul 06 2016 05:43
function destroyer(arr) {
  // Remove all the values
  var newArr = [];
  for (var i = 1;i<arguments.length;i++){
    newArr.push(arguments[i]);
  }
  return (
  arr.filter(function(abc){
    return arr.indexOf(newArr) == -1;
  }));

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Coy Sanders
@coymeetsworld
Jul 06 2016 05:43
@neecholaus
NixonRichard
@NixonRichard
Jul 06 2016 05:43
still not work
Mike Haslam
@Ongomobile
Jul 06 2016 05:44
Hello Campers! Ok I must be hard headed just can't get myTotal function to work? http://codepen.io/Ongomobile/pen/LkLaqP?editors=1010
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 06 2016 05:44
@achi-lles Idk why but I've just backed to that challenge and escape character did not work too
blob
Nick Neuman
@neecholaus
Jul 06 2016 05:44
@coymeetsworld oh okay. that makes sense. thanks
CamperBot
@camperbot
Jul 06 2016 05:44
neecholaus sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1242 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jul 06 2016 05:44
no problem
NixonRichard
@NixonRichard
Jul 06 2016 05:45
Alo Viet Nam diem danh !
achi-lles
@achi-lles
Jul 06 2016 05:45
@Huy-Ngo LOL
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 06 2016 05:45
although I completed that challenge
with that code
NixonRichard
@NixonRichard
Jul 06 2016 05:46
nguoi Viet kia
96street
@96street
Jul 06 2016 05:47
just did that still not working http://codepen.io/kingdezz/pen/zBzBaZ?editors=0010 @gurukd
NixonRichard
@NixonRichard
Jul 06 2016 05:48
function destroyer(arr) {
  // Remove all the values
  var newArr = [];
  for (var i = 1;i<arguments.length;i++){
    newArr.push(arguments[i]);
  }
  return (
  arr.filter(function(abc){
    return arr.indexOf(newArr) == -1;
  }));

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
achi-lles
@achi-lles
Jul 06 2016 05:48
blob
NixonRichard
@NixonRichard
Jul 06 2016 05:48
fix my code plz
achi-lles
@achi-lles
Jul 06 2016 05:48
@coymeetsworld help me with this
NixonRichard
@NixonRichard
Jul 06 2016 05:48
Viet nam diem danh
@Masd925 i did what u told me to do
kuldeep
@gurukd
Jul 06 2016 05:49
@96street just do this
var names = $('ul').append("<li><a href='" + link + "'" + " class='" + status + "'>" + channel + "</a><span" + " class='" + span + "'>"+status+"</span></li>");
in place of previous one.
@96street clear it out this one
$('.spanOn').html('Online');
$('.spanOff').html('Offline');
don't need it anymore
Markus Kiili
@Masd925
Jul 06 2016 05:51
@NixonRichard You need to check if the element being iterated is not found on argument array. (return true from the callback if it is not found).
juanxcerv
@juanxcerv
Jul 06 2016 05:51
@achi-lles I'm on the same boat as you, I have
@achi-lles var myStr = "FirstLine \n \SecondLine\ \r ThirdLine";
achi-lles
@achi-lles
Jul 06 2016 05:52
@juanxcerv you got it right?
juanxcerv
@juanxcerv
Jul 06 2016 05:53
@achi-lles Nope, what i sent you isnt working
achi-lles
@achi-lles
Jul 06 2016 05:53
@juanxcerv that is because \ needs escaped too
@juanxcerv I don't know what mistake I am making
Kevin
@KevinBruland
Jul 06 2016 05:55
@achi-lles what are you stuck on?
Coy Sanders
@coymeetsworld
Jul 06 2016 05:55
@achi-lles @juanxcerv you need to look at the table to put the appropriate escape sequences in the string
you are basically replacing the names of those escape sequences with the actual escape sequence
don't add anything else
so for example instead of putting newline in the String, you would put the esc sequence shown on the table, i.e. \n
achi-lles
@achi-lles
Jul 06 2016 05:57
@coymeetsworld I am not adding anything else
96street
@96street
Jul 06 2016 05:57
thankyou! @gurukd
CamperBot
@camperbot
Jul 06 2016 05:57
:cookie: 273 | @gurukd |http://www.freecodecamp.com/gurukd
96street sends brownie points to @gurukd :sparkles: :thumbsup: :sparkles:
achi-lles
@achi-lles
Jul 06 2016 05:57
blob
juanxcerv
@juanxcerv
Jul 06 2016 05:58
And I literally have the same thing he has lol
kuldeep
@gurukd
Jul 06 2016 05:58
@96street Looks great:)
Coy Sanders
@coymeetsworld
Jul 06 2016 05:59
try refreshing your browser @achi-lles
think it looks ok
NixonRichard
@NixonRichard
Jul 06 2016 05:59
function destroyer(arr) {
  // Remove all the values
  var newArr = [];
  for (var i = 1;i<arguments.length;i++){
    newArr.push(arguments[i]);
  }
  return (
  arr.filter(function(abc){
    return abc.indexOf(newArr) == -1;
  }));

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
this doesnt work eother
achi-lles
@achi-lles
Jul 06 2016 05:59
@coymeetsworld nope still giving me error buddy
juanxcerv
@juanxcerv
Jul 06 2016 05:59
wow refreshing worked
Coy Sanders
@coymeetsworld
Jul 06 2016 06:00
can you give me the link to your code?
achi-lles
@achi-lles
Jul 06 2016 06:00
Sure
@juanxcerv what is your code exactly
Coy Sanders
@coymeetsworld
Jul 06 2016 06:01
Firstline
96street
@96street
Jul 06 2016 06:01
any idea how I can get the .Online <li>'s on top of the <ul>? @gurukd
juanxcerv
@juanxcerv
Jul 06 2016 06:01
@achi-lles var myStr = "FirstLine\n\SecondLine\\rThirdLine";
capitalize the L yeah
Bale
@zjy7
Jul 06 2016 06:02
// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
brandon1496
@brandon1496
Jul 06 2016 06:02
i need help with the "Escape Sequences in Strings" challenge plz
NixonRichard
@NixonRichard
Jul 06 2016 06:02
var myStr =  "FirstLine\n\\SecondLine\\\rThirdLine";
this worked for me
Coy Sanders
@coymeetsworld
Jul 06 2016 06:02
attention to detail very important :)
NixonRichard
@NixonRichard
Jul 06 2016 06:02
i just did it
brandon1496
@brandon1496
Jul 06 2016 06:02
thx
achi-lles
@achi-lles
Jul 06 2016 06:03
@coymeetsworld @juanxcerv I should remember that
@coymeetsworld @juanxcerv thanks
CamperBot
@camperbot
Jul 06 2016 06:03
achi-lles sends brownie points to @coymeetsworld and @juanxcerv :sparkles: :thumbsup: :sparkles:
:cookie: 145 | @juanxcerv |http://www.freecodecamp.com/juanxcerv
:star2: 1243 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jul 06 2016 06:03
np @achi-lles
NixonRichard
@NixonRichard
Jul 06 2016 06:04
```js
var myStr =  "FirstLine\n\\SecondLine\\\rThirdLine";
```
this code worked
function destroyer(arr) {
  // Remove all the values
  var newArr = [];
  for (var i = 1;i<arguments.length;i++){
    newArr.push(arguments[i]);
  }
  return (
  arr.filter(function(abc){
    return abc.indexOf(newArr) == -1;
  }));

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
but this s not
fix it plz somebody
thx alot
Bale
@zjy7
Jul 06 2016 06:05
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

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

// Test your code by modifying these values
checkObj("gift");
why can't return property's value?
Justice K. Dube
@kazd
Jul 06 2016 06:07
help with this problem: Accessing Nested Objects
CamperBot
@camperbot
Jul 06 2016 06:07
no wiki entry for: with this problem accessing nested objects
Markus Kiili
@Masd925
Jul 06 2016 06:07
@NixonRichard You need to use indexOf on the array of arguments. Now you are looking if an array is found on a number.
Ken Nawrocki
@nawrockp
Jul 06 2016 06:08
@bale77 that looks like it should work
Kevin
@KevinBruland
Jul 06 2016 06:08
@bale77 switch the . with bracket notation
@bale77 so return myObj[checkProp]
kuldeep
@gurukd
Jul 06 2016 06:09
This message was deleted
Ken Nawrocki
@nawrockp
Jul 06 2016 06:09
@Benalron good catch
Bale
@zjy7
Jul 06 2016 06:10
thx. It worked. @Benalron @nawrockp
CamperBot
@camperbot
Jul 06 2016 06:10
bale77 sends brownie points to @benalron and @nawrockp :sparkles: :thumbsup: :sparkles:
:cookie: 336 | @nawrockp |http://www.freecodecamp.com/nawrockp
:cookie: 346 | @benalron |http://www.freecodecamp.com/benalron
Jack
@jh0l
Jul 06 2016 06:14
help manipulating-complex-objects
CamperBot
@camperbot
Jul 06 2016 06:14
no wiki entry for: manipulating-complex-objects
Jack
@jh0l
Jul 06 2016 06:15
@kazd hey what's up! I might be able to help you :)
help complex objects
CamperBot
@camperbot
Jul 06 2016 06:15
no wiki entry for: complex objects
Jack
@jh0l
Jul 06 2016 06:16
help objects
CamperBot
@camperbot
Jul 06 2016 06:16

:point_right: challenge accessing nested objects in json [wiki]

Challenge Accessing Nested Objects in JSON

The properties and sub-properties of JSON objects can be accessed by chaining together the dot or bracket notation.

Here is a nested JSON Object:

```javascript
var ourStorage = {
"desk": {
"drawer": "stapler"
},
"cabinet": {
"top drawer": {
"folder1": "a file",
"folder2": "secrets"
},
"bottom drawer": "soda"
}
}
ourStorage.cabinet["top drawer"].folder2; // "secrets"
:pencil: read more about challenge accessing nested objects in json on the FCC Wiki

Jack
@jh0l
Jul 06 2016 06:16
help manipulating
CamperBot
@camperbot
Jul 06 2016 06:16
no wiki entry for: manipulating
Jack
@jh0l
Jul 06 2016 06:16
help complex
CamperBot
@camperbot
Jul 06 2016 06:16

:point_right: python complex numbers [wiki]

Python Complex Numbers

Complex numbers have a real and an imaginary part, each represented by a floating point number.

The imaginary part of a complex number can be created using an imaginary literal, this results in a complex number with a real part of 0.0:

>>> a = 3.5j
>>> type(a)
<class 'complex'>
>>> print(a)
3.5j
>>> a.real
0.0
>>> a.imag
3.5

:pencil: read more about python complex numbers on the FCC Wiki

Ken Nawrocki
@nawrockp
Jul 06 2016 06:17
Ï
Jack
@jh0l
Jul 06 2016 06:17
ù
hey can I get a hand with this challange https://www.freecodecamp.com/challenges/manipulating-complex-objects#?solution=%0Avar%20myMusic%20%3D%20%5B%0A%20%20%7B%0A%20%20%20%20%22artist%22%3A%20%22Billy%20Joel%22%2C%0A%20%20%20%20%22title%22%3A%20%22Piano%20Man%22%2C%0A%20%20%20%20%22release_year%22%3A%201973%2C%0A%20%20%20%20%22formats%22%3A%20%5B%20%0A%20%20%20%20%20%20%22CS%22%2C%20%0A%20%20%20%20%20%20%228T%22%2C%20%0A%20%20%20%20%20%20%22LP%22%20%5D%2C%0A%20%20%20%20%22gold%22%3A%20true%0A%20%20%7D%0A%20%20%2F%2F%20Add%20record%20here%0A%5D%3B%20%0A%0A
what do
Damnme
@Damnme
Jul 06 2016 06:21
how do i use str.replace() with several strings to replace
NixonRichard
@NixonRichard
Jul 06 2016 06:24
function destroyer(arr) {
  // Remove all the values
  var newArr = [];
  for (var i = 1;i<arguments.length;i++){
    newArr.push(arguments[i]);
  }

 return  ( arr.filter(function(abc){
    return newArr.indexOf(abc) == -1;
  }));

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
i did it lol
@Damnme what do u meanm several strings ?
Brooke Ann S.
@tinyinkling
Jul 06 2016 06:30
var string = "Split me into an array";
var array = [];

// Only change code below this line.

array = string.split('');
how come this isn't working?
Indhu
@Indhusethu
Jul 06 2016 06:30
can anybody help me in doing accessing nested objects??
Coy Sanders
@coymeetsworld
Jul 06 2016 06:31
looks fine to me @tinyinkling
if you're trying to split it character by character
Brooke Ann S.
@tinyinkling
Jul 06 2016 06:32
I think it wants me to split it by spaces
Coy Sanders
@coymeetsworld
Jul 06 2016 06:32
then you need to put a space inside your split
Brooke Ann S.
@tinyinkling
Jul 06 2016 06:33
ah! OMG. (DUH)
Indhu
@Indhusethu
Jul 06 2016 06:33

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

myStorage.outside["trunk"];
myStorage.car.inside;/ Only change code below this line

var gloveBoxContents = ""; // Change this line

Brooke Ann S.
@tinyinkling
Jul 06 2016 06:33
facepalm
Coy Sanders
@coymeetsworld
Jul 06 2016 06:33
:)
Brooke Ann S.
@tinyinkling
Jul 06 2016 06:33
thanks @coymeetsworld !!!!
CamperBot
@camperbot
Jul 06 2016 06:33
tinyinkling sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1244 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Jul 06 2016 06:33
no problem @tinyinkling
Brooke Ann S.
@tinyinkling
Jul 06 2016 06:34
its always the easier and most obvious solution that I keep missing!
Indhu
@Indhusethu
Jul 06 2016 06:34
can anybody resolve my code?
Coy Sanders
@coymeetsworld
Jul 06 2016 06:34
you need to set gloveBoxContents @Indhusethu
myStorage.car.inside;/ Only change code below this line this part isn't finished yet either, when you finish this you need to set it to the gloveBoxContents variable
Indhu
@Indhusethu
Jul 06 2016 06:36
ok @coymeetsworld
Ian Arsenault
@ianarsenault
Jul 06 2016 06:39

I'm stuck on the Mutations problem

function mutation(arr) {
  /* Set each index to lower case */
  var a = arr[0].toLowerCase().split(""); // 'h' 'e' 'l' 'l' 'o'
  var b = arr[1].toLowerCase().split(""); // 'h' 'e' 'y'

  for (var i =0; i < b.length; i++) {
    /* I'm lost here */
    if (b[i].indexOf(a)) {
      return true;
    }
    else {
      return false;
    }
  }

}

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

Can anyone point me in the right direction. Everytime I get some of them to work it makes no sense to me. My problem is iterating through , and or checking each index against the first array

NixonRichard
@NixonRichard
Jul 06 2016 06:43
u dotn hav eto split
Markus Kiili
@Masd925
Jul 06 2016 06:43
@GorgonsMaze You don't need arrays here because you can loop characters and indexOf works on strings. You need to check is the looped character is not found and return false. After loop return true. Basic loop logic for testing if many things are true.
NixonRichard
@NixonRichard
Jul 06 2016 06:43
dont have to split
Ian Arsenault
@ianarsenault
Jul 06 2016 06:43
@NixonRichard Yeah I know you dont have to, I was trying other ways , to see if I could figure it out.
achi-lles
@achi-lles
Jul 06 2016 06:44
Could someone please explain what Word Blanks question exactly mean?
NixonRichard
@NixonRichard
Jul 06 2016 06:46
u have to plus each of them together
myNoun + myAdjective + ...
as myNoun stands for dog etc
Ian Arsenault
@ianarsenault
Jul 06 2016 06:51
This message was deleted
peibowl
@peibowl
Jul 06 2016 06:53
Hello people!!
Indhu
@Indhusethu
Jul 06 2016 06:53

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

myStorage.car["inside"].glove box;

var gloveBoxContents = ""; // Change this line

peibowl
@peibowl
Jul 06 2016 06:53
How can i remove non-alphnumeric from a string? I've tried this:
Indhu
@Indhusethu
Jul 06 2016 06:53
where did i go wrong??
peibowl
@peibowl
Jul 06 2016 06:53
var cleanStr = str.replace(/[^A-Za-z0-9]/g,"");
but it still does not remove the _
any idea? I'read that this way should be enough... but it isn't
omega-lova
@omega-lova
Jul 06 2016 06:56
@peibowl try
str.replace(/[\W_]/g, '');
achi-lles
@achi-lles
Jul 06 2016 06:56
@NixonRichard thanks
CamperBot
@camperbot
Jul 06 2016 06:56
achi-lles sends brownie points to @nixonrichard :sparkles: :thumbsup: :sparkles:
:cookie: 39 | @nixonrichard |http://www.freecodecamp.com/nixonrichard
peibowl
@peibowl
Jul 06 2016 06:57
@omega-lova Nope, it still fails with palindrome("_eye")
:s
NixonRichard
@NixonRichard
Jul 06 2016 06:57
My pleasure ( = @achi-lles
peibowl
@peibowl
Jul 06 2016 06:58
@Indhusethu try using indexes like myStorage.car[A][B]...
Sujal
@Sujal3757
Jul 06 2016 06:59

can anybody help me out in this part:-```js
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 gear="";
this.getGear=function(change)
{
gear+=change;
};
this.setGear=function()
{
gear-=5;
};

};

var myCar = new Car();

var myBike = new Bike();
```
errors:-
myBike.getGear() should return 4 after calling myBike.setGear(4).
myBike.getGear() should return 3 after calling myBike.setGear(3).
myBike.getGear() should return 1 after calling myBike.setGear(1).

Emanuel Quimper
@EQuimper
Jul 06 2016 06:59
hey guys why here in Seek and Destroy that not work. Look like my second for loop stay at the first index
function destroyer(arr) {
  var check = [];

  for (var i = 1; i < arguments.length; i++) {
    check.push(arguments[i]);
  }

  var itemsNotDestroy = arguments[0].filter(function(item) {
    for (var i = 0; i < check.length; i++) {
      return item !== check[i];
    }
  });

  return itemsNotDestroy;

}

destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3);
omega-lova
@omega-lova
Jul 06 2016 06:59
@peibowl can I see your code? I just recently passed the palindrome with a bit of extra help too
peibowl
@peibowl
Jul 06 2016 07:00
ok here u have, I have reused the string inverting function that worked previously
js

function palindrome(str) {
  var cleanStr = str.replace(/[\W_]/g,"");
  cleanStr = cleanStr.toLowerCase();
  if (str == reverseString(cleanStr)){
    return true;
  }
  else {
    return false;
  }
}

function reverseString(str) {
  splitStr = str.split("");
  auxStr = [];
  for(var i = 0; i < splitStr.length; i++){
    auxStr.unshift(splitStr[i]);
  }
  str = auxStr.join("");
  return str;
}

palindrome("eye");
Markus Kiili
@Masd925
Jul 06 2016 07:00
@EQuimper Because you return on the first iteration i=0.
Sujal
@Sujal3757
Jul 06 2016 07:01
This message was deleted

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 gear="";
  this.getGear=function(change)
  {
    gear+=change;
  };
  this.setGear=function()
  {
    gear-=5;
  };

};

var myCar = new Car();

var myBike = new Bike();
errors:-
myBike.getGear() should return 4 after calling myBike.setGear(4).
myBike.getGear() should return 3 after calling myBike.setGear(3).
myBike.getGear() should return 1 after calling myBike.setGear(1).
Emanuel Quimper
@EQuimper
Jul 06 2016 07:02
@Masd925 Ok yes but I dont understand what you try to say this is a regular for loop no ?
check is my array of element I want to remove
so I can loop this one no
Markus Kiili
@Masd925
Jul 06 2016 07:02
@EQuimper Returning ends the function execution and thus the loop ends too. You return on i=0 so the loop never goes beyond that.
Emanuel Quimper
@EQuimper
Jul 06 2016 07:09
@Masd925 I try this not working
function destroyer(arr) {
  var check = [];

  for (var i = 1; i < arguments.length; i++) {
    check.push(arguments[i]);
  }

  var itemsNotDestroy = arguments[0].filter(function(item) {
    var newArr = [];
    for (var i = 0; i < check.length; i++) {
      if (item !== check[i]) {
        newArr.push(item);
      }
    }

    return newArr;
  });

  return itemsNotDestroy;

}

destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3);
Markus Kiili
@Masd925
Jul 06 2016 07:10
@EQuimper The callback function should return true for those arr elements item that you like filter to put to the returned array.
Vladislav Mamenko
@ktototamovich
Jul 06 2016 07:12

Can someone help me with this challenge? I can't perform first condition https://www.freecodecamp.com/challenges/record-collection
Here's my code:

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

// Only change code below this line
function updateRecords(id, prop, value) {

if (value === "") {
delete collection[id][prop];
}

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

return collection;
}

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

```

Ian Arsenault
@ianarsenault
Jul 06 2016 07:12
I don't know what it is, but this one I just can't wrap my head around.
function mutation(arr) {
  var a = arr[0].toLowerCase(); // hello
  var b = arr[1].toLowerCase(); // neo

  for (var i =0; i < b.length; i++) {
    if (b.indexOf(a) >= 0) {
      return true;
    }

    return false;

  }

}

mutation(["hello", "neo"]);
blob
Bogdan
@Bogdan032
Jul 06 2016 07:13
Good morning guys! This is probably a stupid question but, does anyone know what incrementing a number in JS means
Markus Kiili
@Masd925
Jul 06 2016 07:13
@Bogdan032 i=i+1 for example increments i.
omega-lova
@omega-lova
Jul 06 2016 07:13
This message was deleted
Bogdan
@Bogdan032
Jul 06 2016 07:14
Thanks, Markus :D I got a little stuck there for a while
shweta rajput
@ShwetaRajput
Jul 06 2016 07:14
@Masd925 ```
```

function getIndexToIns(arr, num) 
   {    var d;
       var c=arr.sort(function(a,b)
         {
           return d=a-b;
                  });
      for(var i=0;i<arr.length;i++)
      {
        if(arr[i]>num)
        {
         return arr.splice(arr[i-1],0,num);
           }
               }

          return arr.push();
           }





getIndexToIns([20,30,10,50,40], 35);
@Masd925
This message was deleted
omega-lova
@omega-lova
Jul 06 2016 07:18

@peibowl

  • to make it shorter, try putting codes all in function palindrome, no need to use the second function or for loop
  • when you declare var cleanStr, you can use replace method, then toLowerCase, split, reverse and join on the same line using the dot like

    var cleanStr = str.replace(/[\W_]/g, '').toLowerCase().split("").reverse().join("");

  • keep the if-else statement, when you make 'if' condition, make sure that cleanStr strictly equals to the string that has no non-alphanumerics and is all in lowercase that is

    str.replace(/[\W_]/g, '').toLowerCase()

shweta rajput
@ShwetaRajput
Jul 06 2016 07:19
@Masd925 please help
peibowl
@peibowl
Jul 06 2016 07:20
@omega-lova is there a string.reverse() ???
Emanuel Quimper
@EQuimper
Jul 06 2016 07:20
@Masd925 I find it thank you I did this
function destroyer(arr) {
  var check = [];

  for (var i = 1; i < arguments.length; i++) {
    check.push(arguments[i]);
  }

  var itemsNotDestroy = arguments[0].filter(function(item) {
    var itemPass = true;
    for (var i = 0; i < check.length; i++) {
      if (item === check[i]) {
        itemPass = false;
      }
    }

    return itemPass;
  });

  return itemsNotDestroy;

}

destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3);
CamperBot
@camperbot
Jul 06 2016 07:20
equimper sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2056 | @masd925 |http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
Jul 06 2016 07:21
@EQuimper Nice. Using indexOf simplifies it somewhat:
omega-lova
@omega-lova
Jul 06 2016 07:21
@peibowl definitely need to use .reverse() looks like you haven't used that method
Markus Kiili
@Masd925
Jul 06 2016 07:21
function destroyer(arr) {
  var args = [];
  for (var i = 1; i < arguments.length; i++) args[i] = arguments[i];

  return arr.filter(function(val) {
    return args.indexOf(val)===-1;
  });
}
Or if you don't care about browser optimization issues, you can do magic like this:
peibowl
@peibowl
Jul 06 2016 07:22
@omega-lova nope, didnt know about it
Markus Kiili
@Masd925
Jul 06 2016 07:22
function destroyer(arr) {
  return arr.filter(function(val) {
    return Array.prototype.indexOf.call(this,val,1)===-1;
  },arguments);
}
shweta rajput
@ShwetaRajput
Jul 06 2016 07:24
@Masd925 ```
function getIndexToIns(arr, num) 
   {    var d;
       var c=arr.sort(function(a,b)
         {
           return d=a-b;
                  });
      for(var i=0;i<arr.length;i++)
      {
        if(arr[i]>num)
        {
         return arr.splice(i,0,num);
           }
               }

          return arr.push();
           }





getIndexToIns([20,30,10,50,40], 35);
Justice K. Dube
@kazd
Jul 06 2016 07:29
@Indhusethu , here is my solution;
var gloveBoxContents = myStorage.car.inside["glove box"];
Ian Arsenault
@ianarsenault
Jul 06 2016 07:30
Can someone explain if a.indexOf is checking each index of a to the current index of b due to the for loop
function mutation(arr) {
  var a = arr[0].toLowerCase(); // hello
  var b = arr[1].toLowerCase(); // neo
  for (var i =0; i < b.length; i++) {
    if (a.indexOf(b[i]) < 0) {
      return false;
    }
  }
      return true;

}

mutation(["hello", "neo"]);
Markus Kiili
@Masd925
Jul 06 2016 07:32
@GorgonsMaze Yes, if the looped character of b is not found in a, your function returns false, and after loop you know that all characters were found.
Ian Arsenault
@ianarsenault
Jul 06 2016 07:33
@Masd925 Ok I just wanted to confirm that. Thank you.
CamperBot
@camperbot
Jul 06 2016 07:33
gorgonsmaze sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2057 | @masd925 |http://www.freecodecamp.com/masd925
Ian Arsenault
@ianarsenault
Jul 06 2016 07:33
Not sure what it was about this one, but I just couldnt wrap my head around it.
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 07:36
need help in java script
Sujal
@Sujal3757
Jul 06 2016 07:37
@ktototamovich
you need to declare
collection[id].tracks as array and afterward assign value and u r done..
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 07:38
suppose i am dividing two digits like 5 / 2 it will give me 2.5 but i want 3.0
Steve Wilcox
@ThinknBoutStuff
Jul 06 2016 07:38
math.round()?
Math.ceil(); rounds up always I believe.
Abhishek Baliyan
@abhishekdevinfo
Jul 06 2016 07:40
@ThinknBoutStuff thanks
CamperBot
@camperbot
Jul 06 2016 07:40
abhishekdevinfo sends brownie points to @thinknboutstuff :sparkles: :thumbsup: :sparkles:
:cookie: 280 | @thinknboutstuff |http://www.freecodecamp.com/thinknboutstuff
Indhu
@Indhusethu
Jul 06 2016 07:42
@kazd ok
peibowl
@peibowl
Jul 06 2016 07:57
how can I extract the non-alphanumeric characters from a string?
str.replace(/[^a-z0-9]/g,"")
I've tried this but it does not work removing spaces or _
Robert Skalko
@RobertSkalko
Jul 06 2016 07:58
hello, can someone tell me how to detect screen size? i've been googling for a while and none of the solutions seem to work
im trying to make images have class tiny if screen size is small
Ken Nawrocki
@nawrockp
Jul 06 2016 08:00
@robertx32 have you tried media queries?
Robert Skalko
@RobertSkalko
Jul 06 2016 08:00
i did
Robert Skalko
@RobertSkalko
Jul 06 2016 08:02
ill try media queires again
Ken Nawrocki
@nawrockp
Jul 06 2016 08:02
So you need to actually add the class to the images, not just apply the rules of that class
Do you have a link?
Robert Skalko
@RobertSkalko
Jul 06 2016 08:02
i put it in chat before
im trying queries now
peibowl
@peibowl
Jul 06 2016 08:03
@Marmiz I tried those also, but still dont get rid of spaces or _
I dont know what is happening
Gart Flores
@devstackio
Jul 06 2016 08:04
@robertx32 have you tried $(window).width() ?
Robert Skalko
@RobertSkalko
Jul 06 2016 08:04
dont think so
Gart Flores
@devstackio
Jul 06 2016 08:05
could use that ... if < or > than whatever ... then use $(elem).addClass('yourclass'); to add the 'tiny' class
peibowl
@peibowl