These are chat archives for FreeCodeCamp/HelpJavaScript

16th
Nov 2016
andry91959
@andry91959
Nov 16 2016 00:00
but I think still not working
Laurynas
@IceCarpenter
Nov 16 2016 00:00
hi can anyone explain me whats happeneing with random whole numbers in a range? i did the code but i dont get something in the formula. Math.floor(Math.random() (max - min + 1)) + min
lets say min is 3 max is6. so (6-3 +1) = 4
0.99999 +3 = 6.9. Doesnt fit the math :S
Jonathan David Forrider
@jd4rider
Nov 16 2016 00:01
@andry91959 close, thing is, answer isn't a function
__mifflin__
@cdrainxv
Nov 16 2016 00:02

@andry91959: follow the pseudocode on the left:

switch(val) {
 case 1:
  anwser = "alpha";
  break;
…
}

Follow the template I’ve have provided.

Ryan McMahon
@Radio-Mac
Nov 16 2016 00:02
@Engineer-Kingdom See if the first name matches, then if it doesn't you don't have to look for the property. However if a first name does match, remember you have the boolean .hasOwnProperty(whateverValueYouWishToSeeIfItIsTrueOrFalse).
@andry91959 What @jd4rider Said, answer isn't a function. All you need is switch(val), you don't need answer.
Jan
@burning-monk
Nov 16 2016 00:02
@Bugaboss still trying?
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:04
@burning-monk yeah .. I tried to remove the part with testing if its a number and still it doesn't want to pass
Jan
@burning-monk
Nov 16 2016 00:05
@Bugaboss you first if condition why are you testing if it is >=num-3
andry91959
@andry91959
Nov 16 2016 00:06
Got it, thatnks guys
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:07
@andry91959 The whole point of these questions is to make sure your able to understand the materials going forward because they're going to get harder from here on out. Good luck!
Christian
@xChristianZx
Nov 16 2016 00:08
Can anyone assist on "Using Objects for Lookups"? I'm unsure of how to test the lookup
// Setup
function phoneticLookup(val) {
  var result = "";

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

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

// Change this value to test
phoneticLookup("charlie");
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:08
@burning-monk if the number (num (-3 represents "...") is bigger or equal than lenght of the string i don't want to put last "..." to the end of the string
Jan
@burning-monk
Nov 16 2016 00:09
@IceCarpenter Math.random is between 0 ant 0.999999 so multiplied with 4 it will be somthing between 0 and 3.9999999 and plus 3 somthing between 3 and 6.99999 but
Math.floor() function returns the largest integer less than or equal to a given number. So it returns something between 3 and 6
bgabriel718
@bgabriel718
Nov 16 2016 00:09

var string = "Split me into an array";
var array = [];

// Only change code below this line.

var array = string.split;

Jan
@burning-monk
Nov 16 2016 00:10
@Bugaboss isn't it if number is >= the given string?
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:10
@bgabriel718 Well where do you want to split the array? Right now split doesn't know what do look for. Tell it what to do with string.split(your answer here)!
*to
__mifflin__
@cdrainxv
Nov 16 2016 00:10

@cazenaty: Look at the function call below:

phoneticLookup("charlie");

Therefore change your keys to fit:
"alpha": "Adams", , etc

Christian
@xChristianZx
Nov 16 2016 00:14
@cdrainxv still not able to get it to work, not exactly sure what I'm missing
keep running it every which way, and can't get the "charlie" test to run
Conor Murphy
@cmurphy580
Nov 16 2016 00:15

Alright making some progress here. need help on the last two tests.
here is what i have,

function duplicateCount(text){
  //...
  var text1 = text.toLowerCase().split("");
  var count=0; 
  for (var i = 0; i<text1.length; i++) {
    for (var j = i; j<text1.length; j++) {
      if (i !== j && text1[i] == text1[j]) {
       count++; 
    }
    }
    } 
     return count; 
  }

and here are the tests,

Test.assertEquals(duplicateCount(""), 0);
Test.assertEquals(duplicateCount("abcde"), 0);
Test.assertEquals(duplicateCount("aabbcde"), 2);
Test.assertEquals(duplicateCount("aabBcde"), 2,"should ignore case");
Test.assertEquals(duplicateCount("Indivisibility"), 1)
Test.assertEquals(duplicateCount("Indivisibilities"), 2, "characters may not be adjacent")

Any idea on how to get the last two

__mifflin__
@cdrainxv
Nov 16 2016 00:16
@bgabriel718: use split(" ") to seperate by group/word or split("") to seperate by character/letter.
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:18
function truncateString(str, num) {
  // Clear out that junk in your trunk
  if ((num-3)<= str.length){
    if (num > 3){

     return  str.substr(0, num-3) + "...";
    }
    else {

     return str.substr(0, num) + "...";
    }
  }
  return str;
}

truncateString("A-tisket a-tasket A green and yellow basket", "588");
alt
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:18

I appreciate it @burning-monk . Right Now I'm just trying to figure out why

function largestOfFour(arr) {
  var highArray = [];
  for (var i = 0; i < arr.length; i++){
    for (var j = 0; j <arr[i].length; j++)
    {
       if (j < arr[i][j]){
         j = arr[i][j];
       }
    }
    highArray.push(j);
  }
  // You can do this!
  return highArray;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

Returns [5, 14, 33, 1001]

Islam Ibakaev
@dagman
Nov 16 2016 00:18
what is the best way(library) to handle user(jwt) authentication for isomorphic redux app?
__mifflin__
@cdrainxv
Nov 16 2016 00:21
@cazenaty:
  • You don’t need a , if it’s the last item in the object…
  • You need to search lookup object to find the value of of a key
    Ex… key: value —> "alpha": "Adams"
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:22
Ugh, I feel like an idiot. I used j as a way to increment the second loop and use it as a comparison tool. I needed an additional value.
Jan
@burning-monk
Nov 16 2016 00:22
@Radio-Mac why are you using j in your condition?
lol
@Bugaboss do you want to solve it with your logic?
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:22
@burning-monk I just asked myself the same question and figured out the problem. Works perfectly now. A good programming problem makes you feel a dolt for figuring it out.
Jan
@burning-monk
Nov 16 2016 00:23
such things happen
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:23
Anyway, is there's a better method for doing that problem? I have a feeling my method is, inefficient.
Jan
@burning-monk
Nov 16 2016 00:24
@Radio-Mac yes with sort
Ryan Hikel
@ryanhikel
Nov 16 2016 00:24
Hi can i get some help with the javascript problem Convert Celsius to Fahrenheit
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:24
@burning-monk I would like to know where is the problem :(
Jan
@burning-monk
Nov 16 2016 00:25
function compareNumbers(a, b) {
  return a - b;
}
@Radio-Mac
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:26
@burning-monk I guess I'm just wondering how the algorithm would look, I threw the sort function into arr but it spat out a weird number saying 1001 was first.
@ryanhikel Post your code and we'll see what your problem is!
Islam Ibakaev
@dagman
Nov 16 2016 00:27
@Radio-Mac just to make you a bit nerveous :smile:
const largestOfFour = (arr) => 
    arr.length > 1 ? [Math.max(...arr[0])].concat(largestOfFour(arr.slice(1))) : Math.max(...arr[0]);

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]); // [ 5, 27, 39, 1001 ]
Ryan Hikel
@ryanhikel
Nov 16 2016 00:28

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
fahrenheit *= 9/5;

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

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

Ryan McMahon
@Radio-Mac
Nov 16 2016 00:28
@dagman Holy cats man, this is the stuff they never teach you back at school.
Ryan Hikel
@ryanhikel
Nov 16 2016 00:28
the wording is confusing me im supposed to multiply by 9/5 then add 32
Islam Ibakaev
@dagman
Nov 16 2016 00:29
@Radio-Mac just a combo of es6 + recursion
cd-Zero
@cd-Zero
Nov 16 2016 00:29
where can I get answers to fcc challenges? i figured out how to do the updaterecords challenge but I feel like my answer sucks
Justin Pierson
@jpmitchellpierson
Nov 16 2016 00:29
anyone here thats done the record collection challenge? I have no idea what to do
cd-Zero
@cd-Zero
Nov 16 2016 00:30
@jpmitchellpierson i just finished it
Jan
@burning-monk
Nov 16 2016 00:30
@Bugaboss I got just the first if condition is wrong
cd-Zero
@cd-Zero
Nov 16 2016 00:30
my solution, atleast in my mind sucks
Justin Pierson
@jpmitchellpierson
Nov 16 2016 00:30
@cd-Zero did you use if/else statements for everything in the rules?
cd-Zero
@cd-Zero
Nov 16 2016 00:31
@jpmitchellpierson pretty much
Jan
@burning-monk
Nov 16 2016 00:31
@Bugaboss do you want the solution or try to figure it out first?
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:31
@ryanhikel In convert to Celsius, you're passing the value of 30 from the "convertToF" at the bottom into your function at the top. So in your function, Celsius acts like the number 30, so use it where applicable.
Islam Ibakaev
@dagman
Nov 16 2016 00:31
@Radio-Mac it is even easier without recursion just use ordinary .map()
const largestOfFour = arr => arr.map(x => Math.max(...x));
Justin Pierson
@jpmitchellpierson
Nov 16 2016 00:31
@cd-Zero how did you update values for album properties?
cd-Zero
@cd-Zero
Nov 16 2016 00:32
@jpmitchellpierson I would use repl.it/languages/javascript to test code snippets cause their are a bunch of confusing shit
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:32
@dagman I'd like to learn more about recursion, seems like that'd be a lot more helpful than logic problems sometimes. Take the good with the bad I'd say.
cd-Zero
@cd-Zero
Nov 16 2016 00:32
@jpmitchellpierson collection[id][prop] = value
@ or collection[id][prop].push(value)
@jpmitchellpierson I recommend solving 1 test at a time.
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:33

@burning-monk i made it with

if ((num)< str.length){

but i dont really know why is it working :D

Ryan McMahon
@Radio-Mac
Nov 16 2016 00:34
@ryanhikel Now think about the equation you're dealing with. Where would the 30 be applicable? Then use celsius in its place.
__mifflin__
@cdrainxv
Nov 16 2016 00:34

@Radio-Mac: I just changed your code a little:

function largestOfFour(arr) {
  var highArray = [];
  var x;
  for (var i = 0; i < arr.length; i++){
    for (var j = 0; j < arr[i].length; j++)
    { 
      x = arr[i][j];
       if (x < arr[i][j+1]){
         x = arr[i][j + 1];
       } else break;
    }
    highArray.push(x);
  }
  // You can do this!
  return highArray;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);

I would recommend using a sort and/or reduce function… since you have learned both.

Jan
@burning-monk
Nov 16 2016 00:35
@Bugaboss I did like this
```
Ryan Hikel
@ryanhikel
Nov 16 2016 00:35
how would i multiply by 9/5 would this work... celsius*=9/5+32
Jan
@burning-monk
Nov 16 2016 00:35
if (str.length > num){
   if (num<=3){
     return str.slice(0,num) + "...";
   }
   else {
     return str.slice(0,num-3) + "...";
   }
 }
  else {
    return str.slice(0,num);
  }
cd-Zero
@cd-Zero
Nov 16 2016 00:35
@cazenaty put "" around you keys... example "alpha" : "Adams"
@cazenaty echo should not be red like that
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:36
@ryanhikel You're solving for Fahrenheit not Celsius right? Try again.
__mifflin__
@cdrainxv
Nov 16 2016 00:36
@burning-monk: You can just return str; for your else statement.
Jan
@burning-monk
Nov 16 2016 00:37
oh lol
want a brownie? @cdrainxv
__mifflin__
@cdrainxv
Nov 16 2016 00:38
@burning-monk: Sure, but I didn’t help… you already had the answer. :100:
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:38
@cdrainxv Thanks, I suppose it's just the developer in me but when I see something take more than 20 steps I feel like there's a better option for me somewhere.
CamperBot
@camperbot
Nov 16 2016 00:38
radio-mac sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:cookie: 962 | @cdrainxv |http://www.freecodecamp.com/cdrainxv
Jan
@burning-monk
Nov 16 2016 00:38
it's actually the same solution
@cdrainxv thanks
CamperBot
@camperbot
Nov 16 2016 00:38
burning-monk sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:cookie: 963 | @cdrainxv |http://www.freecodecamp.com/cdrainxv
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:39
"Confirm the ending." Now why are we being asked to use old methods when better ones are available?
Ryan Hikel
@ryanhikel
Nov 16 2016 00:39

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
celsius*(9/5)+32;

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

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

__mifflin__
@cdrainxv
Nov 16 2016 00:39
@Radio-Mac: There will always be better options, though not always better performance wise… a for lop is almost always faster than recursion or some of the higher order functions like map, reduce, etc.
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:39
how do you send a brownie acutally ? :D
Jason
@jasonascott89
Nov 16 2016 00:40
@Bugaboss thanks
Ryan Hikel
@ryanhikel
Nov 16 2016 00:40
im supposed to convert the celsiud to fahrenheit i think i did the multiplication wrong
CamperBot
@camperbot
Nov 16 2016 00:40
jasonascott89 sends brownie points to @bugaboss :sparkles: :thumbsup: :sparkles:
:cookie: 249 | @bugaboss |http://www.freecodecamp.com/bugaboss
__mifflin__
@cdrainxv
Nov 16 2016 00:40
@ryanhikel: you need to assign your formula to fahrenheit.
fahrenheit = celsius*(9/5)+32;
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:40
@jasonascott89 thanks
CamperBot
@camperbot
Nov 16 2016 00:40
bugaboss sends brownie points to @jasonascott89 :sparkles: :thumbsup: :sparkles:
:cookie: 167 | @jasonascott89 |http://www.freecodecamp.com/jasonascott89
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:40
@burning-monk thanks
CamperBot
@camperbot
Nov 16 2016 00:40
bugaboss sends brownie points to @burning-monk :sparkles: :thumbsup: :sparkles:
:cookie: 458 | @burning-monk |http://www.freecodecamp.com/burning-monk
Jan
@burning-monk
Nov 16 2016 00:41
@Bugaboss did understand it now?
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:41
@cdrainxv I suppose so.
Ryan Hikel
@ryanhikel
Nov 16 2016 00:41
oh that makes sense thank you @Radio-Mac @cdrainxv
CamperBot
@camperbot
Nov 16 2016 00:41
:cookie: 269 | @radio-mac |http://www.freecodecamp.com/radio-mac
ryanhikel sends brownie points to @radio-mac and @cdrainxv :sparkles: :thumbsup: :sparkles:
:cookie: 964 | @cdrainxv |http://www.freecodecamp.com/cdrainxv
__mifflin__
@cdrainxv
Nov 16 2016 00:42
@burning-monk: I know that… but why go over a mountain when you can just go through a tunnel in it…. hmmm maybe bad analogy. :thought_balloon:
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:42
Hahahaha. It doesn't even check to make sure you aren't using "endsWiths()" Alright, time to do this legitimately.
Jan
@burning-monk
Nov 16 2016 00:42
@cdrainxv what?
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:42
@burning-monk yes the only problem was with the first if as you said :)
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:43
@ryanhikel No worries, just remember to identify the problem of "What are they asking of me for this problem?" Saves you a lot of headaches later, trust me.
__mifflin__
@cdrainxv
Nov 16 2016 00:43
@burning-monk: I was referencing this: :point_up: November 15, 2016 5:38 PM
Ryan Hikel
@ryanhikel
Nov 16 2016 00:43
I really appreciate the help @Radio-Mac
Jan
@burning-monk
Nov 16 2016 00:44
@cdrainxv ah ok, I meant his solution is the same as mine
but that is right too
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:44
No worries.
Engineer-Kingdom
@Engineer-Kingdom
Nov 16 2016 00:46
@Radio-Mac the problem is how to match first name?
Walid Ashri
@walidashri
Nov 16 2016 00:46
hey any thoughts to make it simpler
task: make a func to count duplicate letters in a string
function duplicateCount(text){
var text1 = text.toLowerCase().split("").sort();

  text1=text1.filter(function(a,b){
    return a==text1[b+1];});
    text1=text1.filter(function(a,b){
    return a!=text1[b+1];});

 return text1.length;
 }
Jordy weerwag
@TheCodeWriter1
Nov 16 2016 00:46
Someone a good place with good videos about javascript ?
Or a good youtube channel
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:47
@Engineer-Kingdom Run a for loop for first name in the object array and if you find a match run the second set of boolean code to find out if it has a prop.
Engineer-Kingdom
@Engineer-Kingdom
Nov 16 2016 00:48
var contacts = [ { "firstName": "Akira", "lastName": "Laine", "number": "0543236543", "likes": ["Pizza", "Coding", "Brownie Points"] }, { "firstName": "Harry", "lastName": "Potter", "number": "0994372684", "likes": ["Hogwarts", "Magic", "Hagrid"] }, { "firstName": "Sherlock", "lastName": "Holmes", "number": "0487345643", "likes": ["Intriguing Cases", "Violin"] }, { "firstName": "Kristian", "lastName": "Vos", "number": "unknown", "likes": ["Javascript", "Gaming", "Foxes"] } ];contacts[0] would be {
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
}
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];
contacts[0] would be {
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
}
contacts[0][0] would be "Akira"?
Chris
@Cbhansen
Nov 16 2016 00:49
hello need some help please.
Engineer-Kingdom
@Engineer-Kingdom
Nov 16 2016 00:49
or {"firstname":"Akira"}
Chris
@Cbhansen
Nov 16 2016 00:49
dont know if its javascript or css though
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:50
@Engineer-Kingdom All you need is contacts[x].firstName;
Sylvio Giubine
@SylvioGiubine
Nov 16 2016 00:51
hello ! someone had a problem at the pig latin ??
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:51
Well this is the javascript room. What're you looking for?
Engineer-Kingdom
@Engineer-Kingdom
Nov 16 2016 00:51
contacts[x].firstName = someone? @Radio-Mac
Sylvio Giubine
@SylvioGiubine
Nov 16 2016 00:51
follow my code :

function translatePigLatin(str) {

var vowels = ['a','e','i','o','u'],
result = str.split('');

if (vowels.includes(str.charAt(0))){
return str += 'way';
}
else{
for (var i = 0; i < str.length; i++){
if (!vowels.invludes(str[i])){
result.push(result.shift());}
else {
result.push('ay');
return result.join('');
}
}
}

return str;
}

translatePigLatin("consonant");

i got now guys !! thankS !
Walid Ashri
@walidashri
Nov 16 2016 00:52
@SylvioGiubine if (!vowels.invludes(str[i])){ :)
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:53
@Engineer-Kingdom Yep, contacts[x].firstName = firstName /The second first Name is the value you've passed./
That should give you a good boot in the right direction. Good luck!
Engineer-Kingdom
@Engineer-Kingdom
Nov 16 2016 00:53
But my problem is how to see if the prop = property name @Radio-Mac
Walid Ashri
@walidashri
Nov 16 2016 00:55
@Engineer-Kingdom lookup hasOwenProperty()
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:55
@Engineer-Kingdom Well you first have to run the for loop see if the first name exists. The second if loop is a boolean that checks to see if .hasOwnProperty(prop).
Justin Pierson
@jpmitchellpierson
Nov 16 2016 00:55
Need help with this if statement: If prop is "tracks" but the album doesn't have a "tracks" property, create an empty array before adding the new value to the album's corresponding property.
function updateRecords(id, prop, value) {
  if (prop !== "tracks" && value !== "") {
    collection[id][prop] = value;
  }

  if (prop === "tracks" && ) {

  }

  return collection;
and should this be an else if?
Jason
@jasonascott89
Nov 16 2016 00:56
Sooo this challenge wanted me to take an array and return the same thing in a two-dimensional array split into groups, but when I logged the returned array, it didn't have brackets, but I passed the challenge. I want to make sure I got it right, anyone mind taking a look?
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:57
@jasonascott89 What were you working on?
Jason
@jasonascott89
Nov 16 2016 00:57
The "Chunky Monkey" challenge:

function chunkArrayInGroups(arr, size) {
  var temparr=arr,temparr1=[];
  for(var i=0,j=arr.length-1;i<=j;i+=size){
      console.log("current slice: " + temparr.slice(i,i+size));
      temparr1.push(temparr.slice(i,i+size));
    }  
  console.log("returning arr: " + temparr1);
  return temparr1;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
Walid Ashri
@walidashri
Nov 16 2016 00:57
@jpmitchellpierson use .hasOwnProperty to check for prop
and yes else if
@jasonascott89 https://repl.it/EZPA/1
Tony Miri
@TonyMiri
Nov 16 2016 00:59
Can anyone help me with the 'Exact Change' challenge? I'm almost done with it, but my values at the end are coming up a couple cents short and I can't figure out how to fix them. I've tried to do the Math.round(x * 100) / 100; and it doesn't seem to be working. I might be using it in the wrong places? If anyone is good with that type of thing and has a minute I'd appreciate the help.
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:59
@jasonascott89 Haven't gotten that far yet. Sorry.
Engineer-Kingdom
@Engineer-Kingdom
Nov 16 2016 01:00

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


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

// Change these values to test your function
lookUpProfile("Kristian", "lastName");
@Radio-Mac still doesn't work
Jordy weerwag
@TheCodeWriter1
Nov 16 2016 01:01
Sorry i am not so far i am a javascript newbie (is there a good guide to watch of read?)
Justin Pierson
@jpmitchellpierson
Nov 16 2016 01:01
@walidashri would it be easier to use a switch function?
Christian
@xChristianZx
Nov 16 2016 01:01
@cd-Zero Thanks for the help, however i still can't get the tests to pass
CamperBot
@camperbot
Nov 16 2016 01:01
cazenaty sends brownie points to @cd-zero :sparkles: :thumbsup: :sparkles:
:cookie: 121 | @cd-zero |http://www.freecodecamp.com/cd-zero
Manish Giri
@Manish-Giri
Nov 16 2016 01:02
@TheCodeWriter1 try codeacademy
Walid Ashri
@walidashri
Nov 16 2016 01:02
@jpmitchellpierson I don't think so
Manish Giri
@Manish-Giri
Nov 16 2016 01:02
@Engineer-Kingdom try to keep the return of contact outside the for loop
Christian
@xChristianZx
Nov 16 2016 01:02
Current configuration, and I know it has to do with the phoneticLookup value part, but can't get any of it to work
// Setup
function phoneticLookup(val) {
  var result = "";

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

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

// Change this value to test
phoneticLookup("charlie");
Manish Giri
@Manish-Giri
Nov 16 2016 01:03
@cazenaty your object is setup correctly, you just need to use the variable val to find out the value, from the object
@cazenaty how do you lookup a property’s value from an object?
Barbara
@barb1643
Nov 16 2016 01:05
I need help! Trying to do javascript beginner and cannot figure out what i did wrong! var myStr = "FirstLine\n \\SecondLine\\ \rThirdLine"; // Change this line
I know it shouldn't have spaces, i just did that so its easier to see
Manish Giri
@Manish-Giri
Nov 16 2016 01:06
@barb1643 what challenge is it
Barbara
@barb1643
Nov 16 2016 01:07
escape sequences
Manish Giri
@Manish-Giri
Nov 16 2016 01:09
it works for me, without the spaces
Walid Ashri
@walidashri
Nov 16 2016 01:09
@barb1643 try a refresh it's valid
Manish Giri
@Manish-Giri
Nov 16 2016 01:09
@barb1643
var myStr="FirstLine\n\\SecondLine\\\rThirdLine”;
andry91959
@andry91959
Nov 16 2016 01:10
help

function isLess(a, b) {
// Fix this code
return a === b;
}

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

how do we make isLess(10,15) true
Manish Giri
@Manish-Giri
Nov 16 2016 01:11
@andry91959 why’re you using === ?
andry91959
@andry91959
Nov 16 2016 01:11
cause i want the result fals
false
Manish Giri
@Manish-Giri
Nov 16 2016 01:11
no
you need to check if a number is less than another number
andry91959
@andry91959
Nov 16 2016 01:11
because i put one condition it becomes true and other false
Manish Giri
@Manish-Giri
Nov 16 2016 01:12
and return true or false, accordingly
not test if they are equal or not
Gustavo Gil Noriega
@ggil12
Nov 16 2016 01:12
Hello. I'm new learning Javascript.

// Setup
var myStr = "Jello World";

// Only change code below this line

myStr[0] = "J"; // Fix Me

Iqbal
@mibaldobaghi
Nov 16 2016 01:12
@andry91959 if a< b return true
Gustavo Gil Noriega
@ggil12
Nov 16 2016 01:12
Whats wrong here?
Adrian Mechelle
@astoddard3
Nov 16 2016 01:12

Assign the value 7 to variable a.

Assign the contents of a to variable b.

Iqbal
@mibaldobaghi
Nov 16 2016 01:12
so if A is 10 and B is 15 then 10<15 will be true
andry91959
@andry91959
Nov 16 2016 01:12
so we have 2 statement ?
Adrian Mechelle
@astoddard3
Nov 16 2016 01:13

var a = 7;
var b = var a;

my code wont check out

Manish Giri
@Manish-Giri
Nov 16 2016 01:13
@ggil12 strings are immutable, you cannot change individual characters
Iqbal
@mibaldobaghi
Nov 16 2016 01:13
@astoddard3 no need for var. var b = a
Manish Giri
@Manish-Giri
Nov 16 2016 01:13
@astoddard3 var b = a if you want to assign a to b
Christian
@xChristianZx
Nov 16 2016 01:13
@Manish-Giri i'm just not seeing it.
Gustavo Gil Noriega
@ggil12
Nov 16 2016 01:13
@Manish-Giri So.. What should I do?
Barbara
@barb1643
Nov 16 2016 01:13
@Manish-Giri @walidashri I had one too many \ before and after the Secondline thank you!
Walid Ashri
@walidashri
Nov 16 2016 01:13
@astoddard3 use var only one time per variable
CamperBot
@camperbot
Nov 16 2016 01:13
barb1643 sends brownie points to @manish-giri and @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 642 | @walidashri |http://www.freecodecamp.com/walidashri
:star2: 2276 | @manish-giri |http://www.freecodecamp.com/manish-giri
Iqbal
@mibaldobaghi
Nov 16 2016 01:13
@ggil12 are you supposed to change the letter?
Adrian Mechelle
@astoddard3
Nov 16 2016 01:13
ohhhhhhh thanks guys!!
Christian
@xChristianZx
Nov 16 2016 01:13
tried var val = phoneticLookup.charlie, that didn't work nor did any variation there of
Barbara
@barb1643
Nov 16 2016 01:14
i am sure i will be back...
Gustavo Gil Noriega
@ggil12
Nov 16 2016 01:14
@mibaldobaghi I'm supposed to correct myStr but I dont see the problem..
Walid Ashri
@walidashri
Nov 16 2016 01:14
@barb1643 Confidant! :)
Iqbal
@mibaldobaghi
Nov 16 2016 01:14
Should it be Hello instead of Jello?
Manish Giri
@Manish-Giri
Nov 16 2016 01:15
@ggil12 instead of changing myStr[0], just assign the new string to myStr
Vlad
@zastavno
Nov 16 2016 01:15
who here can help me with my error messages in compiler for my first program in class?
andry91959
@andry91959
Nov 16 2016 01:15
Im still not sure

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

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

so I need to make 1 statement
without if statement
the example show me ===
Iqbal
@mibaldobaghi
Nov 16 2016 01:16
@andry91959 not understanding?
which test are you doing
Vlad
@zastavno
Nov 16 2016 01:16
how do i fix this
int x, y;
char c;
String s;
boolean b = true;
c = K;
x = 15;
y = 20;

System.out.println("Value of x is " + x + ".");
System.out.println("Value of y is " + y + ".");
System.out.println("Value of c is " + c + ".");

s = "This is a string value assigned to s";

System.out.println("Value of s is\n*" + s +"*");

System.out.println("Value of b is " + b);
andry91959
@andry91959
Nov 16 2016 01:16
@mibaldobaghi Returning Boolean Values from Functions
Walid Ashri
@walidashri
Nov 16 2016 01:16
@andry91959 return a<b is the same as ur if else
Manish Giri
@Manish-Giri
Nov 16 2016 01:16
@andry91959 shouldn’t you be using a return instead of if/else
Iqbal
@mibaldobaghi
Nov 16 2016 01:17
yes return a<b is the same
Gustavo Gil Noriega
@ggil12
Nov 16 2016 01:17
@Manish-Giri Did it. Thanks!
CamperBot
@camperbot
Nov 16 2016 01:17
ggil12 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 2277 | @manish-giri |http://www.freecodecamp.com/manish-giri
andry91959
@andry91959
Nov 16 2016 01:17
dang
u are right
thanks guys
Tony Miri
@TonyMiri
Nov 16 2016 01:18
Anybody finished the 'Exact Change' challenge?
Manish Giri
@Manish-Giri
Nov 16 2016 01:18
@ggil12 welcome
Jeff Shapiro
@Jeff-Shapiro
Nov 16 2016 01:19
Hey @Manish-Giri
Murrali
@1810msr
Nov 16 2016 01:19
Hello, any help will be greatly appreciated for this : https://www.freecodecamp.com/challenges/record-collection#?solution=%0A%2F%2F%20Setup%0Avar%20collection%20%3D%20%7B%0A%20%20%20%20%222548%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%22Slippery%20When%20Wet%22%2C%0A%20%20%20%20%20%20%22artist%22%3A%20%22Bon%20Jovi%22%2C%0A%20%20%20%20%20%20%22tracks%22%3A%20%5B%20%0A%20%20%20%20%20%20%20%20%22Let%20It%20Rock%22%2C%20%0A%20%20%20%20%20%20%20%20%22You%20Give%20Love%20a%20Bad%20Name%22%20%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%222468%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%221999%22%2C%0A%20%20%20%20%20%20%22artist%22%3A%20%22Prince%22%2C%0A%20%20%20%20%20%20%22tracks%22%3A%20%5B%20%0A%20%20%20%20%20%20%20%20%221999%22%2C%20%0A%20%20%20%20%20%20%20%20%22Little%20Red%20Corvette%22%20%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%221245%22%3A%20%7B%0A%20%20%20%20%20%20%22artist%22%3A%20%22Robert%20Palmer%22%2C%0A%20%20%20%20%20%20%22tracks%22%3A%20%5B%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%225439%22%3A%20%7B%0A%20%20%20%20%20%20%22album%22%3A%20%22ABBA%20Gold%22%0A%20%20%20%20%7D%0A%7D%3B%0A%2F%2F%20Keep%20a%20copy%20of%20the%20collection%20for%20tests%0A%2F%2Fvar%20collectionCopy%20%3D%20JSON.parse(JSON.stringify(collection))%3B%0A%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0Afunction%20updateRecords(id%2C%20prop%2C%20value)%20%7B%0A%20%20switch%20(updateRecords)%7B%0A%20%20%20%20%0A%20%20%20%20case%20prop!%3D%22tracks%22%20%26%26%20value%20!%3D%3D%20%22%22%3A%0A%20%20%20%20%20%20collection%5Bid%5D%5Bprop%5D%20%3D%20value%3B%20%0A%20%20%20%20%20%20break%3B%0A%20%20%20%20%0A%20%20%20%20%20%20case%20prop%20%3D%3D%22tracks%22%20%26%26%20collection%5Bid%5D%5Bprop%5D%20%3D%3D%3D%20undefined%3A%0A%20%20%20%20%20%20collection%5Bid%5D%5Bprop%5D%20%3D%20%5B%5D%3B%0A%20%20%20%20%20%20collection%5Bid%5D%5Bprop%5D%20%3D%20%5Bvalue%5D%3B%0A%20%20%20%20%20%20break%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20case%20prop%3D%3D%22tracks%22%20%26%26%20value%20!%3D%3D%20%22%22%3A%0A%20%20%20%20%20%20collection%5Bid%5D%5Bprop%5D%20%3D%20%5B%5D%3B%0A%20%20%20%20%20%20collection%5Bid%5D%5Bprop%5D.push(value)%3B%20%0A%20%20%20%20%20%20break%3B%0A%20%20%20%20%0A%20%20%20%20%20%20case%20value%20%3D%3D%3D%20%22%22%3A%0A%20%20%20%20%20%20delete%20collection%5Bid%5D%5Bprop%5D%3B%0A%20%20%7D%0A%20%20%2F%2Fcollection%20%3D%20%20updateRecords(id%2C%20prop%2C%20value)%3B%0A%20%20return%20collection%3B%0A%7D%0A%0A%2F%2F%20Alter%20values%20below%20to%20test%20your%20code%0A%2F%2FupdateRecords(5439%2C%20%22artist%22%2C%20%22ABBA%22)%3B%0A%2F%2FupdateRecords(1245%2C%20%22tracks%22%2C%20%22%22)%3B%0AupdateRecords(5439%2C%20%22artist%22%2C%20%22ABBA%22)%3B%0A%0A%0A%0A%0A

// 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) {
switch (updateRecords){

case prop!="tracks" && value !== "":
  collection[id][prop] = value; 
  break;

  case prop =="tracks" && collection[id][prop] === undefined:
  collection[id][prop] = [];
  collection[id][prop] = [value];
  break;

  case prop=="tracks" && value !== "":
  collection[id][prop] = [];
  collection[id][prop].push(value); 
  break;

  case value === "":
  delete collection[id][prop];

}
//collection = updateRecords(id, prop, value);
return collection;
}

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

Manish Giri
@Manish-Giri
Nov 16 2016 01:20
@Jeff-Shapiro :wave:
Walid Ashri
@walidashri
Nov 16 2016 01:20
@zastavno c = K; this is wrong also this is Java no javaScript
Murrali
@1810msr
Nov 16 2016 01:21
After updateRecords(5439, "artist", "ABBA"), artist should be "ABBA"
After updateRecords(5439, "tracks", "Take a Chance on Me"), tracks should have "Take a Chance on Me" as the last element.
After updateRecords(2548, "artist", ""), artist should not be set
After updateRecords(1245, "tracks", "Addicted to Love"), tracks should have "Addicted to Love" as the last element.
After updateRecords(2468, "tracks", "Free"), tracks should have "1999" as the first element.
After updateRecords(2548, "tracks", ""), tracks should not be set
Just cant figure-out whats wrong with my code
any hints would be great
Diego Mayer
@Chrono79
Nov 16 2016 01:22
@1810msr you can't use switch like that, use if/else structure
Murrali
@1810msr
Nov 16 2016 01:23
so, do i use IF statements instead
ok thanks
gandledorf
@gandledorf
Nov 16 2016 01:23
var myStr = "\"FirstLine\n'\SecondLine\'\r\ThirdLine"; he;p
help
Barbara
@barb1643
Nov 16 2016 01:25
What am I doing wrong here?

// Example
var ourStr = "I come first. " + "I come second.";

// Only change code below this line
var myStr = "This is the start." + "This is the end.";

Anthony
@jawaka72
Nov 16 2016 01:25
function largestOfFour(arr) {
  for(var i = 0; i < arr.length; i++) {
     arr[i].sort(function(a,b){
       return a - b;
     });
arr[i].pop();
  }
  return arr;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
I almost have this one, but I can't figure out how to return the popped elements to a new array. Any help would be great.
Justin Pierson
@jpmitchellpierson
Nov 16 2016 01:25
// Only change code below this line
function updateRecords(id, prop, value) {
    if (prop !== "tracks" && value !== "") {
      collection[id][prop] = value;

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

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

    } else if (collection[id][prop][value] === "") {
      delete collection[id][prop];
    }
  return collection;
}
Walid Ashri
@walidashri
Nov 16 2016 01:25
:point_up: November 16, 2016 4:46 AM @Chrono79 Diego Armando Maradonna of JS
@barb1643 space?
Diego Mayer
@Chrono79
Nov 16 2016 01:26
@barb1643 space between the two sentences
Manish Giri
@Manish-Giri
Nov 16 2016 01:27
@barb1643 you’re missing a space
Barbara
@barb1643
Nov 16 2016 01:28
I had it before and it didn't work then either
let me try it again
@Manish-Giri @Chrono79 thank you I needed to put a space after the first sentence, not at the beginning of the 2nd sentence,
CamperBot
@camperbot
Nov 16 2016 01:31
barb1643 sends brownie points to @manish-giri and @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2540 | @chrono79 |http://www.freecodecamp.com/chrono79
:warning: barb1643 already gave manish-giri points
Manish Giri
@Manish-Giri
Nov 16 2016 01:31
@barb1643 welcome
gandledorf
@gandledorf
Nov 16 2016 01:33
var myStr = "\"FirstLine\n'\SecondLine\'\r\ThirdLine"; sombody help me before i go insane
Manish Giri
@Manish-Giri
Nov 16 2016 01:34
@gandledorf why so many quotes
gandledorf
@gandledorf
Nov 16 2016 01:35
i dont know, im so confused and tired right now
Walid Ashri
@walidashri
Nov 16 2016 01:35
:point_up: November 16, 2016 5:09 AM @gandledorf
gandledorf
@gandledorf
Nov 16 2016 01:36
@Manish-Giri thank you
CamperBot
@camperbot
Nov 16 2016 01:36
:star2: 2278 | @manish-giri |http://www.freecodecamp.com/manish-giri
gandledorf sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
Manish Giri
@Manish-Giri
Nov 16 2016 01:37
@gandledorf welcome
Jason
@jasonascott89
Nov 16 2016 01:37
I'm on the Slasher Flick challenge, and even though my console logs say I'm returning the values they should be, I'm still failing the challenge. Anyone mind taking a look?
Walid Ashri
@walidashri
Nov 16 2016 01:37
:)
@Chrono79
Justin Vernon
@Jvernz
Nov 16 2016 01:38
Can someone help walk me through the process of creating a button that generates text inside a div? Or provide me with a resource that will help? I can't figure out what to do for the random quote generator
Christian
@xChristianZx
Nov 16 2016 01:42
@Manish-Giri Thank you for the help earlier. While it was what I was trying to solve for; the whole time I had been trying to change the wrong line. Finally got it figured out, thanks again
CamperBot
@camperbot
Nov 16 2016 01:42
cazenaty sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 2279 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Nov 16 2016 01:42
@cazenaty anytime
@Jvernz PM me if you have a codepen link
Justin Pierson
@jpmitchellpierson
Nov 16 2016 01:43
// Only change code below this line
function updateRecords(id, prop, value) {
    if (prop !== "tracks" && value !== "") {
      collection[id][prop] = value;

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

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

    } else if (value === "") {
      delete collection[id][prop];
    }
  return collection;
}
I'm very close. Just need this one: After updateRecords(5439, "tracks", "Take a Chance on Me"), tracks should have "Take a Chance on Me" as the last element.
i dont think its right though because there's a part that says if (prop === "tracks && prop !== "tracks") which makes absolutely no sense and makes anything possible
Diego Mayer
@Chrono79
Nov 16 2016 01:48
@walidashri not sure if it is better or shorter:
function duplicateCount(text){
    var arr = text.toLowerCase().split("").sort().join("").match(/(\w)\1+/g);
    return arr ? arr.length : 0;
}
Walid Ashri
@walidashri
Nov 16 2016 01:55
@Chrono79 thanks yuckies I hate regex :)
function duplicateCount(text){
    return text.toLowerCase().split("").sort().join("").match(/(\w)\1+/g).length;
}
CamperBot
@camperbot
Nov 16 2016 01:55
walidashri sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2541 | @chrono79 |http://www.freecodecamp.com/chrono79
Adrian Mechelle
@astoddard3
Nov 16 2016 01:55

Set remainder equal to the remainder of 11 divided by 3 using the remainder (%) operator.

var remainder;
var remainder 11 % 3 = 2;

code wont check out

Diego Mayer
@Chrono79
Nov 16 2016 01:55
@walidashri note that if there were no repetitions that gives an error, because match returns null, and null has no length
That is a codewars challenge isn't it? Pass me your username there by pm
Tony Miri
@TonyMiri
Nov 16 2016 01:58
@astoddard3
var remainder =  11 % 3;
Walid Ashri
@walidashri
Nov 16 2016 01:58
@Chrono79 I said I hate reges :veryangrey:
Adrian Mechelle
@astoddard3
Nov 16 2016 01:58
so particular!!! thanks tony!
Tony Miri
@TonyMiri
Nov 16 2016 01:59
@astoddard3 No problem. And yes, computers are very picky lol
Anthony
@jawaka72
Nov 16 2016 02:00
function largestOfFour(arr) {
  for(var i = 0; i < arr.length; i++) {
     arr[i].sort(function(a,b){
       return a - b;
     });
    arr[i].pop();
  }
  return arr;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
I almost have this one. I can't figure out how to return a new array containing the largest numbers of the multi-array. Any tips?
Diego Mayer
@Chrono79
Nov 16 2016 02:02
@jawaka72 try arr[i] = arr[i].pop();
Anthony
@jawaka72
Nov 16 2016 02:02
@Chrono79 Awesome. Thank you so much.
CamperBot
@camperbot
Nov 16 2016 02:02
jawaka72 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2542 | @chrono79 |http://www.freecodecamp.com/chrono79
Daniel
@danielbyun
Nov 16 2016 02:06
can somebody help with 'testing objects for properties' i have no clue
Eric Murta
@murtinha
Nov 16 2016 02:06
can uou guys give me feedback on my markdown previewer?
http://codepen.io/murtinha/pen/xEvbdX
Vlad
@zastavno
Nov 16 2016 02:06
how do i

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line

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

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

Convert Celsius to Fahrenheit
in java practice
MCess
@MCess
Nov 16 2016 02:08
Hi I'm having trouble completing the "Filter Arrays with filter" challenge. I cannot complete the task "You should not change the original array."

var oldArray = [1,2,3,4,5,6,7,8,9,10];

// Only change code below this line.
oldArray = oldArray.filter(function(val) {
  return val <= 5; 
});
var newArray = oldArray;
Diego Mayer
@Chrono79
Nov 16 2016 02:10

@MCess

oldArray = oldArray.filter(function(val) {
  return val <= 5; 
});

There you're changing oldArray

MCess
@MCess
Nov 16 2016 02:11
I should just remove the last line?
Diego Mayer
@Chrono79
Nov 16 2016 02:12
@MCess you have to set the result of filter to another var, not oldArray if you want it to stay the same
MCess
@MCess
Nov 16 2016 02:19
Ah! Figured it out. Thanks @Chrono79
CamperBot
@camperbot
Nov 16 2016 02:19
mcess sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2543 | @chrono79 |http://www.freecodecamp.com/chrono79
Walid Ashri
@walidashri
Nov 16 2016 02:22
@Chrono79 I'm not in codewars just saw the challenge with anther camper
May join when hit home later
jwalk197804
@jwalk197804
Nov 16 2016 02:23
Hello world !
CamperBot
@camperbot
Nov 16 2016 02:23

welcome to FreeCodeCamp @jwalk197804!

jwalk197804
@jwalk197804
Nov 16 2016 02:23
Just discovered Free Code Camo
Camp
Joseph
@josephlo8318
Nov 16 2016 02:24
@jpmitchellpierson I think you need to create an arr before you add the (value) so before you push the value you need to create the (arr)
collection[id][prop]=[]
collection[id][prop].push(value);
@jwalk197804 Welcome! and say good bye to your nights
jwalk197804
@jwalk197804
Nov 16 2016 02:26
haha..Thanks...So long as I am improving on code..Its okay..who needs sleep..
Walid Ashri
@walidashri
Nov 16 2016 02:26
@josephlo8318 lol
KSV
@vicmania2007
Nov 16 2016 02:33
is there a way we can solve the problem "We'll pass you an array of two numbers. Return the sum of those two numbers and all numbers between them" using Array.prototype.reduce()??
dtonlai
@dtonlai
Nov 16 2016 02:36
Hi, can anyone help me with a challenge? I just don't understand it
Specifically, 120 - Storing Values with the Assignment Operator.
KSV
@vicmania2007
Nov 16 2016 02:37
do we have to override the reduce function, for it to work the given wayu??
Walid Ashri
@walidashri
Nov 16 2016 02:39
@vicmania2007 create the array of all num between them then reduce it
Manish Giri
@Manish-Giri
Nov 16 2016 02:40
@dtonlai do you have a question
dtonlai
@dtonlai
Nov 16 2016 02:41
@Manish-Giri Hi, so the challenge is to assign variable "a" a value of 7 and assign the contents of "a" to "b"
@Manish-Giri I just don't really understand how to do it, the explanation isn't so clear to me.
Manish Giri
@Manish-Giri
Nov 16 2016 02:41
@dtonlai okay, and your doubt is?
dtonlai
@dtonlai
Nov 16 2016 02:42
@Manish-Giri I set my "var a = 7"
@Manish-Giri But I don't understand how to assign "a" to "b"
Manish Giri
@Manish-Giri
Nov 16 2016 02:42

@dtonlai okay, so when you need to assign a number to a variable, you put an =, the variable on the left, and the number on the right, so

var a = 10;

this reads - > take the number 10 and assign it to a variable named a

Emerson
@DikoFaji
Nov 16 2016 02:43
is Roman Numeral Converter challenge really has a lot of if conditions?
Manish Giri
@Manish-Giri
Nov 16 2016 02:43

@dtonlai oh, treat a like any other number, if you wanted to assign 5 to a variable named b, you'd just do it like

var b = 5;

and now instead of 5, you have a variable containing a number, so just replace 5 with a

makleriux
@makleriux
Nov 16 2016 02:43
hi, can anyone help with wikipedia random pages challenge?
Manish Giri
@Manish-Giri
Nov 16 2016 02:43
@makleriux did you have a question?
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 02:43

@dtonlai The structure of assigning values looks like this:

var VariableName = Value;

So with var a = 10;, the Variable Name is a, and the value is 10.

To assign the value of a to b, you need b in the Variable Name spot, and a in the value spot.

dtonlai
@dtonlai
Nov 16 2016 02:44
@Manish-Giri @NicksIdeaEngine Ah ok, so it would look like:
var = a;
var b = a;
Manish Giri
@Manish-Giri
Nov 16 2016 02:45
@dtonlai this is right var b = a;
dtonlai
@dtonlai
Nov 16 2016 02:45
oh wait, var a = 7;
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 02:45
There you go!
Manish Giri
@Manish-Giri
Nov 16 2016 02:45
yes
Aaron Bell
@awb715
Nov 16 2016 02:45
is anyone familiar with this error
RobotCaleb
XMLHttpRequest cannot load https://wind-bow.hyperdev.space/twitch-api//channels/RobotCaleb. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s.codepen.io' is therefore not allowed access.
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 02:45
@awb715 I haven't met RobotCaleb. Sorry.
makleriux
@makleriux
Nov 16 2016 02:45
@Manish-Giri yea, i cant (do not know how) get page id into variable because page id is always different
my code here :) http://codepen.io/edenlt/pen/eBZjmO
Aaron Bell
@awb715
Nov 16 2016 02:45
haha sorry
dtonlai
@dtonlai
Nov 16 2016 02:45
@Manish-Giri @NicksIdeaEngine Thanks so much!
CamperBot
@camperbot
Nov 16 2016 02:45
dtonlai sends brownie points to @manish-giri and @nicksideaengine :sparkles: :thumbsup: :sparkles:
:cookie: 277 | @nicksideaengine |http://www.freecodecamp.com/nicksideaengine
:star2: 2280 | @manish-giri |http://www.freecodecamp.com/manish-giri
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 02:46
@awb715 If I'm to guess, something on RobotCaleb's side is preventing access. I haven't done that challenge yet so I'm not sure where to go from there.
@awb715 Is it opssible that you need to add something to your CodePen to let the Twitch API know it's okay to send information?
Manish Giri
@Manish-Giri
Nov 16 2016 02:47
@makleriux you probably need action=opensearch, not action=query
Aaron Bell
@awb715
Nov 16 2016 02:47
not sure @NicksIdeaEngine
if you put the link in your browser it works
Tony Miri
@TonyMiri
Nov 16 2016 02:48
'Exact Change' help? Anybody?
makleriux
@makleriux
Nov 16 2016 02:48
@Manish-Giri ok i going to look for it
@Manish-Giri thank you
CamperBot
@camperbot
Nov 16 2016 02:49
makleriux sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 2281 | @manish-giri |http://www.freecodecamp.com/manish-giri
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 02:49
@FatTone225 Ask a question
Manish Giri
@Manish-Giri
Nov 16 2016 02:49
@makleriux welcome
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 02:51

@awb715 I'd look into Twitch's API documentation to see if there's something that the Twitch channel needs to do in order to be pulled. The error says No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s.codepen.io' is therefore not allowed access.

To me this reads as A required header is missing from the thing you're trying to make a request of. Due to this, the origin of the request is blocked.

You being the origin
Tony Miri
@TonyMiri
Nov 16 2016 02:52
@NicksIdeaEngine Well, It's kind of a complicated one, but basically my numbers aren't returning the way I would expect and I can't understand why. Specifically, for instance, in the last test case that FCC checks, my code returns the correct amount of twenties and tens, but skips over 5s and 1s and goes right down to quarters, dimes etc...
Here is my code.

function checkCashRegister(price, cash, cid) {

  var changeDue = cash - price;

  var drawerTotal = cid.reduce(function (first, second, index, array) { 
    return first + second[1];
  }, 0.0);

  if(drawerTotal == changeDue) {
    return "Closed";
  } else if (drawerTotal < changeDue) {
    return "Insufficient Funds";
  }

  var values = [
    ["PENNY",         0.01],
    ["NICKEL",        0.05],
    ["DIME",          0.10],
    ["QUARTER",       0.25],
    ["ONE",           1.00],
    ["FIVE",          5.00],
    ["TEN",          10.00],
    ["TWENTY",       20.00],
    ["ONE HUNDRED", 100.00]
  ];

  var change = cid.reduceRight(function(prev, current, index, array) {
    var changeTotal = 0.0;

    while (changeDue > 0 && current[1] > 0 && changeDue >= current[1]) {

      console.log(values[index]);
      console.log(array.indexOf(current));

      changeTotal += values[index][1];
      changeTotal = Math.round(changeTotal * 1000) / 1000;


      changeDue -= values[index][1];
      changeDue = Math.round(changeDue * 1000) / 1000;


      current[1] -= values[index][1];
      current[1] = Math.round(current[1] * 1000) / 1000;

    }
    if (changeTotal > 0.0) {
      prev.push([current[0], changeTotal]);
    } //while 
    return prev;

  }, []);//var change 
  console.log(change);
  return change;
}                                 



checkCashRegister(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);
I have console logged everything I could think of. This answer also skips over a test case completely that should return fifty cents in quarters. I have changed it around a lot and my brain is getting muddled, so I apologize if some of it doesn't make much logical sense.
johanna
@joehesse
Nov 16 2016 02:55
this is how im solving the celsius to fahrenheit var = (9/5)*celsius+32;
its not working
Walid Ashri
@walidashri
Nov 16 2016 02:56
@joehesse which var is that
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 02:56
@FatTone225 I'm looking it over meow. Bear with me.
Or bare. Your choice.
Tony Miri
@TonyMiri
Nov 16 2016 02:56
@NicksIdeaEngine I can comment it if you'd like?
Aaron Bell
@awb715
Nov 16 2016 02:56
anyone here up to the twitch ?
Tony Miri
@TonyMiri
Nov 16 2016 02:57
@awb715 Yeah what's up?
Justin Vernon
@Jvernz
Nov 16 2016 02:57
How can I create a random color generator in my quote generator project?
Walid Ashri
@walidashri
Nov 16 2016 02:57
@Jvernz use color array
Aaron Bell
@awb715
Nov 16 2016 02:57
@FatTone225 are you linking to the api or hard coding?
Justin Vernon
@Jvernz
Nov 16 2016 02:58
@walidashri good point thanks!
CamperBot
@camperbot
Nov 16 2016 02:58
jvernz sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 644 | @walidashri |http://www.freecodecamp.com/walidashri
Tony Miri
@TonyMiri
Nov 16 2016 02:58
@awb715 Hard coded an array of users and did Api calls for each user in the array
johanna
@joehesse
Nov 16 2016 02:58
@walidashri is the fahrenheit
Walid Ashri
@walidashri
Nov 16 2016 02:59
@joehesse ur code is not right var = (9/5)*celsius+32;
Aaron Bell
@awb715
Nov 16 2016 02:59
hmm
how did you call it?
@FatTone225
Manish Giri
@Manish-Giri
Nov 16 2016 02:59

@joehesse

 var = (9/5)*celsius+32;

you're missing the name of the variable where the result has to be assigned, in this case, that's fahrenheit

Aaron Bell
@awb715
Nov 16 2016 02:59
dont copy it
just wihich method?
Tony Miri
@TonyMiri
Nov 16 2016 02:59
$.getJSON
Manish Giri
@Manish-Giri
Nov 16 2016 03:00
@awb715 question about twitch?
Aaron Bell
@awb715
Nov 16 2016 03:00
ok ill try it again keep getting a cross origon error
Tony Miri
@TonyMiri
Nov 16 2016 03:00
@awb715 try adding the ?callback=? or whatever at the end of your url
it might be &callback=? for the twitch one
can't remember
johanna
@joehesse
Nov 16 2016 03:01
@Manish-Giri well before i write the variable and it says variable already specify
Aaron Bell
@awb715
Nov 16 2016 03:02
cool! that was the issue
thanks @FatTone225
CamperBot
@camperbot
Nov 16 2016 03:02
awb715 sends brownie points to @fattone225 :sparkles: :thumbsup: :sparkles:
:cookie: 393 | @fattone225 |http://www.freecodecamp.com/fattone225
Tony Miri
@TonyMiri
Nov 16 2016 03:02
No prob
Walid Ashri
@walidashri
Nov 16 2016 03:02
@joehesse use the name Fahrenheit= (9/5)*Celsius+32;
Manish Giri
@Manish-Giri
Nov 16 2016 03:02
@joehesse is var fahrenheit already setup for you? If so, then add the rest of your code to the right of this, with an = in between
that way you don't redefine the variable
Aaron Bell
@awb715
Nov 16 2016 03:05
its always a good feeling when you get the api working @FatTone225
johanna
@joehesse
Nov 16 2016 03:06
@walidashri thank you !it work i just dont understand why you have to skip the var !i will have to review the whole thing cuz im confuse !thanx @Manish-Giri as well
CamperBot
@camperbot
Nov 16 2016 03:06
joehesse sends brownie points to @walidashri and @manish-giri :sparkles: :thumbsup: :sparkles:
:cookie: 645 | @walidashri |http://www.freecodecamp.com/walidashri
:star2: 2282 | @manish-giri |http://www.freecodecamp.com/manish-giri
Tony Miri
@TonyMiri
Nov 16 2016 03:06
@awb715 It's a good feeling getting anything to work. lol. Coding just feels like bashing my head against a brick wall until it eventually crumbles
Aaron Bell
@awb715
Nov 16 2016 03:06
i wanna learn it so i can backpack and freelance while doing so @FatTone225
i enjoy it but you really need to surround yourself so you can get mentored
Tony Miri
@TonyMiri
Nov 16 2016 03:07
@awb715 Yeah that's an awesome idea. I'm still learning myself. Pretty much as far along as you are.
Aaron Bell
@awb715
Nov 16 2016 03:07
how long have you been goin for
@FatTone225
Tony Miri
@TonyMiri
Nov 16 2016 03:09
I started it last fall, but I put it down for a solid 10 months due to an unforgiving work schedule. But I just picked it up again about 2-3 weeks ago. So I've been dabbling in it for a while, but in fits and starts
Aaron Bell
@awb715
Nov 16 2016 03:09
what you do full time
im trying to avoid corporate ny and get job in this
Tony Miri
@TonyMiri
Nov 16 2016 03:09
Truck Driver for the past 3 years
Not exactly a mentally stimulating career lol
Aaron Bell
@awb715
Nov 16 2016 03:11
haha true
ivethought about doing a bootcamp
3 months of your life and change direction
Tony Miri
@TonyMiri
Nov 16 2016 03:12
Yeah. I suppose it works for some people, but it's expensive.
Aaron Bell
@awb715
Nov 16 2016 03:12
i wanted it to look like a buddy list but i kinda messed that up
Tony Miri
@TonyMiri
Nov 16 2016 03:12
@awb715 Looking good though. Keep tweaking it.
Aaron Bell
@awb715
Nov 16 2016 03:13
its nice and responsive
but the layout isnt great
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 03:18
@FatTone225 Still thinking through it. I think I'm close though
Tony Miri
@TonyMiri
Nov 16 2016 03:18
@NicksIdeaEngine Appreciate it. I'm looking too, but I dunno.
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 03:22
Your while loop never runs because changeDue >= current[1] is never true
Tony Miri
@TonyMiri
Nov 16 2016 03:23
Yep
I just saw it too lol
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 03:23
changeDue needs to compare against the values array somehow, not the total amount in the drawer
Tony Miri
@TonyMiri
Nov 16 2016 03:23
Right. I can't believe it. lol. Hours and hours. @NicksIdeaEngine Thank you.
CamperBot
@camperbot
Nov 16 2016 03:23
fattone225 sends brownie points to @nicksideaengine :sparkles: :thumbsup: :sparkles:
:cookie: 278 | @nicksideaengine |http://www.freecodecamp.com/nicksideaengine
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 03:24
Fo sho. Took me a sec. I wound up making an if (args){console.log("This statement is true");} for each test for the while loop
Tony Miri
@TonyMiri
Nov 16 2016 03:25
Can I see that?
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 03:26
Well, it didn't make the code work. It was just my way of testing each of the 3 conditions for the while loop. One moment
Tony Miri
@TonyMiri
Nov 16 2016 03:27
No I know. I was console logging inside the while loop. You got it in about 10-20 mins whereas I've been trying this for about 4 hours. J/w how you logged it
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 03:27
    if(changeDue > 0 ){console.log("changeDue > 0 is true");}
    if(current[1] > 0 ){console.log("current[1] > 0 is true");}
    if(changeDue >= current[i]){console.log("changeDue >= current[i] is true");}
I put that after var changeTotal = 0.0; before the while loop
Tony Miri
@TonyMiri
Nov 16 2016 03:28
Fixing that actually passes all the tests except for the one last 'gotcha' test they threw in there.
Ohhh I see. So you took each one of my test parameters and logged it out in a string of clear language lol
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 03:29
Yup. I gotta dumb it down for me, but it works.
Can you share the conditions you're running against it? I'd love to tinker and see what failed
Tony Miri
@TonyMiri
Nov 16 2016 03:30
I have the fix here. Just have to make provisions for the last one I was talking about. I really appreciate it man.
Yeah I can. It's the 'Exact Change' challenge, but I'll put em here
checkCashRegister(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]) should return an array.
checkCashRegister(19.50, 20.00, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]) should return a string.
checkCashRegister(19.50, 20.00, [["PENNY", 0.50], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]) should return a string.
checkCashRegister(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]) should return [["QUARTER", 0.50]].
checkCashRegister(3.26, 100.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]) should return [["TWENTY", 60.00], ["TEN", 20.00], ["FIVE", 15.00], ["ONE", 1.00], ["QUARTER", 0.50], ["DIME", 0.20], ["PENNY", 0.04]].
checkCashRegister(19.50, 20.00, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]) should return "Insufficient Funds".
checkCashRegister(19.50, 20.00, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1.00], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]) should return "Insufficient Funds".
checkCashRegister(19.50, 20.00, [["PENNY", 0.50], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]) should return "Closed".
Ryan McMahon
@Radio-Mac
Nov 16 2016 03:32
@Engineer-Kingdom No need to go through another for loop again. You already have the first name, all you need to do is check to make sure you have
contacts[x].hasOwnProperty(prop)
@Engineer-Kingdom Right now what you have is just going through the list once and then doing it again, you don't need to.
Ryan McMahon
@Radio-Mac
Nov 16 2016 03:39
Anyway, is there a better method for the "Confirm the ending" challenge?
function confirmEnding(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  return (str.substr(str.length - target.length, target.length) === target);
}
confirmEnding("Bastian", "n");
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:39
i have a problem
var oldArray = [1,2,3,4,5];

// Only change code below this line.

var newArray = oldArray;
newArray.map(function(val,i,arr) {
  return arr[i].push(val);
});
the point is to use the map function to add 3 to every value in the variable oldArray, and save the results into variable newArray. oldArray should not change.
what am i doing wrong?
Alan Barr
@alanmbarr
Nov 16 2016 03:41
Stas, could you try
var newArray = oldArray.map
and fill in the rest as you have it, just make sure that you are returning the right array
also is that you logic for adding 3?
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:43

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

// Only change code below this line.

var newArray = oldArray.map(function(val,i,arr) {
return arr[i].push(val);
});
```

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

// Only change code below this line.

var newArray = oldArray.map(function(val,i,arr) {
  return arr[i].push(val);
});
@alanmbarr yeah that's the logic for DDING 3
ФВВШТП*
adding*
Alan Barr
@alanmbarr
Nov 16 2016 03:44
where in that do you add?
Justin Pierson
@jpmitchellpierson
Nov 16 2016 03:44
@josephlo8318 thank you so much! i was working on that for hours and finally got it
CamperBot
@camperbot
Nov 16 2016 03:44
jpmitchellpierson sends brownie points to @josephlo8318 :sparkles: :thumbsup: :sparkles:
:cookie: 231 | @josephlo8318 |http://www.freecodecamp.com/josephlo8318
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:45
@alanmbarr when i return arr[i].push(val)
right?
Alan Barr
@alanmbarr
Nov 16 2016 03:45
I'm not sure can you explain it to me?
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:45
or should i come up with some other variable
Alan Barr
@alanmbarr
Nov 16 2016 03:46
so map does an action on each item of an array
so you want to return that value but altered
you do not need to use another outside array to manage the process
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:49
@alanmbarr i still don't get it
map takes an array of ingredients and applies a function chop to all the items
at the end you get your sandwich
if you wanted to add instead of chop how would you approach it?
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:51
@alanmbarr by using the push() method?
Alan Barr
@alanmbarr
Nov 16 2016 03:52
without push
Aaron
@apalm1341
Nov 16 2016 03:52
hey all...who is really good with javascript here?
could use some help
send me private message if u apply to this
Alan Barr
@alanmbarr
Nov 16 2016 03:53
Stas you will need to use return and do something to the element
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:53
@alanmbarr i don't know, push is the only method so far that comes to mind
Moisés Man
@moigithub
Nov 16 2016 03:53
return n+10
u only need to work with the value.. not the index nor the array
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:54
@alanmbarr so i will return arr[i] and then something for this element?
Alan Barr
@alanmbarr
Nov 16 2016 03:57
forget the arr stuff
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:58
@alanmbarr arr[val] then?
@alanmbarr lol i figured
it's val+=3;
@alanmbarr thanks man
CamperBot
@camperbot
Nov 16 2016 04:01
stasvitvitskiy sends brownie points to @alanmbarr :sparkles: :thumbsup: :sparkles:
:cookie: 336 | @alanmbarr |http://www.freecodecamp.com/alanmbarr
gandledorf
@gandledorf
Nov 16 2016 04:05
var myList = [["stuff",1],["stuff",2],["stuff",3],["stuff",4],["stuff",5],"stuff",6]; help
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:06
@gandledorf what do you need help with?
1Elral4
@1Elral4
Nov 16 2016 04:07
hey campers, anybody knows why geolocation is not working in codepen? Can you give me a hint or tip, thank you. (LOCAL WEATHER)
gandledorf
@gandledorf
Nov 16 2016 04:08
@Lumexralph im supposed to create a multidimensional shopping list, and im not sure whats wrong @Lumexralph
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:09
@gandledorf it looks two dimension array to me
gandledorf
@gandledorf
Nov 16 2016 04:10
@Lumexralph im not good with arrays, sohow would i implement a third dimension
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:12
@gandledorf i don't know what you're to do exactly, do you have data you're to create arrays with or ?
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:12
hey guys
how can i skip
( in a regex ?
thomascarpenter21
@thomascarpenter21
Nov 16 2016 04:15
need help...im a super nub to java script. Can someone show me how to write "a should have a value 7, b should have a value of 7, a should be assigned to b with ="
gandledorf
@gandledorf
Nov 16 2016 04:16
@Lumexralph the challenge is to make a list containing 5 sub-arrays
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:16
@Lumexralph any idea ?
gandledorf
@gandledorf
Nov 16 2016 04:16
@Lumexralph with data that i have to put in
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:16
@BahaaZidan \(
@gandledorf okay, you create an empty array
gandledorf
@gandledorf
Nov 16 2016 04:18
@Lumexralph okay
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:18
@gandledorf i don't know which form you have your data.......you can use a loop...
pick each data, put it in another empty array in the loop and push that into the empty array outside the loop
i don't have complete information of how you'll get the data to pass to the array
but that should simply create a 2 dimensional array
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:21
thanks alot m8 @Lumexralph
CamperBot
@camperbot
Nov 16 2016 04:21
bahaazidan sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 450 | @lumexralph |http://www.freecodecamp.com/lumexralph
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:21
i appreciate it
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:21
@BahaaZidan :+1:
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:24
@Lumexralph how can i target space in my regex ?
Jenky W. Nolasco
@jenkynolasco11
Nov 16 2016 04:25
@BahaaZidan '\ ' <--- without quotes, or just space
\s also applies
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:27
@BahaaZidan \s just like @jenkynolasco11 said
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:27
  var verify2 = str.match(/(\()([0-9])([0-9])([0-9])(\))(\s)([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
telephoneCheck("(555) 555-5555");
it says null
what did i miss ?
Greg Duncan
@GregatGit
Nov 16 2016 04:29
@BahaaZidan
\s    
Matches a single white space character, including space, tab, form feed, line feed. Equivalent to [ \f\n\r\t\v\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff].

For example, /\s\w*/ matches ' bar' in "foo bar."

\S    
Matches a single character other than white space. Equivalent to [^ \f\n\r\t\v\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff].

For example, /\S\w*/ matches 'foo' in "foo bar."
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:32
thanks , but what is wrong with my previous code ?
Greg Duncan
@GregatGit
Nov 16 2016 04:34
@BahaaZidan what are you trying to do?
Micah Lewis
@EastML
Nov 16 2016 04:36
Trying to push a word if the first letter isn't a vowel. Am I missing something in my code?
function translatePigLatin(str) {
  var con = [];
  var vowel = ["a", "e", "i", "o", "u"];

  for(var i = 0; i < vowel.length; i++) {
    if (str.indexOf(i) === 0) {
      con.push(str + "way");
    }
  }
  return con;
}

translatePigLatin("apple");
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:36
im trying to make it match this style (555) 555-5555
and only this style specificly
Alan Barr
@alanmbarr
Nov 16 2016 04:36
are you assigning that to str?
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:36
and note the space
Alan Barr
@alanmbarr
Nov 16 2016 04:38
Micah you are using the index of the number of the vowel instead of the vowel itself?
MCess
@MCess
Nov 16 2016 04:38
Hi I'm having trouble with "Find the Longest Word in a String"
function findLongestWord(str) {

   var splitStrings = str.split(" ");
var longWord = 0;
  for(var i = 0; i < splitStrings.length; i++){
    if(splitStrings[i].length > longWord){
    longWord = splitStrings[i].length;
    }
     }
  return str.length;
}

findLongestWord("The quick brown fox jumped over the lazy dog");
Ken Haduch
@khaduch
Nov 16 2016 04:39
@MCess - looks like you are returning str.length, which is the length of the string... you might want to be returning a different value?
Greg Duncan
@GregatGit
Nov 16 2016 04:39
@BahaaZidan match returns an array - if it worked the way you wanted what would the return array be?
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:39
it now returns null
Greg Duncan
@GregatGit
Nov 16 2016 04:40
if it worked
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:40
when it works it return an array containing the whole match in the 1st index and the letters in the follwing indexes
Micah Lewis
@EastML
Nov 16 2016 04:40
Thanks @alanmbarr . I can't believe I missed that. very embarrassing .
CamperBot
@camperbot
Nov 16 2016 04:40
eastml sends brownie points to @alanmbarr :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @alanmbarr |http://www.freecodecamp.com/alanmbarr
Micah Lewis
@EastML
Nov 16 2016 04:41
Anywho, thanks for the eagle eye.
Damien
@kingdame
Nov 16 2016 04:41
Am i doing something wrong??

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

}

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

// Change this value to test
testSize(7);

Greg Duncan
@GregatGit
Nov 16 2016 04:42

@BahaaZidan try doing it this way

var str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
var regexp = /[A-E]/gi;
var matches_array = str.match(regexp);

console.log(matches_array);
// ['A', 'B', 'C', 'D', 'E', 'a', 'b', 'c', 'd', 'e']

replace it with your data

Micah Lewis
@EastML
Nov 16 2016 04:42
Damien, what are you trying to do?
MCess
@MCess
Nov 16 2016 04:43
@khaduch Isn't it asking me to find the length though?
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:43
@GregatGit thanks m8
CamperBot
@camperbot
Nov 16 2016 04:43
bahaazidan sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 787 | @gregatgit |http://www.freecodecamp.com/gregatgit
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:43
the problem was not with the regex
leithemaster
@leithemaster
Nov 16 2016 04:44
Hello world
CamperBot
@camperbot
Nov 16 2016 04:44

welcome to FreeCodeCamp @leithemaster!

bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:44
im so stupid that i was applying a different verify function
Ken Haduch
@khaduch
Nov 16 2016 04:44
@MCess - the length of what? What is it asking you to return? Probably not the length of the input string, but the length of something else that you are computing...
Bibek Gautam
@bibek22
Nov 16 2016 04:45
function checkGreater(num, sym1, sym2, sym3, value) {
    if (num < value - 1) {
        return sym1.repeat(num);
    }
    else if ( num === value -1 ) {
        return sym1+sym2;
    }
    else if (num === value ){
        return sym2;
    }
    else if (num !== 2*value -1){
        return sym2+sym1.repeat(num-value);
    }
    else {
        return sym1+sym3;
    }
}

function convertToRoman(num) {
  var thousands = Math.floor(num / 1000);
  var hundreds = Math.floor(num%1000/100);
  var tens = Math.floor(num%100/10);
  var ones = Math.floor(num%10);
  console.log(thousands, hundreds, tens, ones);
  var romanNumeral = "";
  romanNumeral += "M".repeat(thousands);
  romanNumeral += checkGreater(hundreds, "C", "D", "M", 5);
  romanNumeral += checkGreater(tens, "X", "L", "C", 5);
  romanNumeral += checkGreater(ones, "I", "V", 'X', 5);
 return romanNumeral;
}
convertToRoman(1920);
Derrick
@dottDesign
Nov 16 2016 04:45
Hey all, any chance with a little help? stuck on a step
Bibek Gautam
@bibek22
Nov 16 2016 04:45
so i didn't use any of the methods hinted on the page
Greg Duncan
@GregatGit
Nov 16 2016 04:45
@BahaaZidan try to use mozilla and get used to reading their documentation. It's hard at first but will be worth it in the long run
Derrick
@dottDesign
Nov 16 2016 04:46

var myVar = 87;

// Only change code below this line
myVar = ++myVar;

says myVar = myVar + 1; needs to be changed and I did but not allowing me to move on

Bibek Gautam
@bibek22
Nov 16 2016 04:46
anyone that have used the hinted methods to solve it?
i'd like to see how you've done it.
Derrick
@dottDesign
Nov 16 2016 04:47
you referring to me @bibek22
I changed it to: myVar = ++myVar;
Bibek Gautam
@bibek22
Nov 16 2016 04:48
@dottDesign hmm nope. i was talking about my problem
Derrick
@dottDesign
Nov 16 2016 04:48
;) okie
Bibek Gautam
@bibek22
Nov 16 2016 04:48
@dottDesign it's myVar += 1
that's the syntax if you're trying to increment it
Logan Sinclair
@LoganS1
Nov 16 2016 04:49
@bibek22 stole the words right out of my mouth
Bibek Gautam
@bibek22
Nov 16 2016 04:49
@LoganS1 ;)
Derrick
@dottDesign
Nov 16 2016 04:50
@bibek22 I need to use the ++ operator though
Bibek Gautam
@bibek22
Nov 16 2016 04:50
@dottDesign myVarr++
Logan Sinclair
@LoganS1
Nov 16 2016 04:50
@dottDesign ok do myVar = myVar++
as the ++ always goes at the end
same for the --
@bibek22 solution is probably the best syntax though as it is short and simple, although I can't remember is the lesson wanted you to right it out
Derrick
@dottDesign
Nov 16 2016 04:52
still not passing. says myVar still equals 87. I googled and others have the same issue but admins insist its not an issue
Logan Sinclair
@LoganS1
Nov 16 2016 04:53
what lesson is it exactly?
Doug
@doug20000
Nov 16 2016 04:54
Could somebody lend me a hand with the lesson Accessing Objects Properties with Variables ?
Logan Sinclair
@LoganS1
Nov 16 2016 04:54

Could someone look at my code? I am on the "Record Collection" Lesson and don't understand why it does not work.


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

  }else if(prop !== 'tracks'){
    collection[id][prop] = value;

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

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


  return collection;
}


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

The lesson is one with many specs so you may have to look at the lesson page...

Derrick
@dottDesign
Nov 16 2016 04:54
increment-a-number-with-javascrip
KSV
@vicmania2007
Nov 16 2016 04:55
for the challenge "Convert the given number into a roman numeral", is this the best way to do this??
Logan Sinclair
@LoganS1
Nov 16 2016 04:56
@dottDesign The answer is litterally just
```
myVar++;
```
did you forget the semicolon?
KSV
@vicmania2007
Nov 16 2016 04:56

'function convertToRoman(num) {
var numStr = num.toString();
var arrStr = numStr.split("");

var map = new Map();
map.set('1', 'I');
map.set('2', 'II');
map.set('3', 'III');
map.set('4', 'IV');
map.set('5', 'V');
map.set('6', 'VI');
map.set('7', 'VII');
map.set('8', 'VIII');
map.set('9', 'IX');

map.set('10', 'X');
map.set('20', 'XX');
map.set('30', 'XXX');
map.set('40', 'XL');
map.set('50', 'L');
map.set('60', 'LX');
map.set('70', 'LXX');
map.set('80', 'LXXX');
map.set('90', 'XC');

map.set('100', 'C');
map.set('200', 'CC');
map.set('300', 'CCC');
map.set('400', 'CD');
map.set('500', 'D');
map.set('600', 'DC');
map.set('700', 'DCC');
map.set('800', 'DCCC');
map.set('900', 'CM');

map.set('1000', 'M');
map.set('2000', 'MM');
map.set('3000', 'MMM');
map.set('4000', 'MMMN');

var multOfTens = ['1','10', '100','1000'];
var len = arrStr.length;

var romanNum = '';
var i = len-1;
var j = 0;
while(i >= 0 && j < len) {

var temp = parseInt(arrStr[i], 10) * multOfTens[j]; // 1. 0 * 1, 0 * 10, 0 * 100, 1 * 1000
if(temp !== 0) {
  romanNum = map.get(temp.toString()) + romanNum;
}
i--;
j++;

}

return romanNum;
}

convertToRoman(36);'

Derrick
@dottDesign
Nov 16 2016 04:56
serisously!! :) thanks @LoganS1
CamperBot
@camperbot
Nov 16 2016 04:56
dottdesign sends brownie points to @logans1 :sparkles: :thumbsup: :sparkles:
:cookie: 216 | @logans1 |http://www.freecodecamp.com/logans1
Derrick
@dottDesign
Nov 16 2016 04:57
nope didnt forget was just making it myVar = ++myVar;
Aarya Bhorra
@aarya1302
Nov 16 2016 04:57
@vicmania2007 I did something a little shorter
You can use lookup objects and then check if the value is smaller or greater
function convertToRoman(num) {
  var lookup = {M:1000,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1};
  var roman = '';
  var i;
  for( i in lookup){
    while(num >= lookup[i]){
      roman += i;
      num -= lookup[i];
    }
  }
  return roman;
}
convertToRoman(3);
Doug
@doug20000
Nov 16 2016 05:00
could someone lend me a hand with the lesson Accessing Objects Properties with Variables ?
Aarya Bhorra
@aarya1302
Nov 16 2016 05:01
@doug20000 what is your problem?/
Doug
@doug20000
Nov 16 2016 05:01

@aarya1302 Ive entered code as such and don't understand what is wrong/ what the lesson is asking for

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

// Only change code below this line;

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

Ken Haduch
@khaduch
Nov 16 2016 05:02
@LoganS1 - when you are accessing the collection, you generally are using collection[id] and collection[id][prop] which is good. For the .hasOwnProperty() you are not doing that anymore - collection[id] gives you a handle to an individual collection object - you need to use that And then when you are doing thiscollection[id].push(prop); I don't think that will work, because collection[id] is an object, and you are doing a .push() which is an array method. You just need to add a property in the same way that you are doing it when you are just putting a value into a collection[id][prop].
JackVizl
@JackVizl
Nov 16 2016 05:02

function translatePigLatin(str) {

  arrVowels="aeiou";

  arr=str.split("");
  var pos;
  var newStrArr=[];
  var found=false;


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

  if(arrVowels.indexOf(arr[i])!==-1){

    pos=i;
    break;
  }
}

  newStrArr.push(arr.slice(0, i)+"ay");
  newStrArr.unshift(arr.slice(i, arr.length));

  newStrArr=newStrArr.join("");

  return newStrArr.replace(/,/g, "");
  }else{
    return str+"way";
  }

}



