These are chat archives for FreeCodeCamp/HelpJavaScript

16th
Nov 2016
andry91959
@andry91959
Nov 16 2016 00:00 UTC
but I think still not working
Laurynas
@IceCarpenter
Nov 16 2016 00:00 UTC
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 UTC
@andry91959 close, thing is, answer isn't a function
__mifflin__
@cdrainxv
Nov 16 2016 00:02 UTC

@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 UTC
@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 UTC
@Bugaboss still trying?
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:04 UTC
@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 UTC
@Bugaboss you first if condition why are you testing if it is >=num-3
andry91959
@andry91959
Nov 16 2016 00:06 UTC
Got it, thatnks guys
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:07 UTC
@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 UTC
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 UTC
@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 UTC
@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 UTC

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 UTC
@Bugaboss isn't it if number is >= the given string?
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:10 UTC
@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 UTC

@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 UTC
@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 UTC

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 UTC
@bgabriel718: use split(" ") to seperate by group/word or split("") to seperate by character/letter.
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:18 UTC
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 UTC

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 UTC
what is the best way(library) to handle user(jwt) authentication for isomorphic redux app?
__mifflin__
@cdrainxv
Nov 16 2016 00:21 UTC
@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 UTC
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 UTC
@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 UTC
@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 UTC
such things happen
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:23 UTC
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 UTC
@Radio-Mac yes with sort
Ryan Hikel
@ryanhikel
Nov 16 2016 00:24 UTC
Hi can i get some help with the javascript problem Convert Celsius to Fahrenheit
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:24 UTC
@burning-monk I would like to know where is the problem :(
Jan
@burning-monk
Nov 16 2016 00:25 UTC
function compareNumbers(a, b) {
  return a - b;
}
@Radio-Mac
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:26 UTC
@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 UTC
@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 UTC

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 UTC
@dagman Holy cats man, this is the stuff they never teach you back at school.
Ryan Hikel
@ryanhikel
Nov 16 2016 00:28 UTC
the wording is confusing me im supposed to multiply by 9/5 then add 32
Islam Ibakaev
@dagman
Nov 16 2016 00:29 UTC
@Radio-Mac just a combo of es6 + recursion
cd-Zero
@cd-Zero
Nov 16 2016 00:29 UTC
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 UTC
anyone here thats done the record collection challenge? I have no idea what to do
cd-Zero
@cd-Zero
Nov 16 2016 00:30 UTC
@jpmitchellpierson i just finished it
Jan
@burning-monk
Nov 16 2016 00:30 UTC
@Bugaboss I got just the first if condition is wrong
cd-Zero
@cd-Zero
Nov 16 2016 00:30 UTC
my solution, atleast in my mind sucks
Justin Pierson
@jpmitchellpierson
Nov 16 2016 00:30 UTC
@cd-Zero did you use if/else statements for everything in the rules?
cd-Zero
@cd-Zero
Nov 16 2016 00:31 UTC
@jpmitchellpierson pretty much
Jan
@burning-monk
Nov 16 2016 00:31 UTC
@Bugaboss do you want the solution or try to figure it out first?
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:31 UTC
@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 UTC
@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 UTC
@cd-Zero how did you update values for album properties?
cd-Zero
@cd-Zero
Nov 16 2016 00:32 UTC
@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 UTC
@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 UTC
@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 UTC

@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 UTC
@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 UTC

@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 UTC
@Bugaboss I did like this
```
Ryan Hikel
@ryanhikel
Nov 16 2016 00:35 UTC
how would i multiply by 9/5 would this work... celsius*=9/5+32
Jan
@burning-monk
Nov 16 2016 00:35 UTC
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 UTC
@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 UTC
@ryanhikel You're solving for Fahrenheit not Celsius right? Try again.
__mifflin__
@cdrainxv
Nov 16 2016 00:36 UTC
@burning-monk: You can just return str; for your else statement.
Jan
@burning-monk
Nov 16 2016 00:37 UTC
oh lol
want a brownie? @cdrainxv
__mifflin__
@cdrainxv
Nov 16 2016 00:38 UTC
@burning-monk: Sure, but I didn’t help… you already had the answer. :100:
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:38 UTC
@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 UTC
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 UTC
it's actually the same solution
@cdrainxv thanks
CamperBot
@camperbot
Nov 16 2016 00:38 UTC
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 UTC
"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 UTC

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 UTC
@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 UTC
how do you send a brownie acutally ? :D
Jason
@jasonascott89
Nov 16 2016 00:40 UTC
@Bugaboss thanks
Ryan Hikel
@ryanhikel
Nov 16 2016 00:40 UTC
im supposed to convert the celsiud to fahrenheit i think i did the multiplication wrong
CamperBot
@camperbot
Nov 16 2016 00:40 UTC
jasonascott89 sends brownie points to @bugaboss :sparkles: :thumbsup: :sparkles:
:cookie: 249 | @bugaboss |http://www.freecodecamp.com/bugaboss
__mifflin__
@cdrainxv
Nov 16 2016 00:40 UTC
@ryanhikel: you need to assign your formula to fahrenheit.
fahrenheit = celsius*(9/5)+32;
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:40 UTC
@jasonascott89 thanks
CamperBot
@camperbot
Nov 16 2016 00:40 UTC
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 UTC
@burning-monk thanks
CamperBot
@camperbot
Nov 16 2016 00:40 UTC
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 UTC
@Bugaboss did understand it now?
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:41 UTC
@cdrainxv I suppose so.
Ryan Hikel
@ryanhikel
Nov 16 2016 00:41 UTC
oh that makes sense thank you @Radio-Mac @cdrainxv
CamperBot
@camperbot
Nov 16 2016 00:41 UTC
: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 UTC
@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 UTC
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 UTC
@cdrainxv what?
Patrik Rechtorík
@Bugaboss
Nov 16 2016 00:42 UTC
@burning-monk yes the only problem was with the first if as you said :)
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:43 UTC
@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 UTC
@burning-monk: I was referencing this: :point_up: November 15, 2016 5:38 PM
Ryan Hikel
@ryanhikel
Nov 16 2016 00:43 UTC
I really appreciate the help @Radio-Mac
Jan
@burning-monk
Nov 16 2016 00:44 UTC
@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 UTC
No worries.
Engineer-Kingdom
@Engineer-Kingdom
Nov 16 2016 00:46 UTC
@Radio-Mac the problem is how to match first name?
Walid Ashri
@walidashri
Nov 16 2016 00:46 UTC
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 UTC
Someone a good place with good videos about javascript ?
Or a good youtube channel
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:47 UTC
@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 UTC
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 UTC
hello need some help please.
Engineer-Kingdom
@Engineer-Kingdom
Nov 16 2016 00:49 UTC
or {"firstname":"Akira"}
Chris
@Cbhansen
Nov 16 2016 00:49 UTC
dont know if its javascript or css though
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:50 UTC
@Engineer-Kingdom All you need is contacts[x].firstName;
Sylvio Giubine
@SylvioGiubine
Nov 16 2016 00:51 UTC
hello ! someone had a problem at the pig latin ??
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:51 UTC
Well this is the javascript room. What're you looking for?
Engineer-Kingdom
@Engineer-Kingdom
Nov 16 2016 00:51 UTC
contacts[x].firstName = someone? @Radio-Mac
Sylvio Giubine
@SylvioGiubine
Nov 16 2016 00:51 UTC
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 UTC
@SylvioGiubine if (!vowels.invludes(str[i])){ :)
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:53 UTC
@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 UTC
But my problem is how to see if the prop = property name @Radio-Mac
Walid Ashri
@walidashri
Nov 16 2016 00:55 UTC
@Engineer-Kingdom lookup hasOwenProperty()
Ryan McMahon
@Radio-Mac
Nov 16 2016 00:55 UTC
@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 UTC
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 UTC
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 UTC
@jasonascott89 What were you working on?
Jason
@jasonascott89
Nov 16 2016 00:57 UTC
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 UTC
@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 UTC
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 UTC
@jasonascott89 Haven't gotten that far yet. Sorry.
Engineer-Kingdom
@Engineer-Kingdom
Nov 16 2016 01:00 UTC

//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 UTC
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 UTC
@walidashri would it be easier to use a switch function?
Christian
@xChristianZx
Nov 16 2016 01:01 UTC
@cd-Zero Thanks for the help, however i still can't get the tests to pass
CamperBot
@camperbot
Nov 16 2016 01:01 UTC
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 UTC
@TheCodeWriter1 try codeacademy
Walid Ashri
@walidashri
Nov 16 2016 01:02 UTC
@jpmitchellpierson I don't think so
Manish Giri
@Manish-Giri
Nov 16 2016 01:02 UTC
@Engineer-Kingdom try to keep the return of contact outside the for loop
Christian
@xChristianZx
Nov 16 2016 01:02 UTC
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 UTC
@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 UTC
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 UTC
@barb1643 what challenge is it
Barbara
@barb1643
Nov 16 2016 01:07 UTC
escape sequences
Manish Giri
@Manish-Giri
Nov 16 2016 01:09 UTC
it works for me, without the spaces
Walid Ashri
@walidashri
Nov 16 2016 01:09 UTC
@barb1643 try a refresh it's valid
Manish Giri
@Manish-Giri
Nov 16 2016 01:09 UTC
@barb1643
var myStr="FirstLine\n\\SecondLine\\\rThirdLine”;
andry91959
@andry91959
Nov 16 2016 01:10 UTC
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 UTC
@andry91959 why’re you using === ?
andry91959
@andry91959
Nov 16 2016 01:11 UTC
cause i want the result fals
false
Manish Giri
@Manish-Giri
Nov 16 2016 01:11 UTC
no
you need to check if a number is less than another number
andry91959
@andry91959
Nov 16 2016 01:11 UTC
because i put one condition it becomes true and other false
Manish Giri
@Manish-Giri
Nov 16 2016 01:12 UTC
and return true or false, accordingly
not test if they are equal or not
Gustavo Gil Noriega
@ggil12
Nov 16 2016 01:12 UTC
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 UTC
@andry91959 if a< b return true
Gustavo Gil Noriega
@ggil12
Nov 16 2016 01:12 UTC
Whats wrong here?
Adrian Mechelle
@astoddard3
Nov 16 2016 01:12 UTC

Assign the value 7 to variable a.

Assign the contents of a to variable b.

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

var a = 7;
var b = var a;

my code wont check out

Manish Giri
@Manish-Giri
Nov 16 2016 01:13 UTC
@ggil12 strings are immutable, you cannot change individual characters
Iqbal
@mibaldobaghi
Nov 16 2016 01:13 UTC
@astoddard3 no need for var. var b = a
Manish Giri
@Manish-Giri
Nov 16 2016 01:13 UTC
@astoddard3 var b = a if you want to assign a to b
Christian
@xChristianZx
Nov 16 2016 01:13 UTC
@Manish-Giri i'm just not seeing it.
Gustavo Gil Noriega
@ggil12
Nov 16 2016 01:13 UTC
@Manish-Giri So.. What should I do?
Barbara
@barb1643
Nov 16 2016 01:13 UTC
@Manish-Giri @walidashri I had one too many \ before and after the Secondline thank you!
Walid Ashri
@walidashri
Nov 16 2016 01:13 UTC
@astoddard3 use var only one time per variable
CamperBot
@camperbot
Nov 16 2016 01:13 UTC
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 UTC
@ggil12 are you supposed to change the letter?
Adrian Mechelle
@astoddard3
Nov 16 2016 01:13 UTC
ohhhhhhh thanks guys!!
Christian
@xChristianZx
Nov 16 2016 01:13 UTC
tried var val = phoneticLookup.charlie, that didn't work nor did any variation there of
Barbara
@barb1643
Nov 16 2016 01:14 UTC
i am sure i will be back...
Gustavo Gil Noriega
@ggil12
Nov 16 2016 01:14 UTC
@mibaldobaghi I'm supposed to correct myStr but I dont see the problem..
Walid Ashri
@walidashri
Nov 16 2016 01:14 UTC
@barb1643 Confidant! :)
Iqbal
@mibaldobaghi
Nov 16 2016 01:14 UTC
Should it be Hello instead of Jello?
Manish Giri
@Manish-Giri
Nov 16 2016 01:15 UTC
@ggil12 instead of changing myStr[0], just assign the new string to myStr
Vlad
@zastavno
Nov 16 2016 01:15 UTC
who here can help me with my error messages in compiler for my first program in class?
andry91959
@andry91959
Nov 16 2016 01:15 UTC
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 UTC
@andry91959 not understanding?
which test are you doing
Vlad
@zastavno
Nov 16 2016 01:16 UTC
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 UTC
@mibaldobaghi Returning Boolean Values from Functions
Walid Ashri
@walidashri
Nov 16 2016 01:16 UTC
@andry91959 return a<b is the same as ur if else
Manish Giri
@Manish-Giri
Nov 16 2016 01:16 UTC
@andry91959 shouldn’t you be using a return instead of if/else
Iqbal
@mibaldobaghi
Nov 16 2016 01:17 UTC
yes return a<b is the same
Gustavo Gil Noriega
@ggil12
Nov 16 2016 01:17 UTC
@Manish-Giri Did it. Thanks!
CamperBot
@camperbot
Nov 16 2016 01:17 UTC
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 UTC
dang
u are right
thanks guys
Tony Miri
@TonyMiri
Nov 16 2016 01:18 UTC
Anybody finished the 'Exact Change' challenge?
Manish Giri
@Manish-Giri
Nov 16 2016 01:18 UTC
@ggil12 welcome
Jeff Shapiro
@Jeff-Shapiro
Nov 16 2016 01:19 UTC
Hey @Manish-Giri
Murrali
@1810msr
Nov 16 2016 01:19 UTC
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 UTC
@Jeff-Shapiro :wave:
Walid Ashri
@walidashri
Nov 16 2016 01:20 UTC
@zastavno c = K; this is wrong also this is Java no javaScript
Murrali
@1810msr
Nov 16 2016 01:21 UTC
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 UTC
@1810msr you can't use switch like that, use if/else structure
Murrali
@1810msr
Nov 16 2016 01:23 UTC
so, do i use IF statements instead
ok thanks
gandledorf
@gandledorf
Nov 16 2016 01:23 UTC
var myStr = "\"FirstLine\n'\SecondLine\'\r\ThirdLine"; he;p
help
Barbara
@barb1643
Nov 16 2016 01:25 UTC
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 UTC
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 UTC
// 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 UTC
:point_up: November 16, 2016 4:46 AM @Chrono79 Diego Armando Maradonna of JS
@barb1643 space?
Diego Mayer
@Chrono79
Nov 16 2016 01:26 UTC
@barb1643 space between the two sentences
Manish Giri
@Manish-Giri
Nov 16 2016 01:27 UTC
@barb1643 you’re missing a space
Barbara
@barb1643
Nov 16 2016 01:28 UTC
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 UTC
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 UTC
@barb1643 welcome
gandledorf
@gandledorf
Nov 16 2016 01:33 UTC
var myStr = "\"FirstLine\n'\SecondLine\'\r\ThirdLine"; sombody help me before i go insane
Manish Giri
@Manish-Giri
Nov 16 2016 01:34 UTC
@gandledorf why so many quotes
gandledorf
@gandledorf
Nov 16 2016 01:35 UTC
i dont know, im so confused and tired right now
Walid Ashri
@walidashri
Nov 16 2016 01:35 UTC
:point_up: November 16, 2016 5:09 AM @gandledorf
gandledorf
@gandledorf
Nov 16 2016 01:36 UTC
@Manish-Giri thank you
CamperBot
@camperbot
Nov 16 2016 01:36 UTC
: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 UTC
@gandledorf welcome
Jason
@jasonascott89
Nov 16 2016 01:37 UTC
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 UTC
:)
@Chrono79
Justin Vernon
@Jvernz
Nov 16 2016 01:38 UTC
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 UTC
@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 UTC
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 UTC
@cazenaty anytime
@Jvernz PM me if you have a codepen link
Justin Pierson
@jpmitchellpierson
Nov 16 2016 01:43 UTC
// 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 UTC
@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 UTC
@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 UTC
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 UTC

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 UTC
@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 UTC
@astoddard3
var remainder =  11 % 3;
Walid Ashri
@walidashri
Nov 16 2016 01:58 UTC
@Chrono79 I said I hate reges :veryangrey:
Adrian Mechelle
@astoddard3
Nov 16 2016 01:58 UTC
so particular!!! thanks tony!
Tony Miri
@TonyMiri
Nov 16 2016 01:59 UTC
@astoddard3 No problem. And yes, computers are very picky lol
Anthony
@jawaka72
Nov 16 2016 02:00 UTC
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 UTC
@jawaka72 try arr[i] = arr[i].pop();
Anthony
@jawaka72
Nov 16 2016 02:02 UTC
@Chrono79 Awesome. Thank you so much.
CamperBot
@camperbot
Nov 16 2016 02:02 UTC
jawaka72 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 2542 | @chrono79 |http://www.freecodecamp.com/chrono79
Daniel
@danielbyun
Nov 16 2016 02:06 UTC
can somebody help with 'testing objects for properties' i have no clue
Eric Murta
@murtinha
Nov 16 2016 02:06 UTC
can uou guys give me feedback on my markdown previewer?
http://codepen.io/murtinha/pen/xEvbdX
Vlad
@zastavno
Nov 16 2016 02:06 UTC
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 UTC
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 UTC

@MCess

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

There you're changing oldArray

MCess
@MCess
Nov 16 2016 02:11 UTC
I should just remove the last line?
Diego Mayer
@Chrono79
Nov 16 2016 02:12 UTC
@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 UTC
Ah! Figured it out. Thanks @Chrono79
CamperBot
@camperbot
Nov 16 2016 02:19 UTC
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 UTC
@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 UTC
Hello world !
CamperBot
@camperbot
Nov 16 2016 02:23 UTC

welcome to FreeCodeCamp @jwalk197804!

jwalk197804
@jwalk197804
Nov 16 2016 02:23 UTC
Just discovered Free Code Camo
Camp
Joseph
@josephlo8318
Nov 16 2016 02:24 UTC
@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 UTC
haha..Thanks...So long as I am improving on code..Its okay..who needs sleep..
Walid Ashri
@walidashri
Nov 16 2016 02:26 UTC
@josephlo8318 lol
KSV
@vicmania2007
Nov 16 2016 02:33 UTC
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 UTC
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 UTC
do we have to override the reduce function, for it to work the given wayu??
Walid Ashri
@walidashri
Nov 16 2016 02:39 UTC
@vicmania2007 create the array of all num between them then reduce it
Manish Giri
@Manish-Giri
Nov 16 2016 02:40 UTC
@dtonlai do you have a question
dtonlai
@dtonlai
Nov 16 2016 02:41 UTC
@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 UTC
@dtonlai okay, and your doubt is?
dtonlai
@dtonlai
Nov 16 2016 02:42 UTC
@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 UTC

@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 UTC
is Roman Numeral Converter challenge really has a lot of if conditions?
Manish Giri
@Manish-Giri
Nov 16 2016 02:43 UTC

@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 UTC
hi, can anyone help with wikipedia random pages challenge?
Manish Giri
@Manish-Giri
Nov 16 2016 02:43 UTC
@makleriux did you have a question?
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 02:43 UTC

@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 UTC
@Manish-Giri @NicksIdeaEngine Ah ok, so it would look like:
var = a;
var b = a;
Manish Giri
@Manish-Giri
Nov 16 2016 02:45 UTC
@dtonlai this is right var b = a;
dtonlai
@dtonlai
Nov 16 2016 02:45 UTC
oh wait, var a = 7;
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 02:45 UTC
There you go!
Manish Giri
@Manish-Giri
Nov 16 2016 02:45 UTC
yes
Aaron Bell
@awb715
Nov 16 2016 02:45 UTC
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 UTC
@awb715 I haven't met RobotCaleb. Sorry.
makleriux
@makleriux
Nov 16 2016 02:45 UTC
@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 UTC
haha sorry
dtonlai
@dtonlai
Nov 16 2016 02:45 UTC
@Manish-Giri @NicksIdeaEngine Thanks so much!
CamperBot
@camperbot
Nov 16 2016 02:45 UTC
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 UTC
@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 UTC
@makleriux you probably need action=opensearch, not action=query
Aaron Bell
@awb715
Nov 16 2016 02:47 UTC
not sure @NicksIdeaEngine
if you put the link in your browser it works
Tony Miri
@TonyMiri
Nov 16 2016 02:48 UTC
'Exact Change' help? Anybody?
makleriux
@makleriux
Nov 16 2016 02:48 UTC
@Manish-Giri ok i going to look for it
@Manish-Giri thank you
CamperBot
@camperbot
Nov 16 2016 02:49 UTC
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 UTC
@FatTone225 Ask a question
Manish Giri
@Manish-Giri
Nov 16 2016 02:49 UTC
@makleriux welcome
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 02:51 UTC

@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 UTC
@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 UTC
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 UTC
@joehesse which var is that
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 02:56 UTC
@FatTone225 I'm looking it over meow. Bear with me.
Or bare. Your choice.
Tony Miri
@TonyMiri
Nov 16 2016 02:56 UTC
@NicksIdeaEngine I can comment it if you'd like?
Aaron Bell
@awb715
Nov 16 2016 02:56 UTC
anyone here up to the twitch ?
Tony Miri
@TonyMiri
Nov 16 2016 02:57 UTC
@awb715 Yeah what's up?
Justin Vernon
@Jvernz
Nov 16 2016 02:57 UTC
How can I create a random color generator in my quote generator project?
Walid Ashri
@walidashri
Nov 16 2016 02:57 UTC
@Jvernz use color array
Aaron Bell
@awb715
Nov 16 2016 02:57 UTC
@FatTone225 are you linking to the api or hard coding?
Justin Vernon
@Jvernz
Nov 16 2016 02:58 UTC
@walidashri good point thanks!
CamperBot
@camperbot
Nov 16 2016 02:58 UTC
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 UTC
@awb715 Hard coded an array of users and did Api calls for each user in the array
johanna
@joehesse
Nov 16 2016 02:58 UTC
@walidashri is the fahrenheit
Walid Ashri
@walidashri
Nov 16 2016 02:59 UTC
@joehesse ur code is not right var = (9/5)*celsius+32;
Aaron Bell
@awb715
Nov 16 2016 02:59 UTC
hmm
how did you call it?
@FatTone225
Manish Giri
@Manish-Giri
Nov 16 2016 02:59 UTC

@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 UTC
dont copy it
just wihich method?
Tony Miri
@TonyMiri
Nov 16 2016 02:59 UTC
$.getJSON
Manish Giri
@Manish-Giri
Nov 16 2016 03:00 UTC
@awb715 question about twitch?
Aaron Bell
@awb715
Nov 16 2016 03:00 UTC
ok ill try it again keep getting a cross origon error
Tony Miri
@TonyMiri
Nov 16 2016 03:00 UTC
@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 UTC
@Manish-Giri well before i write the variable and it says variable already specify
Aaron Bell
@awb715
Nov 16 2016 03:02 UTC
cool! that was the issue
thanks @FatTone225
CamperBot
@camperbot
Nov 16 2016 03:02 UTC
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 UTC
No prob
Walid Ashri
@walidashri
Nov 16 2016 03:02 UTC
@joehesse use the name Fahrenheit= (9/5)*Celsius+32;
Manish Giri
@Manish-Giri
Nov 16 2016 03:02 UTC
@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 UTC
its always a good feeling when you get the api working @FatTone225
johanna
@joehesse
Nov 16 2016 03:06 UTC
@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 UTC
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 UTC
@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 UTC
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 UTC
@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 UTC
how long have you been goin for
@FatTone225
Tony Miri
@TonyMiri
Nov 16 2016 03:09 UTC
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 UTC
what you do full time
im trying to avoid corporate ny and get job in this
Tony Miri
@TonyMiri
Nov 16 2016 03:09 UTC
Truck Driver for the past 3 years
Not exactly a mentally stimulating career lol
Aaron Bell
@awb715
Nov 16 2016 03:11 UTC
haha true
ivethought about doing a bootcamp
3 months of your life and change direction
Tony Miri
@TonyMiri
Nov 16 2016 03:12 UTC
Yeah. I suppose it works for some people, but it's expensive.
Aaron Bell
@awb715
Nov 16 2016 03:12 UTC
i wanted it to look like a buddy list but i kinda messed that up
Tony Miri
@TonyMiri
Nov 16 2016 03:12 UTC
@awb715 Looking good though. Keep tweaking it.
Aaron Bell
@awb715
Nov 16 2016 03:13 UTC
its nice and responsive
but the layout isnt great
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 03:18 UTC
@FatTone225 Still thinking through it. I think I'm close though
Tony Miri
@TonyMiri
Nov 16 2016 03:18 UTC
@NicksIdeaEngine Appreciate it. I'm looking too, but I dunno.
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 03:22 UTC
Your while loop never runs because changeDue >= current[1] is never true
Tony Miri
@TonyMiri
Nov 16 2016 03:23 UTC
Yep
I just saw it too lol
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 03:23 UTC
changeDue needs to compare against the values array somehow, not the total amount in the drawer
Tony Miri
@TonyMiri
Nov 16 2016 03:23 UTC
Right. I can't believe it. lol. Hours and hours. @NicksIdeaEngine Thank you.
CamperBot
@camperbot
Nov 16 2016 03:23 UTC
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 UTC
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 UTC
Can I see that?
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 03:26 UTC
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 UTC
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 UTC
    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 UTC
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 UTC
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 UTC
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 UTC
@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 UTC
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 UTC
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 UTC
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 UTC

@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 UTC
where in that do you add?
Justin Pierson
@jpmitchellpierson
Nov 16 2016 03:44 UTC
@josephlo8318 thank you so much! i was working on that for hours and finally got it
CamperBot
@camperbot
Nov 16 2016 03:44 UTC
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 UTC
@alanmbarr when i return arr[i].push(val)
right?
Alan Barr
@alanmbarr
Nov 16 2016 03:45 UTC
I'm not sure can you explain it to me?
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:45 UTC
or should i come up with some other variable
Alan Barr
@alanmbarr
Nov 16 2016 03:46 UTC
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 UTC
@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 UTC
@alanmbarr by using the push() method?
Alan Barr
@alanmbarr
Nov 16 2016 03:52 UTC
without push
Aaron
@apalm1341
Nov 16 2016 03:52 UTC
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 UTC
Stas you will need to use return and do something to the element
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:53 UTC
@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 UTC
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 UTC
@alanmbarr so i will return arr[i] and then something for this element?
Alan Barr
@alanmbarr
Nov 16 2016 03:57 UTC
forget the arr stuff
Stas Vitvitskiy
@StasVitvitskiy
Nov 16 2016 03:58 UTC
@alanmbarr arr[val] then?
@alanmbarr lol i figured
it's val+=3;
@alanmbarr thanks man
CamperBot
@camperbot
Nov 16 2016 04:01 UTC
stasvitvitskiy sends brownie points to @alanmbarr :sparkles: :thumbsup: :sparkles:
:cookie: 336 | @alanmbarr |http://www.freecodecamp.com/alanmbarr
gandledorf
@gandledorf
Nov 16 2016 04:05 UTC
var myList = [["stuff",1],["stuff",2],["stuff",3],["stuff",4],["stuff",5],"stuff",6]; help
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:06 UTC
@gandledorf what do you need help with?
1Elral4
@1Elral4
Nov 16 2016 04:07 UTC
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 UTC
@Lumexralph im supposed to create a multidimensional shopping list, and im not sure whats wrong @Lumexralph
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:09 UTC
@gandledorf it looks two dimension array to me
gandledorf
@gandledorf
Nov 16 2016 04:10 UTC
@Lumexralph im not good with arrays, sohow would i implement a third dimension
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:12 UTC
@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 UTC
hey guys
how can i skip
( in a regex ?
thomascarpenter21
@thomascarpenter21
Nov 16 2016 04:15 UTC
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 UTC
@Lumexralph the challenge is to make a list containing 5 sub-arrays
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:16 UTC
@Lumexralph any idea ?
gandledorf
@gandledorf
Nov 16 2016 04:16 UTC
@Lumexralph with data that i have to put in
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:16 UTC
@BahaaZidan \(
@gandledorf okay, you create an empty array
gandledorf
@gandledorf
Nov 16 2016 04:18 UTC
@Lumexralph okay
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:18 UTC
@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 UTC
thanks alot m8 @Lumexralph
CamperBot
@camperbot
Nov 16 2016 04:21 UTC
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 UTC
i appreciate it
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:21 UTC
@BahaaZidan :+1:
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:24 UTC
@Lumexralph how can i target space in my regex ?
Jenky W. Nolasco
@jenkynolasco11
Nov 16 2016 04:25 UTC
@BahaaZidan '\ ' <--- without quotes, or just space
\s also applies
Ogundele Olumide
@Lumexralph
Nov 16 2016 04:27 UTC
@BahaaZidan \s just like @jenkynolasco11 said
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:27 UTC
  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 UTC
@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 UTC
thanks , but what is wrong with my previous code ?
Greg Duncan
@GregatGit
Nov 16 2016 04:34 UTC
@BahaaZidan what are you trying to do?
Micah Lewis
@EastML
Nov 16 2016 04:36 UTC
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 UTC
im trying to make it match this style (555) 555-5555
and only this style specificly
Alan Barr
@alanmbarr
Nov 16 2016 04:36 UTC
are you assigning that to str?
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:36 UTC
and note the space
Alan Barr
@alanmbarr
Nov 16 2016 04:38 UTC
Micah you are using the index of the number of the vowel instead of the vowel itself?
MCess
@MCess
Nov 16 2016 04:38 UTC
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 UTC
@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 UTC
@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 UTC
it now returns null
Greg Duncan
@GregatGit
Nov 16 2016 04:40 UTC
if it worked
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:40 UTC
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 UTC
Thanks @alanmbarr . I can't believe I missed that. very embarrassing .
CamperBot
@camperbot
Nov 16 2016 04:40 UTC
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 UTC
Anywho, thanks for the eagle eye.
Damien
@kingdame
Nov 16 2016 04:41 UTC
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 UTC

@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 UTC
Damien, what are you trying to do?
MCess
@MCess
Nov 16 2016 04:43 UTC
@khaduch Isn't it asking me to find the length though?
bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:43 UTC
@GregatGit thanks m8
CamperBot
@camperbot
Nov 16 2016 04:43 UTC
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 UTC
the problem was not with the regex
leithemaster
@leithemaster
Nov 16 2016 04:44 UTC
Hello world
CamperBot
@camperbot
Nov 16 2016 04:44 UTC

welcome to FreeCodeCamp @leithemaster!

bahaa aldin
@bahaa-al-deen
Nov 16 2016 04:44 UTC
im so stupid that i was applying a different verify function
Ken Haduch
@khaduch
Nov 16 2016 04:44 UTC
@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 UTC
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 UTC
Hey all, any chance with a little help? stuck on a step
Bibek Gautam
@bibek22
Nov 16 2016 04:45 UTC
so i didn't use any of the methods hinted on the page
Greg Duncan
@GregatGit
Nov 16 2016 04:45 UTC
@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 UTC

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 UTC
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 UTC
you referring to me @bibek22
I changed it to: myVar = ++myVar;
Bibek Gautam
@bibek22
Nov 16 2016 04:48 UTC
@dottDesign hmm nope. i was talking about my problem
Derrick
@dottDesign
Nov 16 2016 04:48 UTC
;) okie
Bibek Gautam
@bibek22
Nov 16 2016 04:48 UTC
@dottDesign it's myVar += 1
that's the syntax if you're trying to increment it
Logan Sinclair
@LoganS1
Nov 16 2016 04:49 UTC
@bibek22 stole the words right out of my mouth
Bibek Gautam
@bibek22
Nov 16 2016 04:49 UTC
@LoganS1 ;)
Derrick
@dottDesign
Nov 16 2016 04:50 UTC
@bibek22 I need to use the ++ operator though
Bibek Gautam
@bibek22
Nov 16 2016 04:50 UTC
@dottDesign myVarr++
Logan Sinclair
@LoganS1
Nov 16 2016 04:50 UTC
@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 UTC
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 UTC
what lesson is it exactly?
Doug
@doug20000
Nov 16 2016 04:54 UTC
Could somebody lend me a hand with the lesson Accessing Objects Properties with Variables ?
Logan Sinclair
@LoganS1
Nov 16 2016 04:54 UTC

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 UTC
increment-a-number-with-javascrip
KSV
@vicmania2007
Nov 16 2016 04:55 UTC
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 UTC
@dottDesign The answer is litterally just
```
myVar++;
```
did you forget the semicolon?
KSV
@vicmania2007
Nov 16 2016 04:56 UTC

'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 UTC
serisously!! :) thanks @LoganS1
CamperBot
@camperbot
Nov 16 2016 04:56 UTC
dottdesign sends brownie points to @logans1 :sparkles: :thumbsup: :sparkles:
:cookie: 216 | @logans1 |http://www.freecodecamp.com/logans1
Derrick
@dottDesign
Nov 16 2016 04:57 UTC
nope didnt forget was just making it myVar = ++myVar;
Aarya Bhorra
@aarya1302
Nov 16 2016 04:57 UTC
@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 UTC
could someone lend me a hand with the lesson Accessing Objects Properties with Variables ?
Aarya Bhorra
@aarya1302
Nov 16 2016 05:01 UTC
@doug20000 what is your problem?/
Doug
@doug20000
Nov 16 2016 05:01 UTC

@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 UTC
@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 UTC

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 UTC
@doug20000 instead of 16 put this [player]
JackVizl
@JackVizl
Nov 16 2016 05:03 UTC
Can someone tell me why there end up being lots of ',' characters in newStrArr?
Aarya Bhorra
@aarya1302
Nov 16 2016 05:03 UTC
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 UTC
@aarya1302 it still doesn't seem to be working for me
KSV
@vicmania2007
Nov 16 2016 05:06 UTC
@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 UTC
vicmania2007 sends brownie points to @aarya1302 :sparkles: :thumbsup: :sparkles:
:cookie: 276 | @aarya1302 |http://www.freecodecamp.com/aarya1302
Aaron
@apalm1341
Nov 16 2016 05:06 UTC
can someone that has good javascript knowledge send me private message?
need help...would appreciate it
Aarya Bhorra
@aarya1302
Nov 16 2016 05:07 UTC
@doug20000 send me your code again
Tony Miri
@TonyMiri
Nov 16 2016 05:07 UTC
@apalm1341 What are you working on?
Doug
@doug20000
Nov 16 2016 05:08 UTC

@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 UTC
@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 UTC
@aarya1302 ah ha, yes that worked. thank you
CamperBot
@camperbot
Nov 16 2016 05:10 UTC
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 UTC
You're welcome
KSV
@vicmania2007
Nov 16 2016 05:10 UTC
@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 UTC
No you're quite right
@vicmania2007
Mine sucks too
KSV
@vicmania2007
Nov 16 2016 05:13 UTC
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 UTC

hey guys,

what am I doing wrong here? o:

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

KSV
@vicmania2007
Nov 16 2016 05:14 UTC
@mkshcode var myStr ="FirstLine\nSecondLine\n\rThirdLine";
Will
@Will-is-Coding
Nov 16 2016 05:15 UTC
@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 UTC
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 UTC
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 UTC
@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 UTC
@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 UTC
can anyone here help me with record collection challenge?
Will
@Will-is-Coding
Nov 16 2016 05:18 UTC
This is a line of code Here's how you should type it `Like this`
ms
@mkshcode
Nov 16 2016 05:18 UTC
@Will-is-Coding var myStr ='FirstLine\n\SecondLine\n\rThirdLine';
Ayush Bahuguna
@relentless-coder
Nov 16 2016 05:19 UTC
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 UTC
@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 UTC
:bulb: to format code use backticks! ``` more info
Will
@Will-is-Coding
Nov 16 2016 05:19 UTC
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 UTC
``
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 UTC
@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 UTC
oh, yes. Typo error.
Logan Sinclair
@LoganS1
Nov 16 2016 05:22 UTC

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 UTC
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 UTC

@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 UTC
: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 UTC
Can anyone help me with the counting cards challenge
Aarya Bhorra
@aarya1302
Nov 16 2016 05:28 UTC
what's your code? @ATorresDev
Will
@Will-is-Coding
Nov 16 2016 05:28 UTC

@mkshcode But the output should look like

FirstLine
\SecondLine\
ThirdLine

Does your line look right?

Anthony Torres
@ATorresDev
Nov 16 2016 05:30 UTC

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 UTC
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 UTC
@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 UTC
@Will-is-Coding it is that lengthy
Abhisek Pattnaik
@abhisekp
Nov 16 2016 05:33 UTC
@apalm1341 you may use http://gist.github.com or http://hastebin.com ;)
Will
@Will-is-Coding
Nov 16 2016 05:34 UTC
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 UTC
@abhisekp what r those?
Abhisek Pattnaik
@abhisekp
Nov 16 2016 05:36 UTC
@apalm1341 for large number of lines of code, use those sites for sharing code
Anthony Torres
@ATorresDev
Nov 16 2016 05:40 UTC
nvm figured it out
Aaron
@apalm1341
Nov 16 2016 05:45 UTC
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 UTC
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 UTC
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 UTC
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 UTC
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 UTC
@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 UTC
@StasVitvitskiy return num is wrong
Joseph
@revisualize
Nov 16 2016 06:10 UTC
I just saw that.
editing count. Return Count.
智轩
@zhixuanziben
Nov 16 2016 06:11 UTC
You should return count
Ben Hart
@Benjmhart
Nov 16 2016 06:13 UTC
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 UTC

@Benjmhart shouldn't this

 if (measure="Celcius"){

be

 if (measure=="Celcius"){
and same for this
 if (measure = "Farenheit"){
Ben Hart
@Benjmhart
Nov 16 2016 06:22 UTC
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 UTC

//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 UTC
@EricK425 i'd suggest you used switch case
*use
Eric K
@EricK425
Nov 16 2016 06:28 UTC
@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 UTC
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 UTC
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 UTC
@kherrjee switch case would take lots of lines of code and I can get this down in maybe 6-10 lines
Ben Hart
@Benjmhart
Nov 16 2016 06:30 UTC
fixed it by turning it back into an if/else statement
Eric K
@EricK425
Nov 16 2016 06:30 UTC
@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 UTC
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 UTC
@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 UTC
@LoganS1 You are over complicating it.
Eric K
@EricK425
Nov 16 2016 06:34 UTC
@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 UTC
@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 UTC
@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 UTC
@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 UTC
@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 UTC
@revisualize
@revisualize my wifi got disconnected
i was not spamming
Eric K
@EricK425
Nov 16 2016 06:38 UTC
@revisualize when I got to the end
Joseph
@revisualize
Nov 16 2016 06:38 UTC
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 UTC
ok , i just thought that it never got posted
Joseph
@revisualize
Nov 16 2016 06:38 UTC
@BahaaZidan Thanks.
CamperBot
@camperbot
Nov 16 2016 06:38 UTC
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 UTC
@revisualize I think Im catching what youre saying.. brb
bahaa aldin
@bahaa-al-deen
Nov 16 2016 06:39 UTC
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 UTC
@BahaaZidan Match returns null if there were no matches.
bahaa aldin
@bahaa-al-deen
Nov 16 2016 06:41 UTC
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 UTC
@EricK425 Change it yet?
It should be just moving a few lines of code around.
Markus Kiili
@Masd925
Nov 16 2016 06:43 UTC
@BahaaZidan You could make a null test if(arr!==null && arr[0]...)
bahaa aldin
@bahaa-al-deen
Nov 16 2016 06:44 UTC
thanks
ill try it and brb
Eric K
@EricK425
Nov 16 2016 06:45 UTC
@revisualize Joseph
Joseph
@revisualize
Nov 16 2016 06:45 UTC
Sup?
Eric K
@EricK425
Nov 16 2016 06:45 UTC
@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 UTC
erick425 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2316 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 16 2016 06:46 UTC
@EricK425 What's your function look like now?
Eric K
@EricK425
Nov 16 2016 06:46 UTC
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 UTC
@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 UTC
@revisualize I'm not sure what you mean
Joseph
@revisualize
Nov 16 2016 06:48 UTC
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 UTC
@revisualize I see. It can only have an index to check a first name
@revisualize contacts[i]
Joseph
@revisualize
Nov 16 2016 06:49 UTC
But, i means relatively nothing outside of the for loop.
Eric K
@EricK425
Nov 16 2016 06:49 UTC
@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 UTC
It isn't dumb.
It's just looking at code.
Eric K
@EricK425
Nov 16 2016 06:50 UTC
@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 UTC
Changing your logic.
Eric K
@EricK425
Nov 16 2016 06:50 UTC
@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 UTC
@EricK425 Trying to help people change their logic is why I ask questions.
Eric K
@EricK425
Nov 16 2016 06:51 UTC
@revisualize How much have you completed on this site? do you have all certs?
Joseph
@revisualize
Nov 16 2016 06:51 UTC

@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 UTC
@revisualize is your career in software or programming
Joseph
@revisualize
Nov 16 2016 06:51 UTC
@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 UTC
Hi, I'm having trouble with escape sequences in strings. How do I link my text window?
Joseph
@revisualize
Nov 16 2016 06:52 UTC

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 UTC
@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 UTC
Let me get some text.
ANormalSoundingName
@ANormalSoundingName
Nov 16 2016 06:52 UTC
var myStr = 'FistLine\n\SecondLine\\rThirdLine';
Eric K
@EricK425
Nov 16 2016 06:53 UTC
@ANormalSoundingName type then another to enclose your code
@ANormalSoundingName type 3 of these `
ANormalSoundingName
@ANormalSoundingName
Nov 16 2016 06:53 UTC
```var myStr = 'FistLine\n\SecondLine\\rThirdLine';
var myStr = 'FistLine\n\\SecondLine\\\rThirdLine';
Joseph
@revisualize
Nov 16 2016 06:54 UTC
@ANormalSoundingName Fist?
Eric K
@EricK425
Nov 16 2016 06:54 UTC
@ANormalSoundingName if you hit shift enter itll look like this
code
ANormalSoundingName
@ANormalSoundingName
Nov 16 2016 06:54 UTC
Haha okay thanks that got it
Eric K
@EricK425
Nov 16 2016 06:55 UTC
@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 UTC
@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 UTC
@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 UTC
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 UTC
@acting2332 Post the code you have done.
zack
@acting2332
Nov 16 2016 07:07 UTC
to be honest i dont even know where to start :$ was doing great till this one
Markus Kiili
@Masd925
Nov 16 2016 07:08 UTC
@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 UTC
kk
ancandelario2
@ancandelario2
Nov 16 2016 07:10 UTC
Having some issues with escape sequences
Joseph
@revisualize
Nov 16 2016 07:11 UTC
@ancandelario2 What's your line look like?
ancandelario2
@ancandelario2
Nov 16 2016 07:11 UTC
im afraid to even start cause the explanation has me stumped
Joseph
@revisualize
Nov 16 2016 07:12 UTC
@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 UTC
oh man
all on the same line ?
Joseph
@revisualize
Nov 16 2016 07:13 UTC
@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 UTC
var myStr=FirstLine\n
SecondLine\r
ThirdLine
thats what i have
Aamnah Akram
@aamnah
Nov 16 2016 07:17 UTC
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 UTC
@acting2332 Global scope means just the global executing context which woulb be window scope
Jordy weerwag
@TheCodeWriter1
Nov 16 2016 07:18 UTC
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 UTC
@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 UTC
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 UTC
@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 UTC
@Aamn any error? what says the console exactly
bahaa aldin
@bahaa-al-deen
Nov 16 2016 07:22 UTC
@Masd925 thanks alot
CamperBot
@camperbot
Nov 16 2016 07:22 UTC
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 UTC
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 UTC
@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 UTC
@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 UTC
any one has a shorter way to complete the challenge ?
Markus Kiili
@Masd925
Nov 16 2016 07:23 UTC
@BahaaZidan Haven't done that challenge, but I have seen it done with one regexp.
ancandelario2
@ancandelario2
Nov 16 2016 07:23 UTC
var myStr="FirstLine\n\SecondLine\rThirdLine";
can anyone help me fix this
bahaa aldin
@bahaa-al-deen
Nov 16 2016 07:24 UTC
@Masd925 WOW !!!!
ancandelario2
@ancandelario2
Nov 16 2016 07:24 UTC
i feel so retarded
Aamnah Akram
@aamnah
Nov 16 2016 07:24 UTC
@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 UTC
@TheCodeWriter1 you have fixed position for ul
bahaa aldin
@bahaa-al-deen
Nov 16 2016 07:24 UTC
only one regex !
ill search for that any way thanks alot i appreciate it
k.vincent
@bobKasbi
Nov 16 2016 07:25 UTC
@acting2332 take break then... doesn't make sense if you can't think ;-)
Markus Kiili
@Masd925
Nov 16 2016 07:25 UTC
@aamnah IndexOf looks for a substring. Here the logic demands for looking for each character individually.
Jordy weerwag
@TheCodeWriter1
Nov 16 2016 07:25 UTC
Oke thanks @bobKasbi
CamperBot
@camperbot
Nov 16 2016 07:25 UTC
:cookie: 121 | @bobkasbi |http://www.freecodecamp.com/bobkasbi
thecodewriter1 sends brownie points to @bobkasbi :sparkles: :thumbsup: :sparkles:
zack
@acting2332
Nov 16 2016 07:27 UTC
@bobKasbi thanks
CamperBot
@camperbot
Nov 16 2016 07:27 UTC
acting2332 sends brownie points to @bobkasbi :sparkles: :thumbsup: :sparkles:
:cookie: 122 | @bobkasbi |http://www.freecodecamp.com/bobkasbi
k.vincent
@bobKasbi
Nov 16 2016 07:27 UTC
@TheCodeWriter1 try also to give ul margin-top: - pixel
Jordy weerwag
@TheCodeWriter1
Nov 16 2016 07:28 UTC
Oke ill do
ancandelario2
@ancandelario2
Nov 16 2016 07:40 UTC
var myStr="FirstLine\n\SecondLine\rThirdLine"; any java experts that can fix this for me
k.vincent
@bobKasbi
Nov 16 2016 07:42 UTC
@ancadel what's the use case?
@ancadelario2 what's the use case?
ancandelario2
@ancandelario2
Nov 16 2016 07:43 UTC
"escape sequences in strings" is the challenge
Markus Kiili
@Masd925
Nov 16 2016 07:45 UTC
@ancandelario2 java ?
ancandelario2
@ancandelario2
Nov 16 2016 07:45 UTC
yeah
yes @Masd925
k.vincent
@bobKasbi
Nov 16 2016 07:46 UTC
@ancadelario2 should be javascript
Markus Kiili
@Masd925
Nov 16 2016 07:47 UTC
@ancandelario2 java is another popular language. This channel is about javascript.
kevindalgleish
@kevindalgleish
Nov 16 2016 07:47 UTC
Good morning
ancandelario2
@ancandelario2
Nov 16 2016 07:47 UTC
its javascript
sorry
Michel Pinto
@pinmi077
Nov 16 2016 07:49 UTC
Hello
can someone help me please
Markus Kiili
@Masd925
Nov 16 2016 07:49 UTC
@ancandelario2 Not your fault that they chose so stupid name for this language.
Michel Pinto
@pinmi077
Nov 16 2016 07:51 UTC
in the excercise "Stand in Line"
i have this

function nextInLine(arr, item) {
// Your code here
item -= 1;
return arr[item]; // Change this line
}

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

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

Markus Kiili
@Masd925
Nov 16 2016 07:52 UTC
@pinmi077 You need to find out the two array methods that you need, and then use them on function parameters arr and item.
k.vincent
@bobKasbi
Nov 16 2016 07:52 UTC
@ancadelario2 try escape() method
herbie vd berg
@herbievdberg
Nov 16 2016 07:53 UTC
hi all,im battling a bit with the challenge "convert celius to fahrenheit
Michel Pinto
@pinmi077
Nov 16 2016 07:53 UTC
ok I will look if I found it
ancandelario2
@ancandelario2
Nov 16 2016 07:54 UTC
var fahrenheit= celsius*9/5+32; @herbievdberg
Markus Kiili
@Masd925
Nov 16 2016 07:54 UTC
bahaa aldin
@bahaa-al-deen
Nov 16 2016 07:55 UTC
@Masd925
https://www.gorkahernandez.com/blog/validate-us-telephone-numbers-free-code-camp/
he solved it in one line
one freakin line !!!!!!!!!!!1
im speechless
Paul Hoskinson
@plhosk
Nov 16 2016 07:57 UTC
such is the power of regular expressions
if you are insane enough to understand them
herbie vd berg
@herbievdberg
Nov 16 2016 08:01 UTC
@ancandelario2 doesnt work
ancandelario2
@ancandelario2
Nov 16 2016 08:01 UTC
send me the code the way you input it
@herbievdberg copy and paste
Michel Pinto
@pinmi077
Nov 16 2016 08:02 UTC
@Masd925 Thank you it works!
CamperBot
@camperbot
Nov 16 2016 08:02 UTC
pinmi077 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2918 | @masd925 |http://www.freecodecamp.com/masd925
Michel Pinto
@pinmi077
Nov 16 2016 08:03 UTC

function nextInLine(arr, item) {
arr.push(item);
item = arr.shift();

return item; // Change this line
}

Markus Kiili
@Masd925
Nov 16 2016 08:12 UTC
@pinmi077 You can do without the item variable.
Ofor Chinedu
@oforchinedu
Nov 16 2016 08:16 UTC

Sum All Primes
Sum all the prime numbers up to and including the provided number.

A prime number is defined as a number greater than one and having only two divisors, one and itself. For example, 2 is a prime number because it's only divisible by one and two.

The provided number may not be a prime.

Remember to use Read-Search-Ask if you get stuck. Try to pair program. Write your own code.
Here are some helpful links: formular ????????

Markus Kiili
@Masd925
Nov 16 2016 08:17 UTC
@oforchinedu Do you understand what prime numbers are?
Ofor Chinedu
@oforchinedu
Nov 16 2016 08:18 UTC
yes I do numbers divisible by one and itself and no other number @Masd925 but can't seem to check if no other number can divide it
Michel Pinto
@pinmi077
Nov 16 2016 08:21 UTC
it is the modulo operator @oforchinedu
Markus Kiili
@Masd925
Nov 16 2016 08:22 UTC
@oforchinedu You could make a loop that generates numbers starting from 2 up to num, and an array of primes generated so far (empty at start). Then you need a function or code that checks whether the looped number is evenly dividable by any of the primes on the array. If not, it is a prime (add it to the array and to the sum).
Aamnah Akram
@aamnah
Nov 16 2016 08:24 UTC
@Masd925 this passes all Mutations tests but the first one mutation(["hello", "hey"]) should return false. ideas?
function mutation(arr) {

  // convert elements to strings
  var arr1 = arr[0].toLowerCase();
  var arr2 = arr[1].toLowerCase();

  for (i=0; i<arr2.length; i++) {
    if (arr1.indexOf(arr2[i]) > -1) {
      return true;
    } else {
      return false;
    }
  }
}
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 08:24 UTC
The array approach could get intense with larger numbers. I'd stick with the for loop starting at 2 and going up, but since you're doing sum I would just have a sum += number if the test for prime passes as true.
Ofor Chinedu
@oforchinedu
Nov 16 2016 08:26 UTC
@pinmi077 thanks
CamperBot
@camperbot
Nov 16 2016 08:26 UTC
oforchinedu sends brownie points to @pinmi077 :sparkles: :thumbsup: :sparkles:
:cookie: 2 | @pinmi077 |http://www.freecodecamp.com/pinmi077
Markus Kiili
@Masd925
Nov 16 2016 08:26 UTC
@aamnah You should seek for a character and return false, and figure out when to return true.
Ofor Chinedu
@oforchinedu
Nov 16 2016 08:26 UTC
@Masd925 thanks
CamperBot
@camperbot
Nov 16 2016 08:26 UTC
oforchinedu sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2919 | @masd925 |http://www.freecodecamp.com/masd925
Markus Kiili
@Masd925
Nov 16 2016 08:27 UTC
@NicksIdeaEngine But how do you do the test without the primes? If you check against all smaller numbers, it is less efficient than storing the primes.
Ryan Ledford
@rledford
Nov 16 2016 08:28 UTC
@aamnah 'he' is in both 'hello' and 'hey', your returning true on the first 'h'
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 08:29 UTC
Ahh...it's a bit late. I didn't think about it enough but now that I am, that makes sense.
    function isPrime(num){
        if (num < 2) return false;
        var max = Math.floor(Math.sqrt(num));
        for (var i = 2; i <= max; i++){
            if (num % i === 0){
                return false;
            }
        }
        return true;
    }
herbie vd berg
@herbievdberg
Nov 16 2016 08:30 UTC

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

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

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

Aamnah Akram
@aamnah
Nov 16 2016 08:30 UTC

i have tried swithcing the true/false statements,

    if (arr1.indexOf(arr2[i]) === -1) {
      return false;
    } else {
      return true;
    }

gives me the same result

Nick Garcia
@NicksIdeaEngine
Nov 16 2016 08:31 UTC
@aamnah You also changed the conditions from > to ===
Ryan Ledford
@rledford
Nov 16 2016 08:31 UTC
@aamnah you'll want to keep track of matching sequences and only return when arr2 fully matches a substring in arr1
'hey' is not in 'hello' but 'h' and 'he' is in both
Aamnah Akram
@aamnah
Nov 16 2016 08:33 UTC
@rledford like a counter?
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 08:33 UTC
@aamnah So your logic would be more along the lines of
if index i of arr1 is not equal to index i of arr2 {
  return false;
}
Then, if the entire for loop runs without returning false, return true
so return true would be after the for loop closing brackets
Stefan
@st3fun1
Nov 16 2016 08:33 UTC
guys i need some good resources to learn MVC properly front-end/back-end it doesn't matter if it is the same for both
Emerson
@DikoFaji
Nov 16 2016 08:33 UTC
@aamnah check your arr2, it only contains the word "hey", arr2(1) contains nothing in your loop
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 08:34 UTC
Oh wait. You'll want .charAt() not .indexOf() since they aren't arrays
Markus Kiili
@Masd925
Nov 16 2016 08:34 UTC
indexOf works on strings too.
Emerson
@DikoFaji
Nov 16 2016 08:35 UTC
oh i c
Johnny
@JohnnyBizzel
Nov 16 2016 08:35 UTC
@st3fun1 What have you found so far? I know Ruby on Rails uses MVC and ASP.NET has MVC too. I would start there.
Markus Kiili
@Masd925
Nov 16 2016 08:35 UTC
@aamnah Return true after the loop.
Nick Garcia
@NicksIdeaEngine
Nov 16 2016 08:35 UTC
Yeah, I need to go to sleep. @Masd925 Is right. I'm just dopey apparently
Ryan Ledford
@rledford
Nov 16 2016 08:35 UTC
@st3fun1 MEAN Web Development by Amos Haviv
this book has great explanations of MVC structure
Stefan
@st3fun1
Nov 16 2016 08:36 UTC
i want to be able to use MVC if i want to develop apps in .NET or PHP, not only Nodejs, that's why i need a good tut
Johnny
@JohnnyBizzel
Nov 16 2016 08:37 UTC
@st3fun1 Looked at Wikipedia?
Ryan Ledford
@rledford
Nov 16 2016 08:37 UTC
MVC is an organizational structure that can be implemented in any framework but I see what you mean. @st3fun1
Stefan
@st3fun1
Nov 16 2016 08:37 UTC
yeah
Michel Pinto
@pinmi077
Nov 16 2016 08:37 UTC
@herbievdberg dd you solve the problem?
Stefan
@st3fun1
Nov 16 2016 08:38 UTC
but most of the web frameworks are built on that pattern
and i want to really know how it works
Johnny
@JohnnyBizzel
Nov 16 2016 08:38 UTC
@st3fun1 Anther FCC student told me separating things into Model/ View / Controller folders is old school now.
Aamnah Akram
@aamnah
Nov 16 2016 08:38 UTC
got it, works now. thanks @Masd925 @NicksIdeaEngine @DikoFaji @rledford
CamperBot
@camperbot
Nov 16 2016 08:38 UTC
aamnah sends brownie points to @masd925 and @nicksideaengine and @dikofaji and @rledford :sparkles: :thumbsup: :sparkles:
:cookie: 263 | @dikofaji |http://www.freecodecamp.com/dikofaji
:cookie: 368 | @rledford |http://www.freecodecamp.com/rledford
:cookie: 279 | @nicksideaengine |http://www.freecodecamp.com/nicksideaengine
:star2: 2920 | @masd925 |http://www.freecodecamp.com/masd925
Ryan Ledford
@rledford
Nov 16 2016 08:38 UTC
@aamnah yw
herbie vd berg
@herbievdberg
Nov 16 2016 08:38 UTC
@pinmi077 no not yet... heres the code so far

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

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

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

Michel Pinto
@pinmi077
Nov 16 2016 08:39 UTC
// Only change code below this line
celsius= here comes the formula to convert in to celsius
// Only change code above this line
Johnny
@JohnnyBizzel
Nov 16 2016 08:39 UTC
@st3fun1 My understanding of MVC is it is a take on separation of concerns. http://www.c-sharpcorner.com/UploadFile/56fb14/understanding-separation-of-concern-and-Asp-Net-mvc/
Ryan Ledford
@rledford
Nov 16 2016 08:39 UTC
@JohnnyBizzel old school or not is there a better way to structure and organize large web apps that makes as much sense as the MVC? I'd definitely like to know about it. What did the other camper tell you was a better alternative?
Stefan
@st3fun1
Nov 16 2016 08:40 UTC
@JohnnyBizzel thanks
CamperBot
@camperbot
Nov 16 2016 08:40 UTC
st3fun1 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 823 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Michel Pinto
@pinmi077
Nov 16 2016 08:40 UTC
@herbievdberg // Only change code below this line
celsius= here comes the formula to convert in to celsius
// Only change code above this line
herbie vd berg
@herbievdberg
Nov 16 2016 08:41 UTC
@pinmi077 not working..gives me error
Johnny
@JohnnyBizzel
Nov 16 2016 08:41 UTC
@rledford Just what I heard. He said it is better to club things together now.

@rledford What he said...

I have learnt that the view folder, models folder, controller folder is old skool. The new way is to keep stuff in feature folders, so for example a shopping-cart feature is all self-contained with it's model, view, controller, test files, images etc all in that one folder. easier to maintain which makes sense.

I think I agree with this idea ^^
Michel Pinto
@pinmi077
Nov 16 2016 08:43 UTC
@herbievdberg
you must convertto Fahrenheit, so it means that you must write into the variable "fahrenheit" the formula
Markus Kiili
@Masd925
Nov 16 2016 08:43 UTC
@rledford I work with Angular, and I think nowadays its structure is called MVW (Model-View-Whatever).
Ryan Ledford
@rledford
Nov 16 2016 08:43 UTC
@JohnnyBizzel It does make sense. It would be nice to keep the features together. Did they mention anything about organizing routes for features?
KorabeL448
@KorabeL448
Nov 16 2016 08:44 UTC
function lookUpProfile(firstName, prop){
// Only change code below this line
var i=0;
var j=0;
var property2 = "";
while (i < contacts.length) {
if (contacts[i][1][firstName] == firstName) {
property2 = firstName;

} else property2 = "No such contact"; 

i++;
}
return property2;
// Only change code above this line
}
// Change these values to test your function
lookUpProfile("Akira", "likes");
What does it means? "Cannot read property "Akira" of undefined". Thanks
Michel Pinto
@pinmi077
Nov 16 2016 08:44 UTC
@herbievdberg
function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
fahrenheit= formula
// Only change code above this line
return fahrenheit;
}
Markus Kiili
@Masd925
Nov 16 2016 08:44 UTC
@KorabeL448 Try to indent the code, so it is more readable.
herbie vd berg
@herbievdberg
Nov 16 2016 08:45 UTC
@pinmi077 fahrenheit=*9+35; ?
Michel Pinto
@pinmi077
Nov 16 2016 08:45 UTC
@herbievdberg
fahrenheit= celsius*9+35;
Markus Kiili
@Masd925
Nov 16 2016 08:45 UTC
@KorabeL448 The firstname test should be if(contacts[i]["firstName"]===firstName) or if(contacts[i].firstName===firstName)
herbie vd berg
@herbievdberg
Nov 16 2016 08:45 UTC
fahrenheit=*9/5+35;
Ryan Ledford
@rledford
Nov 16 2016 08:45 UTC
@KorabeL448 there is no contactsi so it does not have a property passed to the functions firstName arg
Johnny
@JohnnyBizzel
Nov 16 2016 08:46 UTC
@rledford No, my knowledge of MVC is not great. This is the JS room after all! :P
Jeff Shapiro
@Jeff-Shapiro
Nov 16 2016 08:46 UTC
@JohnnyBizzel Knows all!!!
Michel Pinto
@pinmi077
Nov 16 2016 08:46 UTC
@herbievdberg
i don't know the formula, search it on google or something but it it's the true way :)
Ryan Ledford
@rledford
Nov 16 2016 08:46 UTC
@JohnnyBizzel I'm always looking to learn stuff. Thanks for explaining all you could. I'll look further into it.
CamperBot
@camperbot
Nov 16 2016 08:46 UTC
rledford sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:cookie: 824 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Johnny
@JohnnyBizzel
Nov 16 2016 08:46 UTC
@Jeff-Shapiro I doubt it!
@rledford ;)
Jeff Shapiro
@Jeff-Shapiro
Nov 16 2016 08:47 UTC
@JohnnyBizzel have you got any good little johnny jokes?
Johnny
@JohnnyBizzel
Nov 16 2016 08:48 UTC
@Jeff-Shapiro What are they?
Stefan
@st3fun1
Nov 16 2016 08:48 UTC
It's really nice that you can get help from experienced software developers in this community. I love it.
Michel Pinto
@pinmi077
Nov 16 2016 08:48 UTC
@herbievdberg
don't forget to include the param "celsius" into your formula :D
Jeff Shapiro
@Jeff-Shapiro
Nov 16 2016 08:48 UTC
@JohnnyBizzel maybe your famous!
Ryan Ledford
@rledford
Nov 16 2016 08:49 UTC
@KorabeL448 is there a global contacts var I'm not seeing in your code?
KorabeL448
@KorabeL448
Nov 16 2016 08:50 UTC
@rledford no there isn't. I need it?
Johnny
@JohnnyBizzel
Nov 16 2016 08:50 UTC
@Jeff-Shapiro Not yet :P
Ryan Ledford
@rledford
Nov 16 2016 08:51 UTC
yes, your looking for items in an array 'contacts' that doesn't exist
Johnny
@JohnnyBizzel
Nov 16 2016 08:51 UTC
@Jeff-Shapiro I'm not Little!
Markus Kiili
@Masd925
Nov 16 2016 08:52 UTC
@rledford There is a global contacts array in the challenge. People usually just post the function here to not fill the chat.
Johnny
@JohnnyBizzel
Nov 16 2016 08:52 UTC
@st3fun1 How did you get on with your Node app?
Ryan Ledford
@rledford
Nov 16 2016 08:52 UTC
@Masd925 ok, well then can we see the array @KorabeL448 ?
ohhhh..
mt
Markus Kiili
@Masd925
Nov 16 2016 08:53 UTC
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"]
    },
];