translatePigLatin("algorithm");
Aarya Bhorra
@aarya1302
Nov 16 2016 05:03
@doug20000 instead of 16 put this [player]
JackVizl
@JackVizl
Nov 16 2016 05:03
Can someone tell me why there end up being lots of ',' characters in newStrArr?
Aarya Bhorra
@aarya1302
Nov 16 2016 05:03
Because they are telling you to access the property through a variable not the actual property
var player = testObj[player];
It should look like this @doug20000
Doug
@doug20000
Nov 16 2016 05:06
@aarya1302 it still doesn't seem to be working for me
KSV
@vicmania2007
Nov 16 2016 05:06
@aarya1302 thanks..I knew my version sucked..Sleep has fuckd my brains..Glad i was able to come up with some solution.
CamperBot
@camperbot
Nov 16 2016 05:06
vicmania2007 sends brownie points to @aarya1302 :sparkles: :thumbsup: :sparkles:
:cookie: 276 | @aarya1302 |http://www.freecodecamp.com/aarya1302
Aaron
@apalm1341
Nov 16 2016 05:06
can someone that has good javascript knowledge send me private message?
need help...would appreciate it
Aarya Bhorra
@aarya1302
Nov 16 2016 05:07
@doug20000 send me your code again
Tony Miri
@TonyMiri
Nov 16 2016 05:07
@apalm1341 What are you working on?
Doug
@doug20000
Nov 16 2016 05:08

@aarya1302 This is what I'm trying now

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

// Only change code below this line;

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

Aarya Bhorra
@aarya1302
Nov 16 2016 05:08
@doug20000 your code should look like this:
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber = 16;       // Change this Line
var player = testObj[playerNumber];
console.log(player);// Change this Line
They are telling you to find the property 16 with the variable playerNumber
Doug
@doug20000
Nov 16 2016 05:10
@aarya1302 ah ha, yes that worked. thank you
CamperBot
@camperbot
Nov 16 2016 05:10
doug20000 sends brownie points to @aarya1302 :sparkles: :thumbsup: :sparkles:
:cookie: 277 | @aarya1302 |http://www.freecodecamp.com/aarya1302
Aarya Bhorra
@aarya1302
Nov 16 2016 05:10
You're welcome
KSV
@vicmania2007
Nov 16 2016 05:10
@aarya1302 but performance wise, in your solution you are traversing all the keys of the object..
if the number is really high, then your solution wont be optimum..correct me if i m wrong!
Aarya Bhorra
@aarya1302
Nov 16 2016 05:12
No you're quite right
@vicmania2007
Mine sucks too
KSV
@vicmania2007
Nov 16 2016 05:13
mine is verbose, but u are accessing only the length of the number
but space complexity s high...
ms
@mkshcode
Nov 16 2016 05:14

hey guys,

what am I doing wrong here? o:

var myStr ="FirstLine\n\SecondLine\n\rThirdLine";

KSV
@vicmania2007
Nov 16 2016 05:14
@mkshcode var myStr ="FirstLine\nSecondLine\n\rThirdLine";
Will
@Will-is-Coding
Nov 16 2016 05:15
@mkshcode put your code between ` marks as \ are escaped here as well
Also recall you need a \ after SecondLine
Logan Sinclair
@LoganS1
Nov 16 2016 05:16
thanks @khaduch but it still fails. I will ask again in a little. I am off to do some more google research :worried:
CamperBot
@camperbot
Nov 16 2016 05:16
logans1 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1936 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
Nov 16 2016 05:17
@LoganS1 - want to post your code again - there might have been some other subtle problems... but I'm going to sign off for now, so it would be good for you to work on it and someone here will be able to help, most likely... good luck!
ms
@mkshcode
Nov 16 2016 05:18
@Will-is-Coding var myStr ='FirstLine\n\SecondLine\n\rThirdLine';
@Will-is-Coding i'm still a bit lost as to what you mean. hhaha sorry
Ayush Bahuguna
@relentless-coder
Nov 16 2016 05:18
can anyone here help me with record collection challenge?
Will
@Will-is-Coding
Nov 16 2016 05:18
This is a line of code Here's how you should type it `Like this`
ms
@mkshcode
Nov 16 2016 05:18
@Will-is-Coding var myStr ='FirstLine\n\SecondLine\n\rThirdLine';
Ayush Bahuguna
@relentless-coder
Nov 16 2016 05:19
if(prop !== "tracks" && value !== "") { collection[id][prop] = value; } else if( prop === "tracks" && collection.hasOwnProperty("tracks") === false) { collection[id].tracks = []; collection[id].tracks.push(value); } else if(prop === "tracks" && value !== "") { collection[id].tracks.push(value); } else if(value === "") { delete collection[id][prop]; }
Ken Haduch
@khaduch
Nov 16 2016 05:19
@mkshcode - to post code so that the browser will not interpret special characters, use the markdown posting sequence - see the next post
'''
CamperBot
@camperbot
Nov 16 2016 05:19
:bulb: to format code use backticks! ``` more info
Will
@Will-is-Coding
Nov 16 2016 05:19
It's the backtick, not the quote. It's below Esc key, left of 1 if you're on a QWERTY keyboard
Ayush Bahuguna
@relentless-coder
Nov 16 2016 05:19
``
if(prop !== "tracks" && value !== "") { collection[id][prop] = value; } else if( prop === "tracks" && collection.hasOwnProperty("tracks") === false) { collection[id].tracks = []; collection[id].tracks.push(value); } else if(prop === "tracks" && value !== "") { collection[id].tracks.push(value); } else if(value === "") { delete collection[id][prop]; }
Ken Haduch
@khaduch
Nov 16 2016 05:20
@relentless-coder you always have to use collection[id] anytime you are doing anything with an object in the collection, that's one thing that you are missing in the test with .hasOwnProperty()
Ayush Bahuguna
@relentless-coder
Nov 16 2016 05:21
oh, yes. Typo error.
Logan Sinclair
@LoganS1
Nov 16 2016 05:22

I used the wiki for one of the challenges and I saw there was a way to give thanks so here it is

Thanks @leftynaut @DarrenJansen for your help with Checkpoint: Record Collection

CamperBot
@camperbot
Nov 16 2016 05:22
logans1 sends brownie points to @leftynaut and @darrenjansen :sparkles: :thumbsup: :sparkles:
:cookie: 281 | @darrenjansen |http://www.freecodecamp.com/darrenjansen
:cookie: 578 | @leftynaut |http://www.freecodecamp.com/leftynaut
ms
@mkshcode
Nov 16 2016 05:24

@Will-is-Coding ah thank you for that! even with backticks though
i seem to be getting the "myStr should have encoded text with the proper escape sequences and no spacing." part off

here is what I have now:

var myStr = FirstLine\n\SecondLine\\n\rThirdLine\\;

CamperBot
@camperbot
Nov 16 2016 05:24
:cookie: 478 | @will-is-coding |http://www.freecodecamp.com/will-is-coding
mkshcode sends brownie points to @will-is-coding :sparkles: :thumbsup: :sparkles:
Anthony Torres
@ATorresDev
Nov 16 2016 05:24
Can anyone help me with the counting cards challenge
Aarya Bhorra
@aarya1302
Nov 16 2016 05:28
what's your code? @ATorresDev
Will
@Will-is-Coding
Nov 16 2016 05:28

@mkshcode But the output should look like

FirstLine
\SecondLine\
ThirdLine

Does your line look right?

Anthony Torres
@ATorresDev
Nov 16 2016 05:30

var count = 0;

function cc(card) {
// Only change code below this line
switch(card){
case 2,3,4,5,6:
count++;
return "5 Bet";
case 7,8,9:
return "0 Hold";
case 10,'J','Q','K','A':
count--;
return "-5 Hold";
default:
if(count > 0){
return "1 Bet";
} else if (count < 0){
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(3); cc(7); cc('Q'); cc(8); cc('A');

im just...stuck i know the end on my code is wrong,but im just not sure
Aaron
@apalm1341
Nov 16 2016 05:32
anyone who is really good with javascript...could u plz send me private message
need help
thx would appreciate it
Will
@Will-is-Coding
Nov 16 2016 05:32
@mkshcode Your code right now outputs this:
FirstLine
SecondLine\nThirdLine\
You could just post here too @apalm1341 Unless it's that lengthy
Aaron
@apalm1341
Nov 16 2016 05:33
@Will-is-Coding it is that lengthy
Abhisek Pattnaik
@abhisekp
Nov 16 2016 05:33
@apalm1341 you may use http://gist.github.com or http://hastebin.com ;)
Will
@Will-is-Coding
Nov 16 2016 05:34
Oh well you can shoot me a PM if you like, I may be able to help - or try lol
Aaron
@apalm1341
Nov 16 2016 05:35
@abhisekp what r those?
Abhisek Pattnaik
@abhisekp
Nov 16 2016 05:36
@apalm1341 for large number of lines of code, use those sites for sharing code
Anthony Torres
@ATorresDev
Nov 16 2016 05:40
nvm figured it out
Aaron
@apalm1341
Nov 16 2016 05:45
I want a pop up box to display when the sprite/image/player has reached end of level saying that you as the player won
so a little screen that appears on top of game
```js
// Write event handlers to respond hook into behaviors. ...new line of copied code starts here!
    // hit.sprite is called everytime the player collides with a sprite
    this.on("hit.sprite",function(collision) {
      // Check the collision, if it's the Tower, you win!
      if(collision.obj.isA("tower")) {
        // Stage the endGame scene above the current stage
        //alert('You win!);
        Q.stageScene("endGame",1, { label: "You Won!" }); //alert here!tower=door!
        //alert('You win!);
        // Remove the player to prevent them from moving
        this.destroy();
      }
    });
  }
});  

// Sprites can be simple, the Tower sprite just sets a custom sprite sheet
Q.Sprite.extend("Tower", {
  init: function(p) {
    this._super(p, { sheet: 'tower' });
  }
});
```
this code above is not working for what I want to do
any ideas?
Adam Kaplan
@rlkap1
Nov 16 2016 05:53
function updateRecords(id, prop, value) {
  if (value === "") {
    delete collection[id][prop];
  }
  else if (prop === "tracks") {
    if (collection[id].hasOwnProperty("tracks") === false){
      collection[id][prop] = "";
    }
    collection[id][prop].push(value);
  }
  else {
      collection[id][prop] = value;
  }
  return collection;
}
it wont create the tracks property if there isnt one
Dumdumdev
@jel111
Nov 16 2016 05:54
Nesting For Loops I need A HINT PLEASE

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

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

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
zack
@acting2332
Nov 16 2016 05:58
heyy guy so i am tired haha and i dont even know where to start on global scope and functions i been doing great till this point and now my mind has froze
sned help?
send
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 06:05
hey guys
function factorialize(num) {
  var count = 1;
  for(var i = 1; i <= num; i++) {
    return count*=i;
  }
  return num;

}

factorialize(5);
what am i doing wrong here?
Joseph
@revisualize
Nov 16 2016 06:08
@jel111 What is j for?
@StasVitvitskiy I recommend using www.pythontutor.com/javascript.html to visualize your code execution.
智轩
@zhixuanziben
Nov 16 2016 06:09
@StasVitvitskiy return num is wrong
Joseph
@revisualize
Nov 16 2016 06:10
I just saw that.
editing count. Return Count.
智轩
@zhixuanziben
Nov 16 2016 06:11
You should return count
Benjmhart
@Benjmhart
Nov 16 2016 06:13
hey can anyone help? i tried to set up an onclick event to jump a variable and button content back and forth but it only seems to toggle once.
Manish Giri
@Manish-Giri
Nov 16 2016 06:21

@Benjmhart shouldn't this

 if (measure="Celcius"){

be

 if (measure=="Celcius"){
and same for this
 if (measure = "Farenheit"){
Benjmhart
@Benjmhart
Nov 16 2016 06:22
ah!
thank you
still getting a grip on when to uuse comparison operators
doesn't seem to fix the issue
Eric K
@EricK425
Nov 16 2016 06:23

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


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

}

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Kristian", "lastName");
can someone please tell me why this wont work? If i take away the if else statement for no such contact it satisfies 4 of the 5 conditions but when I add it in it doesnt work for the bob statement however when I take away the other statement the bob statement will return the correct value.. im lost ive been on this one for hours now. I have no idea what could be wrong. I satisfy either the first 3 conditions with the first statement and the others gone, or the last two conditions with the first statement gone and the other if statements there
Kher Je
@kherrjee
Nov 16 2016 06:27
@EricK425 i'd suggest you used switch case
*use
Eric K
@EricK425
Nov 16 2016 06:28
@kherrjee I don't think that is a better method. There's something going on behind the scenes that I can't figure out. THanks for the advice though
CamperBot
@camperbot
Nov 16 2016 06:28
erick425 sends brownie points to @kherrjee :sparkles: :thumbsup: :sparkles:
:cookie: 154 | @kherrjee |http://www.freecodecamp.com/kherrjee
Logan Sinclair
@LoganS1
Nov 16 2016 06:28
I am on the same lesson as @EricK425 however I might have over complicated things... Could someone help with my code? Here is is...

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


function lookUpProfile(firstName, prop){
// Only change code below this line
  //function to validate firstName
function validatefirstname(firstName){
  for(var i = 0; i < contacts.length; i++){
    if(contacts[i].firstName === firstName){
     return true; 
    }else if(i == (contacts.length - 1)){
      return false;
    }
  }
  //function to validate prop
  function validateproperty(prop){
    for(var i = 0; i < contacts.length; i++){
     for(var o = 0; 0 < contacts[i].length; o++){
       if(contacts[i][o] === prop){
         return true;
       }else if(i < (contacts.length - 1) && o < (contacts.length - 1)){
         return false;
       }
     }
  }
  }
  //actual checker
    if (validatefirstname(firstName) === false){
      return "no such contact";
    }else if (validateproperty(prop) === false){
      return "no such property";
    }else{
      return contacts[firstName][prop];
    }
}

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
Eric K
@EricK425
Nov 16 2016 06:29
@kherrjee switch case would take lots of lines of code and I can get this down in maybe 6-10 lines
Benjmhart
@Benjmhart
Nov 16 2016 06:30
fixed it by turning it back into an if/else statement
Eric K
@EricK425
Nov 16 2016 06:30
@LoganS1 Yeah if I were you I would try to only use the function that they provide you.. just my 2 cents
Logan Sinclair
@LoganS1
Nov 16 2016 06:32
I think I am going to scrap :fire: my current code remake it tomorrow. Also, yes I think I'll do that next time @EricK425 Didn't realize how complicating it was getting till I had created it.
Eric K
@EricK425
Nov 16 2016 06:33
@LoganS1 yeah this challenge is really making me rip my hair out.. not the challenge itself but how my code will satisify all of the conditions but at different times depending on which if statemnets i leave in
Joseph
@revisualize
Nov 16 2016 06:33
@LoganS1 You are over complicating it.
Eric K
@EricK425
Nov 16 2016 06:34
@revisualize Joseph can you please look at mine and see why it satifies all of the conditions when some of the if statements are there but not all 5 at once when I have all of them there
Joseph
@revisualize
Nov 16 2016 06:35
@EricK425 5 ifs?
@EricK425 For?
@EricK425 Oh. I see your code.
@EricK425 Can I ask you a side question?
Eric K
@EricK425
Nov 16 2016 06:36
@revisualize What I mean to say is if I keep the first if statement and comment out the other 2, it satisfies the first 3 conditions of the challenge. conversely if I comment out the first if statement the last 2 conditions of the challenge are satisfied.. if I comment out the bob no such property if statement. 4 of the 5 are satisfied
@revisualize yeah whats up
bahaa aldin
@bahaa-al-deen
Nov 16 2016 06:36
@EricK425
/*
10 or 10+1(country code)
1 555-555-5555
1(555)555-5555
1 (555) 555-5555
1 555 555 5555
*/
function telephoneCheck(str) {
  var verify = str.match(/([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify1 = str.match(/(\()([0-9])([0-9])([0-9])(\))([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify2 = str.match(/(\()([0-9])([0-9])([0-9])(\))(\ )([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify3 = str.match(/([0-9])([0-9])([0-9])(\ )([0-9])([0-9])([0-9])(\ )([0-9])([0-9])([0-9])([0-9])/);
  var verify4 = str.match(/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])/);
  var verify5 = str.match(/(1)(\ )([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify6 = str.match(/(1)(\()([0-9])([0-9])([0-9])(\))([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify7 = str.match(/(1)(\ )(\()([0-9])([0-9])([0-9])(\))(\ )([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify8 = str.match(/(1)(\ )([0-9])([0-9])([0-9])(\ )([0-9])([0-9])([0-9])(\ )([0-9])([0-9])([0-9])([0-9])/);
  var verify9 = str.match(/(1)([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])/);

  if (verify[0] === str || verify1[0] === str || verify2[0] === str || verify3[0] === str || verify4[0] === str || verify5[0] === str || verify6[0] === str || verify7[0] === str || verify8[0] === str || verify9[0] === str) {
    return true;
  } else {return false;}


  //return verify9[0] === str;
}



telephoneCheck("15555555555");
Joseph
@revisualize
Nov 16 2016 06:37
@EricK425 Let's say you were at a big business event and throughout the event you got handed 200 business cards. Now, I walk up to you at the end and ask you.. Do you have a Business Card for "Jane Smith"? Now you loop look through your stack of 200 business cards. When would you tell me that you didn't have a business card for Jane?
bahaa aldin
@bahaa-al-deen
Nov 16 2016 06:37
@revisualize
@revisualize my wifi got disconnected
i was not spamming
Eric K
@EricK425
Nov 16 2016 06:38
@revisualize when I got to the end
Joseph
@revisualize
Nov 16 2016 06:38
You posted twice. Can you delete one?
@EricK425 Great!
@EricK425 Why aren't you doing that?
bahaa aldin
@bahaa-al-deen
Nov 16 2016 06:38
ok , i just thought that it never got posted
Joseph
@revisualize
Nov 16 2016 06:38
@BahaaZidan Thanks.
CamperBot
@camperbot
Nov 16 2016 06:38
revisualize sends brownie points to @bahaazidan :sparkles: :thumbsup: :sparkles:
:cookie: 288 | @bahaazidan |http://www.freecodecamp.com/bahaazidan
Eric K
@EricK425
Nov 16 2016 06:39
@revisualize I think Im catching what youre saying.. brb
bahaa aldin
@bahaa-al-deen
Nov 16 2016 06:39
type error :: cannot read property 0 if null
i know that the problem is that the first test verify[0] is returning null since there's no match for the pattern
but that's why i put an ||
in order to make it return true when only one of the tests is returning the matched pattern
Markus Kiili
@Masd925
Nov 16 2016 06:41
@BahaaZidan Match returns null if there were no matches.
bahaa aldin
@bahaa-al-deen
Nov 16 2016 06:41
i know that
how can i find a way through this
i tested all the patterns individually though
they're functional
Joseph
@revisualize
Nov 16 2016 06:42
@EricK425 Change it yet?
It should be just moving a few lines of code around.
Markus Kiili
@Masd925
Nov 16 2016 06:43
@BahaaZidan You could make a null test if(arr!==null && arr[0]...)
bahaa aldin
@bahaa-al-deen
Nov 16 2016 06:44
thanks
ill try it and brb
Eric K
@EricK425
Nov 16 2016 06:45
@revisualize Joseph
Joseph
@revisualize
Nov 16 2016 06:45
Sup?
Eric K
@EricK425
Nov 16 2016 06:45
@revisualize I just would like to say..
@revisualize youre a freaking godsend
@revisualize You've helped me like 5 times now lol, I got it bc of that riddle/hint thanks
CamperBot
@camperbot
Nov 16 2016 06:46
erick425 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2316 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 16 2016 06:46
@EricK425 What's your function look like now?
Eric K
@EricK425
Nov 16 2016 06:46
function lookUpProfile(firstName, prop) {
// Only change code below this line
for (i = 0; i < contacts.length; i++) {
  if (contacts[i].firstName==firstName && contacts[i].hasOwnProperty(prop))   {
    return contacts[i][prop];    
  }
  else if (contacts[i].hasOwnProperty(prop)===false) 
  {  
    return "No such property";
  }

}
   if (contacts.firstName!==firstName) 
  {
    return "No such contact";
  }

// Only change code above this line
}
Joseph
@revisualize
Nov 16 2016 06:46
@EricK425 It is a question to change your logic.

@EricK425 Change this:

   if (contacts.firstName!==firstName) 
  {
    return "No such contact";
  }

to just the return line.

Eric K
@EricK425
Nov 16 2016 06:47
@revisualize I'm not sure what you mean
Joseph
@revisualize
Nov 16 2016 06:48
Remove all of the if stuff. Just have the return statement.
contacts. is an array. It will never have a .firstName
Eric K
@EricK425
Nov 16 2016 06:48
@revisualize I see. It can only have an index to check a first name
@revisualize contacts[i]
Joseph
@revisualize
Nov 16 2016 06:49
But, i means relatively nothing outside of the for loop.
Eric K
@EricK425
Nov 16 2016 06:49
@revisualize But I changed it, they both worked but I see how yours is better, it saves space and yes I now realize how dumb that is lol i is out of the loop
Joseph
@revisualize
Nov 16 2016 06:50
It isn't dumb.
It's just looking at code.
Eric K
@EricK425
Nov 16 2016 06:50
@revisualize I really do understand this stuff at least I think I do. my problems lately are from careless errors or syntax but I feel liek I know how to think and can follow the path
Joseph
@revisualize
Nov 16 2016 06:50
Changing your logic.
Eric K
@EricK425
Nov 16 2016 06:50
@revisualize Ive been going through the basic alrogirth scripting nad those are good.. takes me several hours sometimes but its great practice
Joseph
@revisualize
Nov 16 2016 06:50
@EricK425 Trying to help people change their logic is why I ask questions.
Eric K
@EricK425
Nov 16 2016 06:51
@revisualize How much have you completed on this site? do you have all certs?
Joseph
@revisualize
Nov 16 2016 06:51

@EricK425 Thinking about this:

Let's say you were at a big business event and throughout the event you got handed 200 business cards. Now, I walk up to you at the end and ask you.. Do you have a Business Card for "Jane Smith"? Now you loop look through your stack of 200 business cards. When would you tell me that you didn't have a business card for Jane?
My next question is going to be.. How does that question relate to the lesson that you're working on?

.. changes your perspective and helps you change your logic.

Eric K
@EricK425
Nov 16 2016 06:51
@revisualize is your career in software or programming
Joseph
@revisualize
Nov 16 2016 06:51
@EricK425 I'm on the Intermediate Algorithms. (I haven't done any projects.
@EricK425 I'm a Network Systems Administrator.
ANormalSoundingName
@ANormalSoundingName
Nov 16 2016 06:51
Hi, I'm having trouble with escape sequences in strings. How do I link my text window?
Joseph
@revisualize
Nov 16 2016 06:52

How to do code block format:
```js [SHIFT+ENTER]
// your code here
``` [CTRL+ENTER or CMD+ENTER to send]
Please do not confuse `s with 's.
Also note that the ```s need to each be on their own lines
The ` key can usually be found on most keyboards up next to the 1 key.
If you hit SHIFT+` it will give you the ~.
Example:
```
code
```
...
Output:

var code = undefined;

...
You can also do inline code formatting:
A string of text with a `variable` or `other bit of code`.
Output:
A string of text with a variable or other bit of code.

Eric K
@EricK425
Nov 16 2016 06:52
@revisualize so youre more on the IT side of things and now you're diving into the software side for either hobby or to potentially change career direction a little bit
Joseph
@revisualize
Nov 16 2016 06:52
Let me get some text.
ANormalSoundingName
@ANormalSoundingName
Nov 16 2016 06:52
var myStr = 'FistLine\n\SecondLine\\rThirdLine';
Eric K
@EricK425
Nov 16 2016 06:53
@ANormalSoundingName type then another to enclose your code
@ANormalSoundingName type 3 of these `
ANormalSoundingName
@ANormalSoundingName
Nov 16 2016 06:53
```var myStr = 'FistLine\n\SecondLine\\rThirdLine';
var myStr = 'FistLine\n\\SecondLine\\\rThirdLine';
Joseph
@revisualize
Nov 16 2016 06:54
@ANormalSoundingName Fist?
Eric K
@EricK425
Nov 16 2016 06:54
@ANormalSoundingName if you hit shift enter itll look like this
code
ANormalSoundingName
@ANormalSoundingName
Nov 16 2016 06:54
Haha okay thanks that got it
Eric K
@EricK425
Nov 16 2016 06:55
@ANormalSoundingName theres a difference in enclosing your code like this vs like this assuming there are 3 of `
@ANormalSoundingName jeez im so sorry I clearly am of no help.. imstill getting used to this interface.
Joseph
@revisualize
Nov 16 2016 06:55
@EricK425 Here. I didn't want to retype this.
I'm currently 50% done with the Intermediate Algorithm Challenges. (I've skipped around.) What is my plan for the future: I currently work as a Network Systems Administrator III for a non-profit retirement community in Seattle. I'm seeing my job as a systems administrator / network administrator moving away from rack'em stack'em IT operations/technician roles to one of Automation. Be it automating software installations/deployments to full system deployments via automation. I really would like to move into cloud system deployment automation via things like PowerShell / Python and Hyper-V / Docker machines. But, I have a strong fondness for web development and solving complex challenges with code. So, I think it would be amazing if I could find a hybrid role where I was working on system deployments and automation while also having work to do in the development space to advance my career to being a full software developer.
Eric K
@EricK425
Nov 16 2016 06:56
@revisualize awesome. best of luck to ya, it seems like you have a solid understanding of this. im sure itll all wokr out for ya
zack
@acting2332
Nov 16 2016 07:05
Global Scope and Functions no idea how to do this one drawing blank anyone able to help?
please!
Markus Kiili
@Masd925
Nov 16 2016 07:06
@acting2332 Post the code you have done.
zack
@acting2332
Nov 16 2016 07:07
to be honest i dont even know where to start :$ was doing great till this one
Markus Kiili
@Masd925
Nov 16 2016 07:08
@acting2332 First you need to declare one variable myGlobal and give it a value of 10.
Do that before the function declaration.
zack
@acting2332
Nov 16 2016 07:08
kk
ancandelario2
@ancandelario2
Nov 16 2016 07:10
Having some issues with escape sequences
Joseph
@revisualize
Nov 16 2016 07:11
@ancandelario2 What's your line look like?
ancandelario2
@ancandelario2
Nov 16 2016 07:11
im afraid to even start cause the explanation has me stumped
Joseph
@revisualize
Nov 16 2016 07:12
@ancandelario2 Do you see where you can "Run" your code?
@ancandelario2 If you look just above that button. There is a line of what your myStr should be.
You just have to turn the words into their proper escape sequence.
I need to :zzz:
:v:
Good luck.
ancandelario2
@ancandelario2
Nov 16 2016 07:12
oh man
all on the same line ?
Joseph
@revisualize
Nov 16 2016 07:13
@ancandelario2 It should be FirstLine ....... ?
If yes. Then yes.
If yes: Be sure to remove the spaces.
:v:
ancandelario2
@ancandelario2
Nov 16 2016 07:14
var myStr=FirstLine\n
SecondLine\r
ThirdLine
thats what i have
Aamnah Akram
@aamnah
Nov 16 2016 07:17
this no works. whyyyyyyy?
function mutation(arr) {

  // convert elements to strings
  var arr1 = []; 
  arr1.push(arr[0]);
  arr1.join(' ').toLowerCase();

  var arr2= []; 
  arr2.push(arr[1]);
  arr2.join(' ').toLowerCase();

  if (arr1.indexOf(arr2) > -1) {
    return true;
  } else {
    return false;
  }

}
k.vincent
@bobKasbi
Nov 16 2016 07:17
@acting2332 Global scope means just the global executing context which woulb be window scope
Jordy weerwag
@TheCodeWriter1
Nov 16 2016 07:18
does someone know why my icons doesnt move and my nav bar is not at the top? plz
k.vincent
@bobKasbi
Nov 16 2016 07:18
@acting2332 just declar and initial a variable in the golbat executing context which is being generated by the the engine
Aamnah Akram
@aamnah
Nov 16 2016 07:19
i have tried both .toString() and .join(). The console logs show me that it doesn't turn some of the strings to lower case, and i can't for the life of me figure out why
Markus Kiili
@Masd925
Nov 16 2016 07:20
@aamnah You need to lowercase the two strings and then loop second string characters.
You can just pick the strings into variables and lowercase them.
k.vincent
@bobKasbi
Nov 16 2016 07:21
@Aamn any error? what says the console exactly
bahaa aldin
@bahaa-al-deen
Nov 16 2016 07:22
@Masd925 thanks alot
CamperBot
@camperbot
Nov 16 2016 07:22
bahaazidan sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2917 | @masd925 |http://www.freecodecamp.com/masd925
bahaa aldin
@bahaa-al-deen
Nov 16 2016 07:22
it works
function telephoneCheck(str) {
  var verify = str.match(/([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify1 = str.match(/(\()([0-9])([0-9])([0-9])(\))([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify2 = str.match(/(\()([0-9])([0-9])([0-9])(\))(\ )([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify3 = str.match(/([0-9])([0-9])([0-9])(\ )([0-9])([0-9])([0-9])(\ )([0-9])([0-9])([0-9])([0-9])/);
  var verify4 = str.match(/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])/);
  var verify5 = str.match(/(1)(\ )([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify6 = str.match(/(1)(\()([0-9])([0-9])([0-9])(\))([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify7 = str.match(/(1)(\ )(\()([0-9])([0-9])([0-9])(\))(\ )([0-9])([0-9])([0-9])(-)([0-9])([0-9])([0-9])([0-9])/);
  var verify8 = str.match(/(1)(\ )([0-9])([0-9])([0-9])(\ )([0-9])([0-9])([0-9])(\ )([0-9])([0-9])([0-9])([0-9])/);
  var verify9 = str.match(/(1)([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])/);
  var tests = [verify,verify1,verify2,verify3,verify4,verify5,verify6,verify7,verify8,verify9].reverse();
  var finalTest = [];
  for (i=0; i<10; i++) {
    if (tests[i] !== null) {
      finalTest = tests[i];
      break;
    }
  }
  if (finalTest[0] === str) {
    return true;
  } else {return false;}
  return finalTest;

}

telephoneCheck("(275)76227382");
Aamnah Akram
@aamnah
Nov 16 2016 07:22
@bobKasbi i am using console.log(arr1 + " " + arr2) to see what are the resulting strings i am getting and it always shows Mary and Alien, with capital A and capital M..
zack
@acting2332
Nov 16 2016 07:22
@bobKasbi ahh i am sorry i think i am tired been working for awhile its just not making sense i may need a break
bahaa aldin
@bahaa-al-deen
Nov 16 2016 07:22
any one has a shorter way to complete the challenge ?
Markus Kiili
@Masd925
Nov 16 2016 07:23
@BahaaZidan Haven't done that challenge, but I have seen it done with one regexp.
ancandelario2
@ancandelario2
Nov 16 2016 07:23
var myStr="FirstLine\n\SecondLine\rThirdLine";
can anyone help me fix this
bahaa aldin
@bahaa-al-deen
Nov 16 2016 07:24
@Masd925 WOW !!!!
ancandelario2
@ancandelario2
Nov 16 2016 07:24
i feel so retarded
Aamnah Akram
@aamnah
Nov 16 2016 07:24
@Masd925 LOOP the second string characters individually, yes. i'm afraid i seem to have made the same mistake again, i thought the string.indexOf() would check for characters, duh
k.vincent
@bobKasbi
Nov 16 2016 07:24
@TheCodeWriter1 you have fixed position for ul
bahaa aldin
@bahaa-al-deen
Nov 16 2016 07:24
only one regex !
ill search for that any way thanks alot i appreciate it
k.vincent
@bobKasbi
Nov 16 2016 07:25
@acting2332 take break then... doesn't make sense if you can't think ;-)
Markus Kiili
@Masd925
Nov 16 2016 07:25
@aamnah IndexOf looks for a substring. Here the logic demands for looking for each character individually.
Jordy weerwag
@TheCodeWriter1
Nov 16 2016 07:25
Oke thanks @bobKasbi