These are chat archives for FreeCodeCamp/HelpJavaScript

8th
Jul 2016
Tommy567295
@Tommy567295
Jul 08 2016 00:00
what about it?
Nicholas Vorraso
@nickeyvee
Jul 08 2016 00:00
Greetings everyone. Quick question, what does this error message mean?!? -----> "myStr should have encoded text with the proper escape sequences and no spacing."
Ian Arsenault
@ianarsenault
Jul 08 2016 00:01
@Tommy567295 I'm sorry, I made a mistake telling you to get rid of the numbers. I was thinking of the wrong one. It should look like this
    case 1:
      answer = "alpha";
      break;
uniforlyff
@uniforlyff
Jul 08 2016 00:01
@Tommy567295 look at your function and once it's invoked look at the argument
Ian Arsenault
@ianarsenault
Jul 08 2016 00:02
@Tommy567295 Thats how you would return the value "alpha" by passing it to the variable which you return
caseInSwitch(1) should have a value of "alpha"
Tommy567295
@Tommy567295
Jul 08 2016 00:02
what should my switch expression be?
I thought it would be ""
Ian Arsenault
@ianarsenault
Jul 08 2016 00:02
It's the numbers for each case statement
Tommy567295
@Tommy567295
Jul 08 2016 00:03
wait so it should be switch (1,2,3,4)?
Florencia
@flopywood
Jul 08 2016 00:03

GUYS, I need help with this challenge
```switch (val) {
case 1:
answer = "Marley";
break;

case 2:
  answer = "The Answer";
  break;

case 3:
  answer = "There is no #1";
 break;

case 4:
  answer = "Missed me by this much!";
break;

default:
  answer = "Ate Nine";

}```

Ian Arsenault
@ianarsenault
Jul 08 2016 00:03
See how you pass the number 1 caseInSwitch(1) into the function. The switch statment goes through each case to determine
Yeah
exactly
uniforlyff
@uniforlyff
Jul 08 2016 00:03
@Tommy567295 no
it's not switch(1, 2, 3, 4)
Tommy567295
@Tommy567295
Jul 08 2016 00:04
what is it then @uniforlyff
?
Ian Arsenault
@ianarsenault
Jul 08 2016 00:04
This message was deleted
uniforlyff
@uniforlyff
Jul 08 2016 00:04
check the function's argument and then the parameter
@Tommy567295
Ian Arsenault
@ianarsenault
Jul 08 2016 00:06
@uniforlyff Sorry thought Tommy posted the example above my previous comment
Florencia
@flopywood
Jul 08 2016 00:06

switch (val) {
case 1:
answer = "Marley";
break;

case 2:
  answer = "The Answer";
  break;

case 3:
  answer = "There is no #1";
 break;

case 4:
  answer = "Missed me by this much!";
break;

default:
  answer = "Ate Nine";

}

Can anyone help me?
Abhisek Pattnaik
@abhisekp
Jul 08 2016 00:07
@samosale
1) White space

-//obj.my prop
+obj['my prop']

2) Number

-//obj.9
+obj[9]

3) Value from a variable/ computed property

var prop = "name"
-//obj.prop
+obj[name]
Ian Arsenault
@ianarsenault
Jul 08 2016 00:07
@flopywood whats the name of that problem
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:07
@flopywood what is the problem?
@abhisekp tnx
uniforlyff
@uniforlyff
Jul 08 2016 00:07
@flopywood looks right
@flopywood maybe declare your variable answer?
Gil Martinez
@gilioo
Jul 08 2016 00:08
How do i pull the user input from a function in JS so I can convert it to celcius?
I'm using the variable that's defined in the parameters of the function but i'm getting that it's not defined
uniforlyff
@uniforlyff
Jul 08 2016 00:08
lets see ur code @gilioo
Gil Martinez
@gilioo
Jul 08 2016 00:09

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

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

uniforlyff
@uniforlyff
Jul 08 2016 00:09
@gilioo celsius*
Gil Martinez
@gilioo
Jul 08 2016 00:10
Wow, thank you lol
uniforlyff
@uniforlyff
Jul 08 2016 00:10
lel
:joy:
Florencia
@flopywood
Jul 08 2016 00:10
@uniforlyff Just resolved it! I only had to put something else. Thanks!
CamperBot
@camperbot
Jul 08 2016 00:10
flopywood sends brownie points to @uniforlyff :sparkles: :thumbsup: :sparkles:
:cookie: 390 | @uniforlyff |http://www.freecodecamp.com/uniforlyff
Gil Martinez
@gilioo
Jul 08 2016 00:10
Made me question everything I know
thank you @uniforlyff
Abhisek Pattnaik
@abhisekp
Jul 08 2016 00:10
Made me question myself
CamperBot
@camperbot
Jul 08 2016 00:10
gilioo sends brownie points to @uniforlyff :sparkles: :thumbsup: :sparkles:
:cookie: 391 | @uniforlyff |http://www.freecodecamp.com/uniforlyff
uniforlyff
@uniforlyff
Jul 08 2016 00:10
@gilioo xd
Tommy567295
@Tommy567295
Jul 08 2016 00:11
thank you @uniforlyff and @GorgonsMaze
CamperBot
@camperbot
Jul 08 2016 00:11
tommy567295 sends brownie points to @uniforlyff and @gorgonsmaze :sparkles: :thumbsup: :sparkles:
:cookie: 392 | @uniforlyff |http://www.freecodecamp.com/uniforlyff
:cookie: 306 | @gorgonsmaze |http://www.freecodecamp.com/gorgonsmaze
uniforlyff
@uniforlyff
Jul 08 2016 00:11
:+1:
matthew3454
@matthew3454
Jul 08 2016 00:11
Why won't the code that I found online for completing the Roman Numeral Converter Work? Does Anyone Know
Here it is:
// Create arrays with default conversion with matching indices.
  var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
  var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];

  // Create a copy of num to work on and an empty string variable for the final roman number
  var numCopy = num;
  var romanized = '';

  // While the decimal number is greater than 0,
  while (numCopy > 0) {
    // Loop through the indices of the decimalValue array.
    for (var index = 0; index < decimalValue.length; index++) {
      // Get the maximum decimal number less or equal then the decimal number.
      if (+decimalValue[index] <= numCopy && +decimalValue[+index + 1] > numCopy) {
        // Add the Roman numeral & decrease numCopy by the decimal equivalent.
        romanized += romanNumeral[index];
        numCopy -= decimalValue[index];
      }
    }
  }

  return romanized;
};
kayzon
@quezanw
Jul 08 2016 00:12
how do you guys post these screenshots of your code?
uniforlyff
@uniforlyff
Jul 08 2016 00:12
@matthew3454 give me the whole function
matthew3454
@matthew3454
Jul 08 2016 00:12
@uniforlyff Yassir
@uniforlyff Hiya!!
uniforlyff
@uniforlyff
Jul 08 2016 00:13
lel
matthew3454
@matthew3454
Jul 08 2016 00:13
I missed!!
Hiya again!!
var convert = function(num) {

  // Create arrays with default conversion with matching indices.
  var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
  var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];

  // Create a copy of num to work on and an empty string variable for the final roman number
  var numCopy = num;
  var romanized = '';

  // While the decimal number is greater than 0,
  while (numCopy > 0) {
    // Loop through the indices of the decimalValue array.
    for (var index = 0; index < decimalValue.length; index++) {
      // Get the maximum decimal number less or equal then the decimal number.
      if (+decimalValue[index] <= numCopy && +decimalValue[+index + 1] > numCopy) {
        // Add the Roman numeral & decrease numCopy by the decimal equivalent.
        romanized += romanNumeral[index];
        numCopy -= decimalValue[index];
      }
    }
  }

  return romanized;
};
@uniforlyff
uniforlyff
@uniforlyff
Jul 08 2016 00:14
okay ill check it out
matthew3454
@matthew3454
Jul 08 2016 00:14
@uniforlyff Tell me if it's sexy or not.
uniforlyff
@uniforlyff
Jul 08 2016 00:14
mine's sexier ;)
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:15
@abhisekp are you still here
?
Abhisek Pattnaik
@abhisekp
Jul 08 2016 00:15
nope
matthew3454
@matthew3454
Jul 08 2016 00:15
@uniforlyff Mine's bigger!
uniforlyff
@uniforlyff
Jul 08 2016 00:15
-.-
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:15
@abhisekp why this C# code does not work https://repl.it/C9qT
Abhisek Pattnaik
@abhisekp
Jul 08 2016 00:15
i dunno C# :expressionless:
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:16
@abhisekp you know Java, they are the same
uniforlyff
@uniforlyff
Jul 08 2016 00:16
@matthew3454 try having your while loop inside for
Abhisek Pattnaik
@abhisekp
Jul 08 2016 00:16
@samosale most prolly repl expects a particular class to run
matthew3454
@matthew3454
Jul 08 2016 00:16
@uniforlyff Okay!
!!
!!
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:17
@abhisekp how to declare an instance?
Abhisek Pattnaik
@abhisekp
Jul 08 2016 00:17
@samosale i guess using new
uniforlyff
@uniforlyff
Jul 08 2016 00:17
@matthew3454 get rid of numcopy and just use the param
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:17
@abhisekp nope! does not work!
Abhisek Pattnaik
@abhisekp
Jul 08 2016 00:18
@samosale works with Java ;)
matthew3454
@matthew3454
Jul 08 2016 00:18
@uniforlyff alrighty
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:18
@abhisekp when I assign an object instance to variable should i assign the type to variable?
Abhisek Pattnaik
@abhisekp
Jul 08 2016 00:19
@samosale yes
it's a static lang.
Florencia
@flopywood
Jul 08 2016 00:19

GUYS, I NEED HELP WITH THIS```switch(val){

case(val === "bob"): 
answer = "Marley";
break;

case (val === 42):
answer = "The Answer";
break;

case(val === 1):
answer = "There is no #1";
break;

case(val === 99):
answer = "Missed me by this much!";
break;

case(val === 7):
answer = "Ate Nine";
}```

matthew3454
@matthew3454
Jul 08 2016 00:19
@uniforlyff I don't know what you mean by param
uniforlyff
@uniforlyff
Jul 08 2016 00:19
@matthew3454 the num parameter
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:19
@abhisekp but what type to put?
matthew3454
@matthew3454
Jul 08 2016 00:19
ic
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:19
in particular example?
Abhisek Pattnaik
@abhisekp
Jul 08 2016 00:20
@samosale u may assign any base class as it's type too
@samosale the type of <class name>
ronaldrdguez
@ronaldrdguez
Jul 08 2016 00:20
@samosale The environment will instantiate the class and automatically run the main method. Try this in main to get what you want
public static void Main (string[] args) { Console.WriteLine ("Hello World"); show(); }
Florencia
@flopywood
Jul 08 2016 00:20

switch(val){

case(val === "bob"): 
answer = "Marley";
break;

case (val === 42):
answer = "The Answer";
break;

case(val === 1):
answer = "There is no #1";
break;

case(val === 99):
answer = "Missed me by this much!";
break;

case(val === 7):
answer = "Ate Nine";
}

Brandon
@Charon0101
Jul 08 2016 00:20
Hey there I’m working through codeacademies javascript stuff, and I’m stuck on the functions section with mulitple parameters-
Abhisek Pattnaik
@abhisekp
Jul 08 2016 00:21
@samosale k. i gotta go... @ronaldrdguez is here to help u in C#
bye :wave:
uniforlyff
@uniforlyff
Jul 08 2016 00:21
@matthew3454 change your while loop's expression
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:21
@ronaldrdguez nope!
@abhisekp bye
:sparkles:
uniforlyff
@uniforlyff
Jul 08 2016 00:22
@matthew3454 does your while loop look like the one below
while (num >= decimalValue[index]) {
        romanized += romanNumeral[index];
        num -= decimalValue[index];
     }
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:23
@ronaldrdguez does not work https://repl.it/C9qT/2
@ronaldrdguez sorry, I forgot semicolon... but how do I instantiate a class in repl.it?
matthew3454
@matthew3454
Jul 08 2016 00:25
@uniforlyff k like.......this?
Nicholas Vorraso
@nickeyvee
Jul 08 2016 00:25
This message was deleted
CamperBot
@camperbot
Jul 08 2016 00:25
:bulb: to format code use backticks! ``` more info
uniforlyff
@uniforlyff
Jul 08 2016 00:25
lets see
matthew3454
@matthew3454
Jul 08 2016 00:26
@uniforlyff wait for it..wait for it.....
var convert = function(num) {

  // Create arrays with default conversion with matching indices.
  var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
  var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];

  // Create a copy of num to work on and an empty string variable for the final roman number
  var num;
  var romanized = '';

  // While the decimal number is greater than 0,
  while (num >= decimalValue[index]) {
        romanized += romanNumeral[index];
        num -= decimalValue[index];

    // Loop through the indices of the decimalValue array.
    for (var index = 0; index < decimalValue.length; index++) {
      // Get the maximum decimal number less or equal then the decimal number.
      if (+decimalValue[index] <= numCopy && +decimalValue[+index + 1] > numCopy) {
        // Add the Roman numeral & decrease numCopy by the decimal equivalent.
        romanized += romanNumeral[index];
        numCopy -= decimalValue[index];
      }
    }
  }

  return romanized;
};
tadah!!
uniforlyff
@uniforlyff
Jul 08 2016 00:27
@matthew3454 XD
put your while loop inside the for
ronaldrdguez
@ronaldrdguez
Jul 08 2016 00:27
@samosale Never used repl.it before. You instantiate your classes from within main.
using System;

class MainClass {

  public static void Main (string[] args) {
    Console.WriteLine ("Hello World");
    show();
    Test myTest = new Test();
    myTest.show();
  }


  public static void show () {

      Console.WriteLine ("Show C# tests");

  }
}

class Test {
    public void show() {
        Console.WriteLine("Hello from Test class");
    }
}
Nicholas Vorraso
@nickeyvee
Jul 08 2016 00:28
var myStr= "FirstLine\n\\\SecondLine\r\\\ThirdLine";

//^^this is my code, im working on Escape Sequences in strings (93).

//I get the error message: "myStr should have encoded text with the proper escape sequences and no spacing."
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:28
@ronaldrdguez is that a practice in C# world? Or just in repl.it?
matthew3454
@matthew3454
Jul 08 2016 00:29
@uniforlyff thththhththththththththththth!!! I'm making fart noises with my tounge!
uniforlyff
@uniforlyff
Jul 08 2016 00:30
@nickeyvee get rid of the extra slash after \n and \r and the reverse slash shud be before \r
chiztorismo
@chiztorismo
Jul 08 2016 00:30
please how do I get the know
uniforlyff
@uniforlyff
Jul 08 2016 00:30
@matthew3454 lets see your code
matthew3454
@matthew3454
Jul 08 2016 00:30
@uniforlyff Yesum
uniforlyff
@uniforlyff
Jul 08 2016 00:31
brb
Peter Weinberg
@no-stack-dub-sack
Jul 08 2016 00:31
So I finished my weather app, and am pretty happy with the end result, however I did a code review with a friend of mine and I know I am have some fundamental issues with my code, especially with scope. I created a new pen as a basic example of what I'm encountering, would someone mind taking a look?
matthew3454
@matthew3454
Jul 08 2016 00:31
var convert = function(num) {

  // Create arrays with default conversion with matching indices.
  var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
  var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];

  // Create a copy of num to work on and an empty string variable for the final roman number
  var num;
  var romanized = '';

  // While the decimal number is greater than 0,


    // Loop through the indices of the decimalValue array.
    for (var index = 0; index < decimalValue.length; index++) {
      // Get the maximum decimal number less or equal then the decimal number.
      if (+decimalValue[index] <= numCopy && +decimalValue[+index + 1] > numCopy) {
        while (num >= decimalValue[index]) {
        romanized += romanNumeral[index];
        num -= decimalValue[index];
        // Add the Roman numeral & decrease numCopy by the decimal equivalent.
        romanized += romanNumeral[index];
        numCopy -= decimalValue[index];
      }
    }
  }

  return romanized;
};
hiya!!
uniforlyff
@uniforlyff
Jul 08 2016 00:31
@matthew3454 ok get rid of your if
chiztorismo
@chiztorismo
Jul 08 2016 00:31

please how do I get to know

If prop is "tracks" and value isn't blank, push the value onto the end of the album's existing tracks array.

would it be like this


// 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 (prop != "tracks" && value !== ""){
  //  collection[id][prop] = value;
 //   return collection;
 // }
  if (collection[id] === false){

  }

  return collection;
}

// Alter values below to test your code
updateRecords(5439, "tracks", "Take a Chance on Me");
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:32
@ronaldrdguez also if i don't need to write the object that is calling method, how C# knows which object to call if i am using the same method name on two different object ..?
matthew3454
@matthew3454
Jul 08 2016 00:32
@uniforlyff Хорошо
uniforlyff
@uniforlyff
Jul 08 2016 00:32
..
@matthew3454 did u get it
matthew3454
@matthew3454
Jul 08 2016 00:33
@uniforlyff ..........
uniforlyff
@uniforlyff
Jul 08 2016 00:34
it shud look lyk this @matthew3454
for (var index = decimalValue.length; index >= 0; index--) {
     while (num >= decimalValue[index]) {
        romanized += romanNumeral[index];
        num -= decimalValue[index];
     }
   }
matthew3454
@matthew3454
Jul 08 2016 00:34

@uniforlyff ```
var convert = function(num) {

// Create arrays with default conversion with matching indices.
var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];

// Create a copy of num to work on and an empty string variable for the final roman number
var num;
var romanized = '';

// While the decimal number is greater than 0,

// Loop through the indices of the decimalValue array.
for (var index = 0; index < decimalValue.length; index++) {
  // Get the maximum decimal number less or equal then the decimal number.
  (+decimalValue[index] <= numCopy && +decimalValue[+index + 1] > numCopy) {
    while (num >= decimalValue[index]) {
    romanized += romanNumeral[index];
    num -= decimalValue[index];
    // Add the Roman numeral & decrease numCopy by the decimal equivalent.
    romanized += romanNumeral[index];
    numCopy -= decimalValue[index];
  }
}

}

return romanized;
};

SECOND TRY
var convert = function(num) {

  // Create arrays with default conversion with matching indices.
  var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
  var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];

  // Create a copy of num to work on and an empty string variable for the final roman number
  var num;
  var romanized = '';

  // While the decimal number is greater than 0,


    // Loop through the indices of the decimalValue array.
    for (var index = 0; index < decimalValue.length; index++) {
      // Get the maximum decimal number less or equal then the decimal number.
      (+decimalValue[index] <= numCopy && +decimalValue[+index + 1] > numCopy) {
        while (num >= decimalValue[index]) {
        romanized += romanNumeral[index];
        num -= decimalValue[index];
        // Add the Roman numeral & decrease numCopy by the decimal equivalent.
        romanized += romanNumeral[index];
        numCopy -= decimalValue[index];
      }
    }
  }

  return romanized;
};
chiztorismo
@chiztorismo
Jul 08 2016 00:34

Sorry I meant how do I check if a prop is contained in an object

would it be like this


// 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 (prop != "tracks" && value !== ""){
  //  collection[id][prop] = value;
 //   return collection;
 // }
  if (collection[id] === false){

  }

  return collection;
}

// Alter values below to test your code
updateRecords(5439, "tracks", "Take a Chance on Me");
uniforlyff
@uniforlyff
Jul 08 2016 00:35
@matthew3454
these are redundant
(+decimalValue[index] <= numCopy && +decimalValue[+index + 1] > numCopy) {
romanized += romanNumeral[index];
numCopy -= decimalValue[index];
}
ronaldrdguez
@ronaldrdguez
Jul 08 2016 00:35
@samosale In the case of show(), it is part of the same class where main is, and a static method. That is why you don't need to create an instance. In the case of the Test class, you do need to create the object as I did in Test myTest = new Test()to call methods from the Test class.
matthew3454
@matthew3454
Jul 08 2016 00:35
@uniforlyff ic
kinda....
uniforlyff
@uniforlyff
Jul 08 2016 00:36
and get rid of your var num;
Mia
@Psyconne
Jul 08 2016 00:36
@abhisekp i surrender .. I guess am no good :D
matthew3454
@matthew3454
Jul 08 2016 00:37
@uniforlyff var convert = function(num) {

  // Create arrays with default conversion with matching indices.
  var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
  var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];

  // Create a copy of num to work on and an empty string variable for the final roman number
  var num;
  var romanized = '';

  // While the decimal number is greater than 0,


    // Loop through the indices of the decimalValue array.
    for (var index = 0; index < decimalValue.length; index++) {
      // Get the maximum decimal number less or equal then the decimal number.
      {
        while (num >= decimalValue[index]) {
              // Add the Roman numeral & decrease numCopy by the decimal equivalent.
        romanized += romanNumeral[index];
        numCopy -= decimalValue[index];
      }
    }
  }

  return romanized;
};
chiztorismo
@chiztorismo
Jul 08 2016 00:37

Sorry I meant how do I check if a prop is contained in an object

would it be like this


// 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 (prop != "tracks" && value !== ""){
  //  collection[id][prop] = value;
 //   return collection;
 // }
  if (collection[id] === false){

  }

  return collection;
}

// Alter values below to test your code
updateRecords(5439, "tracks", "Take a Chance on Me");
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:37
@ronaldrdguez tnx... but why if I import both classes that have the same method names... like run()...and I just write run...
Mia
@Psyconne
Jul 08 2016 00:37
@abhisekp Can you give me the solution: Profile lookup
matthew3454
@matthew3454
Jul 08 2016 00:37
@uniforlyff ......
Davey Morales
@davey08
Jul 08 2016 00:38
function myLocalScope(myVar) {
  'use strict';
  var loc = "myVar";


}
myLocalScope();
I dont get what i am doing wrong can ya help?
uniforlyff
@uniforlyff
Jul 08 2016 00:38
@matthew3454 shud look lyk this

var convert = function(num) {
  var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
  var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];
  var romanized = '';
  for (var index = decimalValue.length; index >= 0; index--) {
     while (num >= decimalValue[index]) {
        romanized += romanNumeral[index];
        num -= decimalValue[index];
     }
   }

  return romanized;
};
matthew3454
@matthew3454
Jul 08 2016 00:38
var convert = function(num) {

  // Create arrays with default conversion with matching indices.
  var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
  var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];

  // Create a copy of num to work on and an empty string variable for the final roman number
  var num;
  var romanized = '';

  // While the decimal number is greater than 0,


    // Loop through the indices of the decimalValue array.
    for (var index = 0; index < decimalValue.length; index++) {
      // Get the maximum decimal number less or equal then the decimal number.
      {
        while (num >= decimalValue[index]) {

        // Add the Roman numeral & decrease numCopy by the decimal equivalent.
        romanized += romanNumeral[index];
        num -= decimalValue[index];
      }
    }
  }

  return romanized;
};
bleh!
```
Stephen James
@sjames1958gm
Jul 08 2016 00:39
@matthew3454 Is is not working?
Remove var num; and work from largest to smallest numbers.
Mia
@Psyconne
Jul 08 2016 00:40
guys can someone help me with Profile lookup?
uniforlyff
@uniforlyff
Jul 08 2016 00:40
@matthew3454
var convert = function(num) {

  var decimalValue = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000];
  var romanNumeral = ['I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'];

  var num; // get rid of this
  var romanized = '';

    // change this or reverse the decimalValue and romanNumeral
    for (var index = 0; index < decimalValue.length; index++) {
      { // get rid of this
        while (num >= decimalValue[index]) {
          romanized += romanNumeral[index];
          num -= decimalValue[index];
        }
    }
  }// get rid of this

  return romanized;
};
Stephen James
@sjames1958gm
Jul 08 2016 00:41
@Psyconne Surely
@Psyconne Specific questions? or you can post your code.
chiztorismo
@chiztorismo
Jul 08 2016 00:41

Sorry I meant how do I check if a prop is contained in an object

would it be like this


// 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 (prop != "tracks" && value !== ""){
  //  collection[id][prop] = value;
 //   return collection;
 // }
  if (collection[id] === false){

  }

  return collection;
}

// Alter values below to test your code
updateRecords(5439, "tracks", "Take a Chance on Me");
Mia
@Psyconne
Jul 08 2016 00:42
@sjames1958gm well this is my code, i spent the evening trying to resolve it .. Now i just want the solution :D
Aleksandar B.
@aleksandar-b
Jul 08 2016 00:42
@ronaldrdguez thank you
CamperBot
@camperbot
Jul 08 2016 00:42
samosale sends brownie points to @ronaldrdguez :sparkles: :thumbsup: :sparkles:
:cookie: 311 | @ronaldrdguez |http://www.freecodecamp.com/ronaldrdguez
matthew3454
@matthew3454
Jul 08 2016 00:43
@uniforlyff No funciona!
uniforlyff
@uniforlyff
Jul 08 2016 00:43
lets see
@matthew3454
ronaldrdguez
@ronaldrdguez
Jul 08 2016 00:43
@samosale run a quick demo, take a look https://repl.it/C9qT/3
matthew3454
@matthew3454
Jul 08 2016 00:43
...
Mia
@Psyconne
Jul 08 2016 00:43
@sjames1958gm
function lookUpProfile(firstName, prop) {
  for (var i = 0; i < contacts.length; i++) {
    if (contacts[i].firstName === firstName && contacts[i].hasOwnProperty(prop)) {
      return contacts[i][prop]; 
    } 
    else if (contacts[i].firstName !== firstName) { return "No such contact"; }

    else if (!contacts[i].hasOwnProperty(prop)) { return "No such property"; }
  }
}
// Change these values to test your function
lookUpProfile("Kristian", "lastName");
Tommy567295
@Tommy567295
Jul 08 2016 00:44
Could someone help me on "Return Early Pattern for Functions?
Mia
@Psyconne
Jul 08 2016 00:44
@sjames1958gm I tried this too
function lookUpProfile(firstName, prop) {
  var flag = 0;
  for (var i = 0; i < contacts.length; i++) {
    if (contacts[i][0] === firstName && contacts[i].hasOwnProperty(prop)) {
      flag = 1;
      return contacts[i][prop];
    }  
  } 
  if (flag === 0) {
    var j = 0;
    while(j < contacts.length) {
      if (contacts[j][0] !== firstName) { return "No such contact";}
      else if (!contacts[j].hasOwnProperty(prop)) { return "No such property";}
    }
  }
}
Tommy567295
@Tommy567295
Jul 08 2016 00:44
// Setup
function abTest(a, b) {
  // Only change code below this line
  console.log(a);
  console.log(b);
  return undefined;

  // Only change code above this line

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

// Change values below to test your code
abTest(2,2);
Stephen James
@sjames1958gm
Jul 08 2016 00:44
@Psyconne Your loop should go through all the contacts and return no such contact when the loop finishes.
matthew3454
@matthew3454
Jul 08 2016 00:45
@uniforlyff help the powerrangers are in trouble!
Mia
@Psyconne
Jul 08 2016 00:45
I understand that but i am kinda stuck here ..
Stephen James
@sjames1958gm
Jul 08 2016 00:45
@Psyconne Also your no such property needs to be only if firstnames match as well. Think about contacts as a stack of business cards and you are looking for Bob's email.
chiztorismo
@chiztorismo
Jul 08 2016 00:46
Please how do I check if a prop is contained in an object

// 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 (prop != "tracks" && value !== ""){
  //  collection[id][prop] = value;
 //   return collection;
 // }
  if (collection[id] === false){

  }

  return collection;
}

// Alter values below to test your code
updateRecords(5439, "tracks", "Take a Chance on Me");
Stephen James
@sjames1958gm
Jul 08 2016 00:46
Your first if is fine. You need something similar for no such property. Just return no such contact after the end of the for loop.
Emelin GUtierrez
@emelinpg
Jul 08 2016 00:47
Can someone help me with "Understanding Uninitialized Variables"? I am complelty lost and don't understand it
Stephen James
@sjames1958gm
Jul 08 2016 00:47
loop (if firstname match and has property - return property else if firstname match return no such property) after loop return no such contact
Mia
@Psyconne
Jul 08 2016 00:48
Really
that easy, okay let me try
uniforlyff
@uniforlyff
Jul 08 2016 00:48
@emelinpg paste :)
Stephen James
@sjames1958gm
Jul 08 2016 00:48
@emelinpg to initialize a variable you do var x = 10; your are supposed to do similiarly for a, b, c
Tommy567295
@Tommy567295
Jul 08 2016 00:48
@uniforlyff could you he;p me out
help*
CamperBot
@camperbot
Jul 08 2016 00:49

CamperBot

Hi, I'm CamperBot! I can help you in this chatroom :smile:

Basic Commands:

  • find TOPIC find all entries about topic. e.g. find js
  • wiki TOPIC show contents of topic page
  • thanks @username send brownie points to another user
  • about @username shows info on that user
  • Algorithm BONFIRENAME info on a Algorithm

meet CamperBot in FreeCodeCamp/camperbotPlayground

:pencil: read more about camperbot on the FCC Wiki

uniforlyff
@uniforlyff
Jul 08 2016 00:49
@Tommy567295 on
Tommy567295
@Tommy567295
Jul 08 2016 00:49
it's a little bit up the chat.
uniforlyff
@uniforlyff
Jul 08 2016 00:49
@matthew3454 did u get it
ok @Tommy567295
Tommy567295
@Tommy567295
Jul 08 2016 00:49
I don't get how you make those return undefined.
uniforlyff
@uniforlyff
Jul 08 2016 00:50
@Tommy567295 cuz u returned undefined
Emelin GUtierrez
@emelinpg
Jul 08 2016 00:50
@sjames1958gm Thank you! I was putting the number in quotes lol thanks!
CamperBot
@camperbot
Jul 08 2016 00:50
emelinpg sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1735 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Jul 08 2016 00:50
@emelinpg :+1:
Emelin GUtierrez
@emelinpg
Jul 08 2016 00:50
@uniforlyff I got it! thank you tho!
CamperBot
@camperbot
Jul 08 2016 00:50
emelinpg sends brownie points to @uniforlyff :sparkles: :thumbsup: :sparkles:
:cookie: 393 | @uniforlyff |http://www.freecodecamp.com/uniforlyff
chiztorismo
@chiztorismo
Jul 08 2016 00:50
thank you @sjames1958gm
CamperBot
@camperbot
Jul 08 2016 00:50
chiztorismo sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1736 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Tommy567295
@Tommy567295
Jul 08 2016 00:50
So what am I supposed to do in order to get undefined if I can't use return?
Stephen James
@sjames1958gm
Jul 08 2016 00:50
@chiztorismo :+1:
uniforlyff
@uniforlyff
Jul 08 2016 00:51
@Tommy567295 its already returning undefined XD
Stephen James
@sjames1958gm
Jul 08 2016 00:51
@Tommy567295 That is how you return undefined, but the code should only do that if a or b is < 0
pahosler
@pahosler
Jul 08 2016 00:51
maybe not the exact place to ask this but hoping someone will know in here...
hey folks, I'm working on the weather zipline... My problem is with codepen, I think... I can't access the data from http://forecast.weather.gov in codepen, but I can via my own webserver. The thing is forecast doesn't have an https equivalent...
any suggestions for a workaround or am I going to have to find a different api?
or.... can I submit code to the challenge that isn't on codepen???
or.... doesn't exactly work on codepen...
Tommy567295
@Tommy567295
Jul 08 2016 00:52
No it isn't...
it's returning null.
uniforlyff
@uniforlyff
Jul 08 2016 00:52
@Tommy567295 lets see your code
Tommy567295
@Tommy567295
Jul 08 2016 00:52
// Setup
function abTest(a, b) {
  // Only change code below this line
  console.log(a<0);
  console.log(b<0);


  // Only change code above this line

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

// Change values below to test your code
abTest(-2,2);
uniforlyff
@uniforlyff
Jul 08 2016 00:54
@Tommy567295 one the console.log is not necessary and what's the objective
Tommy567295
@Tommy567295
Jul 08 2016 00:54
Objective is: Modify the function abTest so that if a or b are less than 0 the function will immediately exit with a value of undefined.
Usmaan Ali
@usyyy
Jul 08 2016 00:54

'''
var count = 0;

function cc(card) {
// Only change code below this line
if (card >= 2 && card <= 6) {
count++;
return count + " Bet";
}
else if (card >= 7 && card <= 9) {
return count + " Hold";
}
else if (card == 10 || card == 'J' || card == 'K' || card == 'Q' || card == 'A') {
count--;
return count + " Hold";
}

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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(7); cc(8); cc(9); cc(5); cc(6);'''

CamperBot
@camperbot
Jul 08 2016 00:54
:bulb: to format code use backticks! ``` more info
Stephen James
@sjames1958gm
Jul 08 2016 00:55
@usyyy Re-read the instructions - you are supposed to compare count to 0 and return based on that.
uniforlyff
@uniforlyff
Jul 08 2016 00:56
@Tommy567295 was this created by you
return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
Mia
@Psyconne
Jul 08 2016 00:56
@sjames1958gm not working ..
function lookUpProfile(firstName, prop) {
  for (var i = 0; i < contacts.length; i++) {
    if (contacts[i][0] === firstName && contacts[i].hasOwnProperty(prop)) {
      return contacts[i][prop];
    } else if (contacts[i][0] === firstName) {return "No such property";} 
  }
  return "No such contact";
}
Tommy567295
@Tommy567295
Jul 08 2016 00:56
no
Stephen James
@sjames1958gm
Jul 08 2016 00:56
oops
Tommy567295
@Tommy567295
Jul 08 2016 00:56
@uniforlyff
uniforlyff
@uniforlyff
Jul 08 2016 00:57
@Tommy567295 ok start by trying to create an if statement
Usmaan Ali
@usyyy
Jul 08 2016 00:57
@sjames1958gm so is it totally wrong
matthew3454
@matthew3454
Jul 08 2016 00:57
@uniforlyff I did not ):
uniforlyff
@uniforlyff
Jul 08 2016 00:57
@matthew3454 lol
Stephen James
@sjames1958gm
Jul 08 2016 00:57
@Psyconne contacts[i] is an object where firstName is a property contacts[i].firstName
uniforlyff
@uniforlyff
Jul 08 2016 00:57
did you make sure you worked on a descending order
@matthew3454
Tommy567295
@Tommy567295
Jul 08 2016 00:58
if I use a if statement... how do I write that?
since I have no var to set it equal to.
Stephen James
@sjames1958gm
Jul 08 2016 00:58
@usyyy You increment / decrement count ok, add code after you if's testing count vs. 0
uniforlyff
@uniforlyff
Jul 08 2016 00:58
if(condition) {}
Mia
@Psyconne
Jul 08 2016 00:58
Oh yes
Stephen James
@sjames1958gm
Jul 08 2016 00:58
@Psyconne I feel a lightbulb coming on :)
Mia
@Psyconne
Jul 08 2016 00:59
@sjames1958gm Thank you so much, I tried a bunch ..
CamperBot
@camperbot
Jul 08 2016 00:59
psyconne sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1737 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Tommy567295
@Tommy567295
Jul 08 2016 00:59
Doesn't work @uniforlyff
uniforlyff
@uniforlyff
Jul 08 2016 00:59
@Tommy567295 what's your code
Tommy567295
@Tommy567295
Jul 08 2016 00:59
I don't think the if statement is the way to go...
Mia
@Psyconne
Jul 08 2016 00:59
@sjames1958gm yes saying 'encore' :D
Tommy567295
@Tommy567295
Jul 08 2016 00:59
// Setup
function abTest(a, b) {
  // Only change code below this line
if (a<0) {}  
if (a<0) {} 
  // Only change code above this line

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

// Change values below to test your code
abTest(-2,2);
uniforlyff
@uniforlyff
Jul 08 2016 00:59
@Tommy567295 tell me excersiz name
Tommy567295
@Tommy567295
Jul 08 2016 00:59
Return Early Pattern for Functions
Usmaan Ali
@usyyy
Jul 08 2016 00:59
@sjames1958gm not sure how to compare the count vs 0
Stephen James
@sjames1958gm
Jul 08 2016 01:00
@usyyy if (count < 0) { //do stufff}
Mia
@Psyconne
Jul 08 2016 01:00
I would say that i wasn't concentrating .. thank you :D
Stephen James
@sjames1958gm
Jul 08 2016 01:00
@Psyconne It'll take practice to not trip up on simple syntax issues
uniforlyff
@uniforlyff
Jul 08 2016 01:01
@Tommy567295 if a or b is less than 0 return undefined
you can use logical or ||
Tommy567295
@Tommy567295
Jul 08 2016 01:01
it wouldn't work since there's two returns.
that's what I tried originally.
Mia
@Psyconne
Jul 08 2016 01:01
@sjames1958gm Of course, good luck and good night guys :D
uniforlyff
@uniforlyff
Jul 08 2016 01:02
u tried this?
if(a < 0 || b < 0) {
    return undefined;
  }
ronaldrdguez
@ronaldrdguez
Jul 08 2016 01:02
@Tommy567295 You can have as many return statements as you want.
@Tommy567295 also in JS return; is equivalent to return undefined;
uniforlyff
@uniforlyff
Jul 08 2016 01:04
^
Tommy567295
@Tommy567295
Jul 08 2016 01:04
okay thank you guys.
uniforlyff
@uniforlyff
Jul 08 2016 01:04
@Tommy567295 worked?
Tommy567295
@Tommy567295
Jul 08 2016 01:04
yeah.
herowalking
@herowalking
Jul 08 2016 01:07
Hi everyone, how to paste code here to the chat window?
Usmaan Ali
@usyyy
Jul 08 2016 01:08
HOW DO I INSERT MY CODE INTO THE CHAT WITHOUT LINK
uniforlyff
@uniforlyff
Jul 08 2016 01:08
paste
ctrl + v
herowalking
@herowalking
Jul 08 2016 01:09
just capture the code to a image and paste or copy the code to paste here directly?
uniforlyff
@uniforlyff
Jul 08 2016 01:09
help format
CamperBot
@camperbot
Jul 08 2016 01:09

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

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

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

Usmaan Ali
@usyyy
Jul 08 2016 01:10
'''
CamperBot
@camperbot
Jul 08 2016 01:10
:bulb: to format code use backticks! ``` more info
uniforlyff
@uniforlyff
Jul 08 2016 01:10
backticks ```
Usmaan Ali
@usyyy
Jul 08 2016 01:10

'''

var count = 0;

function cc(card) {
// Only change code below this line
if (card >= 2 && card <= 6) {
count++;
return count + " Bet";
}
else if (card >= 7 && card <= 9) {
return count + " Hold";
}
else if (card == 10 || card == 'J' || card == 'K' || card == 'Q' || card == 'A') {
count--;
return count + " Hold";
}

if (count > 0) {return count + " Bet";}
else if (count <= 0) {return count + " Hold";}

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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(2); cc(10);

CamperBot
@camperbot
Jul 08 2016 01:10
:bulb: to format code use backticks! ``` more info
Usmaan Ali
@usyyy
Jul 08 2016 01:10
'''
CamperBot
@camperbot
Jul 08 2016 01:10
:bulb: to format code use backticks! ``` more info
Gregory Garzon
@chibieee
Jul 08 2016 01:10
can anyone help me with my pomodoro clock project?
Josh
@joshweaver23
Jul 08 2016 01:10
help pairwise
CamperBot
@camperbot
Jul 08 2016 01:10

:point_right: algorithm pairwise [wiki]

Algorithm Pairwise

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

The program should look for pairs of numbers in the array whose sum equal the second argument arg. Then instead of adding those numbers up, their indices are to be added.

Remember that arrays start at index 0 and go from there so from [1,4,2,3,0,5] if we switch to their indices it would be [0,1,2,3,4,5]. Then, we add indices 1 + 2 + 3 + 5 and we get 11. That is what we need to return.

Relevant Links

:pencil: read more about algorithm pairwise on the FCC Wiki

Usmaan Ali
@usyyy
Jul 08 2016 01:11

'''

var count = 0;

function cc(card) {
// Only change code below this line
if (card >= 2 && card <= 6) {
count++;
return count + " Bet";
}
else if (card >= 7 && card <= 9) {
return count + " Hold";
}
else if (card == 10 || card == 'J' || card == 'K' || card == 'Q' || card == 'A') {
count--;
return count + " Hold";
}

if (count > 0) {return count + " Bet";}
else if (count <= 0) {return count + " Hold";}

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

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

CamperBot
@camperbot
Jul 08 2016 01:11
:bulb: to format code use backticks! ``` more info
herowalking
@herowalking
Jul 08 2016 01:11
what is backticks?
uniforlyff
@uniforlyff
Jul 08 2016 01:11
```
ronaldrdguez
@ronaldrdguez
Jul 08 2016 01:11
@herowalking the one to the left of 1 on most keyboards.
Diego Mayer
@Chrono79
Jul 08 2016 01:11
@usyyy don't return when you evaluate card value
uniforlyff
@uniforlyff
Jul 08 2016 01:11
below esc
Diego Mayer
@Chrono79
Jul 08 2016 01:11
@herowalking click in more info in the post above yours
Usmaan Ali
@usyyy
Jul 08 2016 01:11

var count = 0;

function cc(card) {
  // Only change code below this line
  if (card >= 2 && card <= 6) {
    count++;
    return count + " Bet";
  }
  else if (card >= 7 && card <= 9) {
    return count + " Hold";
  }
  else if (card == 10 || card == 'J' || card == 'K' || card == 'Q' || card == 'A') {
    count--;
    return count + " Hold";
  }

  if (count > 0) {return count + " Bet";}
  else if (count <= 0) {return count + " Hold";}


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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(2); cc(10);
CamperBot
@camperbot
Jul 08 2016 01:11
:bulb: to format code use backticks! ``` more info
uniforlyff
@uniforlyff
Jul 08 2016 01:12
lol
herowalking
@herowalking
Jul 08 2016 01:12
@ronaldrdguez ok, got it
Diego Mayer
@Chrono79
Jul 08 2016 01:12
@usyyy
single quote '
backtick `
You can edit your own post, right of post time the three dots ...
clintonjohn
@clintonjohn
Jul 08 2016 01:14
@Rafase282 thanks for the awesome wiki info on how to do the Largest Number in array algorithm with .bind and . apply. Very clearly written!
CamperBot
@camperbot
Jul 08 2016 01:14
clintonjohn sends brownie points to @rafase282 :sparkles: :thumbsup: :sparkles:
:star2: 1320 | @rafase282 |http://www.freecodecamp.com/rafase282
Usmaan Ali
@usyyy
Jul 08 2016 01:16
@Chrono79 life saver!
Diego Mayer
@Chrono79
Jul 08 2016 01:16
:+1:
Usmaan Ali
@usyyy
Jul 08 2016 01:16
thanks @Chrono79
CamperBot
@camperbot
Jul 08 2016 01:16
usyyy sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1447 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jul 08 2016 01:16
@usyyy don't return when you evaluate card value
Usmaan Ali
@usyyy
Jul 08 2016 01:17
@Chrono79 ```
@Chrono79

var count = 0;

function cc(card) {
  // Only change code below this line
  if (card >= 2 && card <= 6) {
    count++;
  }
  else if (card >= 7 && card <= 9) {
    count = count + 0;
  }

  else if (card == 10 || card == 'J' || card == 'K' || card == 'Q' || card == 'A') {
    count--;
  }

  if (count > 0) {return count + " Bet";}
  else if (count <= 0) {return count + " Hold";}


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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(2); cc(10);
herowalking
@herowalking
Jul 08 2016 01:18
@usyyy how do you show your code with the black background?
Diego Mayer
@Chrono79
Jul 08 2016 01:18
help format
CamperBot
@camperbot
Jul 08 2016 01:18

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

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

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

uniforlyff
@uniforlyff
Jul 08 2016 01:19
This message was deleted
Usmaan Ali
@usyyy
Jul 08 2016 01:19
COPY AND PASTE CODE (also the ``` are not ''' <-- regular quote things) @herowalking
CamperBot
@camperbot
Jul 08 2016 01:19
:bulb: to format code use backticks! ``` more info
Usmaan Ali
@usyyy
Jul 08 2016 01:19
shit @herowalking hahah
basically type 2 backsticks (not ''', theyre located next to shift key on my mac) then copy and paste code between them
CamperBot
@camperbot
Jul 08 2016 01:20
:bulb: to format code use backticks! ``` more info
Usmaan Ali
@usyyy
Jul 08 2016 01:20
basically type 2 backsticks (not ''', theyre located next to shift key on my mac) then copy and paste code between them @herowalking
CamperBot
@camperbot
Jul 08 2016 01:20
:bulb: to format code use backticks! ``` more info
Diego Mayer
@Chrono79
Jul 08 2016 01:20
@usyyy they're 3 backticks
Usmaan Ali
@usyyy
Jul 08 2016 01:21
@herowalking backticks not backsticks lol
Diego Mayer
@Chrono79
Jul 08 2016 01:21
backsticks boys :P
Usmaan Ali
@usyyy
Jul 08 2016 01:21
@Chrono79 haha thanks man, u must hate me by now, messed up the whole chat lol
CamperBot
@camperbot
Jul 08 2016 01:21
usyyy sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:warning: usyyy already gave chrono79 points
herowalking
@herowalking
Jul 08 2016 01:21
I use a windows 10 OS
ronaldrdguez
@ronaldrdguez
Jul 08 2016 01:22
@herowalking Dude you can always Ctrl-C the three backticks from the many posts here. ;)
herowalking
@herowalking
Jul 08 2016 01:24
```
private function logger($log_content)
{
if(isset($_SERVER['HTTP_APPNAME'])){ //SAE
sae_set_display_errors(false);
sae_debug($log_content);
sae_set_display_errors(true);
}else if($_SERVER['REMOTE_ADDR'] != "127.0.0.1"){ //LOCAL
$max_size = 1000000;
$log_filename = "log.xml";
if(file_exists($log_filename) and (abs(filesize($log_filename)) > $max_size)){unlink($log_filename);}
file_put_contents($log_filename, date('Y-m-d H:i:s')." ".$log_content."\r\n", FILE_APPEND);
}
}
Ian Arsenault
@ianarsenault
Jul 08 2016 01:25
three more backticks at the bottom of your code ^
herowalking
@herowalking
Jul 08 2016 01:25
blob
ronaldrdguez
@ronaldrdguez
Jul 08 2016 01:25
almost there
herowalking
@herowalking
Jul 08 2016 01:26
private function logger($log_content)
    {
        if(isset($_SERVER['HTTP_APPNAME'])){   //SAE
            sae_set_display_errors(false);
            sae_debug($log_content);
            sae_set_display_errors(true);
        }else if($_SERVER['REMOTE_ADDR'] != "127.0.0.1"){ //LOCAL
            $max_size = 1000000;
            $log_filename = "log.xml";
            if(file_exists($log_filename) and (abs(filesize($log_filename)) > $max_size)){unlink($log_filename);}
            file_put_contents($log_filename, date('Y-m-d H:i:s')." ".$log_content."\r\n", FILE_APPEND);
        }
    }
Tarun sehgal
@FCCtarun
Jul 08 2016 01:26

Javascript

Testing Objects for Properties

Instructions
Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".

How can I return property value. I have use .hasOwnProperty but it returned only True and false.

ronaldrdguez
@ronaldrdguez
Jul 08 2016 01:26
@herowalking there you go
herowalking
@herowalking
Jul 08 2016 01:27
@ronaldrdguez yes, thanks a lot
CamperBot
@camperbot
Jul 08 2016 01:27
herowalking sends brownie points to @ronaldrdguez :sparkles: :thumbsup: :sparkles:
:cookie: 312 | @ronaldrdguez |http://www.freecodecamp.com/ronaldrdguez
herowalking
@herowalking
Jul 08 2016 01:28
vm.sort = {
        column: 'id',
        direction: -1,
        toggle: function(column) {
            if (column.sortable === false)
                return;

            if (this.column === column.name) {
                this.direction = -this.direction || -1;
            } else {
                this.column = column.name;
                this.direction = -1;
            }
        }
    };
just test the ```
Carlos Vigil
@carlosvigil
Jul 08 2016 01:30
How would I use regexp to pick up adjacent letters?
function isIsogram(str){
  var cloneUne = str.toLowerCase().split('');
  var cloneDeux = str.toLowerCase().split('');

  for (var i = 0; i < cloneUne.length; i++) {

    for (var j = 1; j < cloneDeux.length; j++) {

      if (cloneUne[i] === cloneDeux[j]) {
        return false;
      } else { return true; }
    }
  }
}
Emelin GUtierrez
@emelinpg
Jul 08 2016 01:30
Can someone help me with "Compound Assignment With Augmented Addition" modual please
Carlos Vigil
@carlosvigil
Jul 08 2016 01:31
@emelinpg wiki compound assignment with augmented addition
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 01:31
@emelinpg What wrong with it
Emelin GUtierrez
@emelinpg
Jul 08 2016 01:32
I dont understand it lol
Tarun sehgal
@FCCtarun
Jul 08 2016 01:32

Javascript

Testing Objects for Properties

Instructions
Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".

How can I return property value. I have use .hasOwnProperty but it returned only True and false.

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here

  return "Not Found";
}

// Test your code by modifying these values
checkObj.hasOwnProperty("Tarun");
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 01:32
X = Y is same as X = XY @emelinpg
`code` x*=y is same as x=x*y`code`
herowalking
@herowalking
Jul 08 2016 01:33
$headers = array("Content-Type: text/xml; charset=utf-8");
$headers = array("Content-Type: text/xml; charset=utf-8");
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 01:34
This message was deleted
Emelin GUtierrez
@emelinpg
Jul 08 2016 01:35
@Huy-Ngo it says i need to use "+= operator for each variable"
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 01:36
This message was deleted
@emelinpg += and *= or whatever is similar
in case +=, it is (x+=y) == (x=x+y)
Rafael J. Rodriguez
@Rafase282
Jul 08 2016 01:38
@clintonjohn :+1:
Ray
@rbjr
Jul 08 2016 01:41
help diff two arrays
CamperBot
@camperbot
Jul 08 2016 01:41

:point_right: algorithm diff two arrays [wiki]

Algorithm Diff Two Arrays

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

Check two arrays and return a new array that contains only the items that are not in either of the original arrays.

Relevant Links

:pencil: read more about algorithm diff two arrays on the FCC Wiki

Scott
@darkgrind
Jul 08 2016 01:43
ES5 or ES6 for total beginner?
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 01:43
@rbjr let's say you have two arrays arr1 and arr2. check if each item in arr 2 is in arr1 or not by indexOf(). If it does not exist in arr1, add it to answer array.
herowalking
@herowalking
Jul 08 2016 01:43
function diffArray(arr1, arr2) {
  var newArr = [];
  // Looping through arr1 to find elements that do not exist in arr2  
  for (var i = 0; i < arr1.length; i++) {
    if (arr2.indexOf(arr1[i]) === -1){
      // Pushing the unique to arr1 elements to the newArr
      newArr.push(arr1[i]);
    }
  }
  // Looping through arr2 to find elements that do not exist in arr1
  for (var j = 0; j < arr2.length; j++) {
    if (arr1.indexOf(arr2[j]) === -1){
      // Pushing the unique to arr2 elements to the newArr    
      newArr.push(arr2[j]);
    }
  }

  return newArr;
}

diffArray([1, 2, 3, 5], [1, 2, 3, 4, 5]);
Ray
@rbjr
Jul 08 2016 01:44

``` function diffArray(arr1, arr2) {
var newArr =[];

for(i=0;i<arr1.length;i++){
  if (arr2.indexOf(arr1[i]) === -1) {
    newArr.push(arr1[i]);
  }
}
for(z=0;z<arr2.length;z++){
  if (arr1.indexOf(arr2[z]) === -1) {
    newArr.push(arr2[z]);
  }
}

return newArr;

}

diffArray([1, "calf", 3, "piglet"], [1, "calf", 3, 4]); ```

My question is
what does the -1 actually do
iterate in reverse?
Alexander Køpke
@alexanderkopke
Jul 08 2016 01:45
@darkgrind start with ES5 since that can be implemented everywhere
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 01:45
arr2.indexOf(arr1[i])=-1 mean (arr1[i]) does not exist in arr2
@rbjr
Ray
@rbjr
Jul 08 2016 01:46
so its just setting a condition that cannot be met
in order to iterate through the array?
herowalking
@herowalking
Jul 08 2016 01:47
-1 to judge the elements included or not
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 01:47
@rbjr Why cannot be met? If (arr1[i]) does not exist in arr2, it will be met
Alexander Køpke
@alexanderkopke
Jul 08 2016 01:48
@rbjr -1 is a value that indexOf returns if there is no match found. So if you check for -1 you can see if something was found or not and determined the course of action from there
Ray
@rbjr
Jul 08 2016 01:48
OH SNAP
Thanks @alexanderkopke
CamperBot
@camperbot
Jul 08 2016 01:48
rbjr sends brownie points to @alexanderkopke :sparkles: :thumbsup: :sparkles:
:cookie: 684 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 01:49
@rbjr in your example, arr2.indexOf(arr1[3]) =-1
Ray
@rbjr
Jul 08 2016 01:50
ohhh ok
thanks @Huy-Ngo
CamperBot
@camperbot
Jul 08 2016 01:50
rbjr sends brownie points to @huy-ngo :sparkles: :thumbsup: :sparkles:
:cookie: 301 | @huy-ngo |http://www.freecodecamp.com/huy-ngo
Alexander Køpke
@alexanderkopke
Jul 08 2016 01:50
@rbjr if you say: if(arr2.indexOf(arr1[i]){ this code only runs for matches found} but!: if(arr2.indexOf(arr[i] === -1){ this only runs for non matches }
Ray
@rbjr
Jul 08 2016 01:50
gotcha. thank you
Jacob Stewart
@JacobStewart1
Jul 08 2016 01:51

hey im having trouble on the palindrome challenge my code is function palindrome(str) {
var i = str.toLowerCase().replace(/\w--.," "/, '');
if (i.split('').reverse().join('') == str) {
return true;
} else {
return false;
}

} and i cant get it to work can anybody help me?

Alexander Køpke
@alexanderkopke
Jul 08 2016 01:51
:smile:
@JacobStewart1 you're comparing with str which still has all the non-alphanumeric values
Chris Katzmann
@cwkatzmann
Jul 08 2016 01:57

```
function destroyer(arr) {
// Remove all the values
var args = Array.from(arguments);
return arr.filter(function(x) {
return x !== args[1] && x !== args[2] && x !== args[3];
});
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 01:57
why don't just assign that value to str instead of add new var i? @JacobStewart1
Chris Katzmann
@cwkatzmann
Jul 08 2016 01:57
hey I have two questions about the above code
1) how do I make this handle more than three additional arguments
2) why did I find that I had to make an array from the arguments object in order for this to work?
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 01:59
@cwkatzmann 1. make a loop with i<arguments.length (args)
@cwkatzmann 2. arguments is not an array. It is an object. So, some time you have to make an array from it so that you can treat it as an array.
Alexander Køpke
@alexanderkopke
Jul 08 2016 02:02
@cwkatzmann or 1. use return args.indexOf(x) === -1;
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:02
Actually I did not make an array from it

```function destroyer(arr) {
// Remove all the values
var k;
function fil(x){
return x!=k;
}
for (i=1;i<arguments.length;i++){
k=arguments[i];
arr= arr.filter(fil);
}
return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
```

Chris Katzmann
@cwkatzmann
Jul 08 2016 02:02
@Huy-Ngo 1) I tried that but it doesnt work. it when it starts looping through the next value, that value satisfies the conditon and is returned
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:03
function destroyer(arr) {
  // Remove all the values
  var k;
  function fil(x){
    return x!=k;
  }
  for (i=1;i<arguments.length;i++){
    k=arguments[i];
    arr= arr.filter(fil);
  }
  return arr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Chris Katzmann
@cwkatzmann
Jul 08 2016 02:04
@Huy-Ngo ooo interesting
herowalking
@herowalking
Jul 08 2016 02:11
function destroyer(arr) {
  // Remove all the values
  var k;
  function fil(x){
    return x!=k;
  }
  for (i=1;i<arguments.length;i++){
    k=arguments[i];
    arr= arr.filter(fil);
  }
  return arr;
}

var newArr2 = destroyer([1, 2, 3, 1, 2, 3], 2, 3);
console.log(newArr2);
result is : [1, 1]
blob
How to prevent the prompted
@alexanderkopke
@everybody
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:16
@herowalking :) I have same problem too. It's fuckin disturbing
@all
herowalking
@herowalking
Jul 08 2016 02:17
The alert box in the right corner is prompted repeatly, I don't want it be seen by my boss.
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:17
This message was deleted
I'd close this tab if I didn't want it be seen by my boss.
herowalking
@herowalking
Jul 08 2016 02:19
But if you close this tab, you need to open it again when you want to chat here. it is not convinent
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:19
This message was deleted
herowalking
@herowalking
Jul 08 2016 02:21
@Huy-Ngo are you Gemany?
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:22
@herowalking No I'm Vietnamese
herowalking
@herowalking
Jul 08 2016 02:23
neighbor
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:24
@herowalking Wassup neighbor
herowalking
@herowalking
Jul 08 2016 02:24
I am in China
Southern China
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:24
Yes
I'm in Northern of Vietnam, so we are so close. :)
herowalking
@herowalking
Jul 08 2016 02:25
yes very close
Do you use Wechat in Vietnam?
willcodes
@willcodes
Jul 08 2016 02:26

function nextInLine(arr, item) {
testArr.shift(arr - 1);
testArr.push(item);

return item;
}

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

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

Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:26
No. @herowalking
willcodes
@willcodes
Jul 08 2016 02:26
nextInLine([2], 1) should return 2
nextInLine([5,6,7,8,9], 1) should return 5
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:31
@willcodes you should push before shift
willcodes
@willcodes
Jul 08 2016 02:32
kk
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:32
?
willcodes
@willcodes
Jul 08 2016 02:32
and then?
I am totally doing this wrong I don't fully understand it
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:33
function nextInLine(arr, item) {
  // Your code here
  arr.push(item);
  var x=arr.shift();
  return x;  // Change this line
}
Just like that
shift() don't have any arguments
markhmwong
@markhmwong
Jul 08 2016 02:34
Hello, could anyone explain how I can use jsonp in the $.getJSON method?
Sam Nave
@shrapnel2012
Jul 08 2016 02:34
Hi all. I am having an issue with with the accessing-nested objects challenge. I have the maps part done but unsure how to go about finding the dot/bracket notation. Any help would be appreciated :D
willcodes
@willcodes
Jul 08 2016 02:34
ok so I'm using push to remove
all I had to do was set my shift into a var?
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:35
@willcodes push is to add item
willcodes
@willcodes
Jul 08 2016 02:35
I know
ok I guess its fine haha, I don't fully get why but its ok
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:35
no. x=arr.shift(); mean a removed item is assigned to x. and that item is removed from arr
willcodes
@willcodes
Jul 08 2016 02:37
Yeah and you return that to display the removed item
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:37
Yes
willcodes
@willcodes
Jul 08 2016 02:38
I guess I should have read the instructions more carefully but its still a little meh
不清楚
markhmwong
@markhmwong
Jul 08 2016 02:38
my issue relates to the fact that if I pass in a question mark character through the data object the URL alters the question mark to a %3F
Chris Rutherford
@cjrutherford
Jul 08 2016 02:44
just curious.... is this a valid call to an API to work with the JSON data that comes back? weatherObject = $.getJSON("api.openweathermap.org/data/2.5/weather?lat=" + lat + "&lon=" + long);
ronaldrdguez
@ronaldrdguez
Jul 08 2016 02:45
@markhmwong Not sure about the syntax on $.getJSON(), I used $.ajax() on a pen i'm working on this way:
$.ajax(API_END_POINT, {
    data: {
      format: 'json',
      // more data here
    },
    dataType: 'jsonp',
    success: function (payload) {
      // handle payload
    }
  });
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:45
@markhmwong @cjrutherford I think you should not add ? to url.
Chris Rutherford
@cjrutherford
Jul 08 2016 02:46
@Huy-Ngo but that's how the API is signaled that parameters are to follow
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:47
@cjrutherford Uhm sorry I checked again. That work.
Chris Rutherford
@cjrutherford
Jul 08 2016 02:48
@Huy-Ngo yeah I think @markhmwong is having trouble with the ? being escaped for some reason.....
markhmwong
@markhmwong
Jul 08 2016 02:48
@ronaldrdguez thanks ronald, appreciate the input but I'm just looking for the .getJSON() method
CamperBot
@camperbot
Jul 08 2016 02:48
markhmwong sends brownie points to @ronaldrdguez :sparkles: :thumbsup: :sparkles:
:cookie: 313 | @ronaldrdguez |http://www.freecodecamp.com/ronaldrdguez
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:48
But openweathermap API require a userkey
markhmwong
@markhmwong
Jul 08 2016 02:48
As i'd like to know why it's being changed
Chris Rutherford
@cjrutherford
Jul 08 2016 02:48
@Huy-Ngo it does, but I'm not sure where it wants the key entered from its documentation....
Ngô Ngọc Đức Huy
@Huy-Ngo
Jul 08 2016 02:50
at the end of url add "&appid=" + myKey
Davey Morales
@davey08
Jul 08 2016 02:53
var myStr= "FirstLine\n\SecondLine\\rThirdLine";
can someone tell me what i am doing wrong?
Tsara Fatma L
@tsara27
Jul 08 2016 03:01
Hi @davey08
What is the test case?
Davey Morales
@davey08
Jul 08 2016 03:02
i dont know i am on escape sequence in strings? @tsara27
var myStr="\n\\\\\r";
I changed it to this and now i am missing just one of the tasks @tsara27
Zina Astafyeva
@tragetraje
Jul 08 2016 03:04
Hi all! Anybody working on 'Record collection' or could help me with?
Lino Martinez
@bodegacc
Jul 08 2016 03:05
Hey @davey08 I just finished this one. You need to use the escape for the backslash before SecondLine
@davey08 var myStr= "FirstLine\n\SecondLine\\rThirdLine";
ronaldrdguez
@ronaldrdguez
Jul 08 2016 03:06
@markhmwong encoding of ? is expected behavior. Since ? is used normally to mark the start of the query string in URLs.
Diego Mayer
@Chrono79
Jul 08 2016 03:06
@davey08 you need to escape your backslashes too
Davey Morales
@davey08
Jul 08 2016 03:06
I just got it @bodegacc thanks tho!
CamperBot
@camperbot
Jul 08 2016 03:06
davey08 sends brownie points to @bodegacc :sparkles: :thumbsup: :sparkles:
:cookie: 152 | @bodegacc |http://www.freecodecamp.com/bodegacc
Diego Mayer
@Chrono79
Jul 08 2016 03:07
@bodegacc use backticks to see your code formatted, otherwise the escaped backlslash shows like a single backslash in the chat
like this \\
Wang Zhe
@wangzheblue
Jul 08 2016 03:08
function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  // Only change code below this line
  var libObj = arguments[0];
  var testObj = arguments[1];
  var key = Object.keys(source);
  for (var i=0;i<libObj.length;i++){
    var exist = true;
    for (var j=0;j<key.length;j++){
      if (libObj[i].hasOwnProperty(key[j]) === false){
        exist = false;
      }else if (libObj[i].key[j] !== testObj.key[j]){
        exist = false;
      } 
    }
    if (exist) {arr.push(libObj[i]);}
  }


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

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
Can anyone help me why my "else if" line has something undefined?
Diego Mayer
@Chrono79
Jul 08 2016 03:09
@wangzheblue you can't use dot notation with vars
Zina Astafyeva
@tragetraje
Jul 08 2016 03:09
else if (collection[id].hasOwnProperty("tracks")) {
    collection[id].tracks.push(value);
Wang Zhe
@wangzheblue
Jul 08 2016 03:10
@Chrono79 Sorry but then what can I do?
Zina Astafyeva
@tragetraje
Jul 08 2016 03:10
Anybody know what's wrong with thay and why it doesn't pass the test?
Diego Mayer
@Chrono79
Jul 08 2016 03:10
@wangzheblue try using bracket notation instead
Wang Zhe
@wangzheblue
Jul 08 2016 03:10
@Chrono79 ok:)
Diego Mayer
@Chrono79
Jul 08 2016 03:11
@tragetraje that seems ok, your problem is in another part
Wang Zhe
@wangzheblue
Jul 08 2016 03:11
@Chrono79 ya it worked, thanks a lot man!
CamperBot
@camperbot
Jul 08 2016 03:11
wangzheblue sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1448 | @chrono79 |http://www.freecodecamp.com/chrono79
Zina Astafyeva
@tragetraje
Jul 08 2016 03:12
@Chrono79 hm, repl.it gives me this error:
TypeError: collection[id].tracks.push is not a function
@Chrono79 Could you help me to look through my code?
Diego Mayer
@Chrono79
Jul 08 2016 03:12
hmm, there is a dot between [id] and tracks, it shouldn't be there
@tragetraje give me the link to your repl.it
Zina Astafyeva
@tragetraje
Jul 08 2016 03:14
@Chrono79 Are you sure? Isn't it a dot notation?
Diego Mayer
@Chrono79
Jul 08 2016 03:14
@tragetraje no, that's why I deleted the previous answer. Link please, so I can see your whole code
Zina Astafyeva
@tragetraje
Jul 08 2016 03:17
@Chrono79 I didn't know the code in repl.it could be saved, here it is: https://repl.it/C9sg/0
Lino Martinez
@bodegacc
Jul 08 2016 03:17
@Chrono79 thanks! still trying to figure out the interface
CamperBot
@camperbot
Jul 08 2016 03:17
bodegacc sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1449 | @chrono79 |http://www.freecodecamp.com/chrono79
Zina Astafyeva
@tragetraje
Jul 08 2016 03:18
@Chrono79 Actually it works and adds the track but it doesn't pass one of fcc tests
Josh
@jnknox
Jul 08 2016 03:18

var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

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

I'm having some trouble here trying to make this code actually return the checkProp... any ideas where I went wrong?
Zina Astafyeva
@tragetraje
Jul 08 2016 03:19
@jnknox "checkProp" is a variable
@jnknox Don't use the quotes
Josh
@jnknox
Jul 08 2016 03:21
@tragetraje Thanks... I thought that was part of the problem, but I guess I had not removed the quotes from both parts. Still trying to get all the notation correct
CamperBot
@camperbot
Jul 08 2016 03:21
jnknox sends brownie points to @tragetraje :sparkles: :thumbsup: :sparkles:
:cookie: 267 | @tragetraje |http://www.freecodecamp.com/tragetraje
Zina Astafyeva
@tragetraje
Jul 08 2016 03:21
@jnknox that should work fine...
@jnknox you should remove the quotes from both statements
Josh
@jnknox
Jul 08 2016 03:23
It worked perfectly. I'm still struggling with the dot notation vs. the bracket notation. Is there a place where I should use one rather than the other?
Diego Mayer
@Chrono79
Jul 08 2016 03:23
@tragetraje you have some mistakes in your code
value could be empty string, not 0
Zina Astafyeva
@tragetraje
Jul 08 2016 03:24
@jnknox carry on with the exercises, I guess one of the later ones explains that, eg.: if the property consists of two words like "the box" you should use the brackets
Diego Mayer
@Chrono79
Jul 08 2016 03:24
then ask for prop !== "tracks"
and after creating the empty array, you need to push the value too
Josh
@jnknox
Jul 08 2016 03:25
Okay. Thanks again @tragetraje
CamperBot
@camperbot
Jul 08 2016 03:25
jnknox sends brownie points to @tragetraje :sparkles: :thumbsup: :sparkles:
:warning: jnknox already gave tragetraje points
Zina Astafyeva
@tragetraje
Jul 08 2016 03:25
@Chrono79 hmm, how can I check for emprty string? value == ""?
Diego Mayer
@Chrono79
Jul 08 2016 03:25
yes, better use ===, but == could work too (not recommended when testing 0)
Zina Astafyeva
@tragetraje
Jul 08 2016 03:26
Thanks @Chrono79!! Still struggling with == vs. ===. I'll give it a try checking for an empty value
CamperBot
@camperbot
Jul 08 2016 03:26
tragetraje sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1450 | @chrono79 |http://www.freecodecamp.com/chrono79
Faisal Zulfiqar
@faisal1337
Jul 08 2016 03:30
I am on JS[230] and I coded this "The function should check if firstName is an actual contact's firstName and the given property (prop) is a property of that contact." as
'''
for (var i = 0; i < 4; i++) {
if (contacts[i].hasOwnProperty(firstName) && contacts[i].hasOwnProperty(prop)) {
return firstName.prop;
}
}
'''
CamperBot
@camperbot
Jul 08 2016 03:30
:bulb: to format code use backticks! ``` more info
Faisal Zulfiqar
@faisal1337
Jul 08 2016 03:30
for (var i = 0; i < 4; i++) { if (contacts[i].hasOwnProperty(firstName) && contacts[i].hasOwnProperty(prop)) { return firstName.prop; } }
And it doesn't work. What am I doing wrong?
Kevin
@KevinBruland
Jul 08 2016 03:38
are you passing in prop and firstName? can you post the full code with the JS format
Chris Cuevo
@ccuevo
Jul 08 2016 03:42
for the mutation challenge, why isn't my code returning false?
function mutation(arr) {
  if (arr[0].indexOf(arr[1]) === -1) {
    return true;
  } else {
    return false;
  }
}

mutation(["hello", "hey"]);
Kevin
@KevinBruland
Jul 08 2016 03:45
@ccuevo thats checking the entire second string to see if its in the first string
so its looking for "hey" inside "hello".... when an indexOf is not matched, it returns -1
so what you have currently is saying, if "hey" is not found inside "hello", return true
Faisal Zulfiqar
@faisal1337
Jul 08 2016 03:46
@Benalron can you tell me how to format the code? I am unfamiliar with it.
jrandallhansen
@jrandallhansen
Jul 08 2016 03:47
Hey guys. I am working on writing a function to modify data in a JSON object (Record Collection challenge) and I am having trouble writing my conditional to get started
shanshanwen
@shanshanwen
Jul 08 2016 03:47
090
Chris Cuevo
@ccuevo
Jul 08 2016 03:48
hm it's weird though cause when i change return true to return false, it still does not work :(
Kevin
@KevinBruland
Jul 08 2016 03:48
three backticks, the button just to the left of 1, shift enter to go to the next line, paste your code, and then click the keyboard icon to switch back to normal mode
Chris Cuevo
@ccuevo
Jul 08 2016 03:48
for the other parameters like, "mutation(["hello", "Hello"])"
jrandallhansen
@jrandallhansen
Jul 08 2016 03:48
'If prop isn't "tracks" and value isn't blank, update or set the value for that record album's property.' Is the instruction for this portion of the requirements and this is the conditional I started
function updateRecords(id, prop, value) {
  if (collection[id][prop] != "tracks" && value !=){

      }
how can i check if value isn't blank?
Faisal Zulfiqar
@faisal1337
Jul 08 2016 03:49
function lookUpProfile(firstName, prop){
// Only change code below this line
  for (var i = 0; i < 4; i++) {
    if (contacts[i].hasOwnProperty(firstName) && contacts[i].hasOwnProperty(prop)) {
      return firstName.prop;
    }
  }
// Only change code above this line
}
Kevin
@KevinBruland
Jul 08 2016 03:49
@ccuevo @ccuevo well, Hello and hello are different things : ). Capitalization matters
jrandallhansen
@jrandallhansen
Jul 08 2016 03:49
could it simply be if (collection[id][prop] != "tracks" && value)?
Faisal Zulfiqar
@faisal1337
Jul 08 2016 03:49
@Benalron check it. I am confused in accessing the properties.
Kevin
@KevinBruland
Jul 08 2016 03:50
@faisal1337 which exercise it that for? where is contacts?
Faisal Zulfiqar
@faisal1337
Jul 08 2016 03:51
Exercise [230]. Should I post the whole code? Its lengthy.
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 03:51
@faisal1337 hi there! you are very close from getting the answer
Kevin
@KevinBruland
Jul 08 2016 03:51
@faisal1337 you can tell me the name of the exercise, I can check
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 03:52
@faisal1337 at that point you are looping through the contacts using contacts[i] correct? well if the contact is found, then you would return contacts[i][prop];
remember that each item inside the object takes the place of contacts[i]
thus contacts[0] would return
```js
ah snap, i forgot how to enter code, yo bot, how do we enter code in here?
sigh.....
how to enter code?
Kevin
@KevinBruland
Jul 08 2016 03:55
camperbot code format?
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 03:55
camperbot code format
Faisal Zulfiqar
@faisal1337
Jul 08 2016 03:55
three backticks, the button just to the left of 1, shift enter to go to the next line, paste your code, and then click the keyboard icon to switch back to normal mode
Benalron told me this ^
Works
Kevin
@KevinBruland
Jul 08 2016 03:56
yeah
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 03:56
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    }
well the above
Faisal Zulfiqar
@faisal1337
Jul 08 2016 03:56
@AleCx4 he is asking that you should check if firstName is an actual contacts first name and prop is a property of contact
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 03:57
@faisal1337 I know, I have done that same assignment already
and you are almost there
Faisal Zulfiqar
@faisal1337
Jul 08 2016 03:57
so contacts[i].hasOwnProperty(firstName) will check
if
there's a property by the name of'firstName'
right?
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 03:57
almost almost!
Kevin
@KevinBruland
Jul 08 2016 03:58
when you're returning firstName.prop... what that would be returnning is the .prop of an object called firstName
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 03:58
contacts[i].firstName === firstName is the check we want to do since firstName is being passed as the function's argument
so if contacts[i].firstName === firstName AND contacts[i].hasOwnProperty(prop) then we do the thing
see there?
Kevin
@KevinBruland
Jul 08 2016 03:58
your return statement does not reference where to get firstName.prop from
Faisal Zulfiqar
@faisal1337
Jul 08 2016 03:59
I am going to change the return statement waity
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 04:00
contacts[i].firstName === firstName is the check we want to do since firstName is being passed as the function's argument
so if contacts[i].firstName === firstName AND contacts[i].hasOwnProperty(prop) then we do the thing
@faisal1337 you are almost there, update, test and let us now
know**
Faisal Zulfiqar
@faisal1337
Jul 08 2016 04:00
3 checks passed. Thanks.
But wait. I have some questions to ask.
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 04:01
go ahead :)
Faisal Zulfiqar
@faisal1337
Jul 08 2016 04:03
Lets say this is our function call "lookUpProfile("Akira", "likes");"
and this is the check inside the for loop "if (contacts[i].firstName === firstName && contacts[i].hasOwnProperty(prop))"
so now contacts[i].firstName will loop through the contacts list and will match the value of the firstName inside the list with the parameter passed. And contacts[i].hasOwnProperty(prop) will loop through the contact list and will check whether the passed 'prop' is a property or variable inside the contacts list?
danielrobar3
@danielrobar3
Jul 08 2016 04:03
Can someone help with escape sequences in strings?
I seem to be stuck

Here is the text with the escape sequences written out.

FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine

var myStr = "FirstLine\n\SecondlLine\\rThirdLine";
I've tried it about 10 different ways and can't seem to figure it out
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 04:06
@faisal1337 they are not two separate loops, they are one full check being done on each iteration of the loop so both checks will happen on contacts[0], then on contacts1 and so on , we use the and(&&) check here because we want to return the property (contacts[i][prop]) in the event of both checks satisfying our search query
@danielrobar3 hi there! which problem number is that?
danielrobar3
@danielrobar3
Jul 08 2016 04:07
144 I believe
Faisal Zulfiqar
@faisal1337
Jul 08 2016 04:07
Alright. Thanks man. This code passes the first 3 checks. Now I should use else if (contacts[i].firstName != firstName) If it is true then return "No such contact"
I did this. But this ain't working either.
Matt
@TheeMattOliver
Jul 08 2016 04:08
@danielrobar3 that one is really unforgiving syntax-wise, which I believe is the point
Faisal Zulfiqar
@faisal1337
Jul 08 2016 04:08
I think the else if will terminate on the first iteration if the firstName doesn't matches the firstName in the contacts.
danielrobar3
@danielrobar3
Jul 08 2016 04:08
Any tips as to what I'm doing wrong? I searched all over and am having trouble
Will
@Will-is-Coding
Jul 08 2016 04:09
@danielrobar3 Put your code in ` backticks `
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 04:09
@danielrobar3 please put your code here
Matt
@TheeMattOliver
Jul 08 2016 04:09
@danielrobar3 help format
help format
CamperBot
@camperbot
Jul 08 2016 04:09

:point_right: code formatting [wiki]

Multi line Code

```js ⇦ Type 3 backticks and then press [shift + enter ⏎] (type js or html or css)

<paste your code here>,
then press [shift + enter ⏎]

``` ⇦ Type 3 backticks, then press [enter ⏎]

Single line Code

This an inline `<paste code here>` code formatting with a single backtick() at _start_ and _end_ around thecode`.

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

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

Will
@Will-is-Coding
Jul 08 2016 04:09

Also remember

FirstLine
\SecondLine\
Thirdline

Is the intended output

Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 04:09
@faisal1337 once you do the pass the else and if statement will become easy, wanna give it a go and post your code in here?
danielrobar3
@danielrobar3
Jul 08 2016 04:09
var myStr = "FirstLine\n\\SecondlLine\\\rThirdLine";
I think I am misreading or misunderstanding this one
Matt
@TheeMattOliver
Jul 08 2016 04:10
looks like they've changed it from the way it was yesterday, which is good
hang on
danielrobar3
@danielrobar3
Jul 08 2016 04:11
I am missing a proper escape sequence somewhere
Will
@Will-is-Coding
Jul 08 2016 04:11
Your current string prints like this
FirstLine
\SecondLine\ThirdLine
danielrobar3
@danielrobar3
Jul 08 2016 04:12
is the carriage return not working?
Mustafijur rahman
@Dinar717
Jul 08 2016 04:13
@danielrobar3 secondlLine lol
mistyped @danielrobar3
Will
@Will-is-Coding
Jul 08 2016 04:13
This message was deleted
danielrobar3
@danielrobar3
Jul 08 2016 04:14
hahaha
wow I spent an hour on that...reread it a ton and still didn't see it...
Will
@Will-is-Coding
Jul 08 2016 04:14
Oh hah
danielrobar3
@danielrobar3
Jul 08 2016 04:14
Thanks a ton!!!!!
Will
@Will-is-Coding
Jul 08 2016 04:14
Someone else did that today but with Thirdline
danielrobar3
@danielrobar3
Jul 08 2016 04:14
I was convinced it was a bug
Mustafijur rahman
@Dinar717
Jul 08 2016 04:14
@danielrobar3 :+1:
Kevin
@KevinBruland
Jul 08 2016 04:14
@danielrobar3 been there before lol
danielrobar3
@danielrobar3
Jul 08 2016 04:15
Thanks!!!!
kuldeep
@gurukd
Jul 08 2016 04:16
help Smallest Common Multiple
CamperBot
@camperbot
Jul 08 2016 04:16

:point_right: algorithm smallest common multiple [wiki]

Algorithm Smallest Common Multiple

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

The smallest common multiple between two numbers is the smallest number that both numbers can divide into. This concept can be extended to more than two numbers as well.

We can first start with just finding the smallest common multiple between two numbers. Naively, you can start writing out multiple of each number until you write a multiple that exists from both numbers.

An example would be the numbers 3 and 4. The multiples of 3 are 3, 6, 9, 12, 15, 18, ... and the multiples of 4 are 4, 8, 12, 16, 20, .... The first smallest number we run into in both lists is 12 so this is the smallest common multiple between 3 and 4.

This problem can be confusing because most people look for the smallest common multiple of just the two numbers but forget the keyword range. However, this means that if you are given [1,5], then you have to check for the smallest common multiple for all the numbers [1,2,3,4,5] that is evenly divisible by all of them.

Relevant Links

:pencil: read more about algorithm smallest common multiple on the FCC Wiki

Brian
@BrianCodes33
Jul 08 2016 04:17
for removing punctuation, symbols and characters in RegEx
var regex = \s\W[^ABC]
Kevin
@KevinBruland
Jul 08 2016 04:17
@gurukd Good luck
Brian
@BrianCodes33
Jul 08 2016 04:17
is that right?
Kevin
@KevinBruland
Jul 08 2016 04:17
@BrianCodes33 open with a backslash and end with a backslash
Mustafijur rahman
@Dinar717
Jul 08 2016 04:18
@BrianCodes33 check http://regexr.com/ website to live check
id recommend reading the entire thing, you will need a lot of regex knowledge for future exercises
Brian
@BrianCodes33
Jul 08 2016 04:19
ok ill read up on it
but for now just check if this is right
var regex = /\s\W[^ABC]/g;
Mustafijur rahman
@Dinar717
Jul 08 2016 04:19
@BrianCodes33 yes you must read first.
kuldeep
@gurukd
Jul 08 2016 04:19
@Benalron thanks
CamperBot
@camperbot
Jul 08 2016 04:19
gurukd sends brownie points to @benalron :sparkles: :thumbsup: :sparkles:
:cookie: 348 | @benalron |http://www.freecodecamp.com/benalron
Will
@Will-is-Coding
Jul 08 2016 04:20
Space then not a word and not A or B or C? @BrianCodes33 What are you trying to do?
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 04:20
@BrianCodes33 the best one I have is this one
Kevin
@KevinBruland
Jul 08 2016 04:20
@gurukd for me... that was the hardest one I have done
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 04:20
.replace(/[^a-zA-Z0-9+]/g,"")
Brian
@BrianCodes33
Jul 08 2016 04:20
palindorme exercise
You'll need to remove all non-alphanumeric characters (punctuation, spaces and symbols) and turn everything lower case in order to check for palindromes.
var regex = /\s\W[^ABC]/g;
var lowerCase = str.lowercase();
Will
@Will-is-Coding
Jul 08 2016 04:22
Well @AleCx4 rather gave you the answer...
kuldeep
@gurukd
Jul 08 2016 04:22
@Benalron Yes I know hardest part would be range between two numbers and to know that is it divisible or not? Quite confusing
Will
@Will-is-Coding
Jul 08 2016 04:22
@BrianCodes33 Try that www.regexr.com for a quick learn, or www.regexone.com for in depth
Kevin
@KevinBruland
Jul 08 2016 04:23
@gurukd theres an easy way and a hard way to do it, the hard way required me learning about math related stuff I did not know
Brian
@BrianCodes33
Jul 08 2016 04:23
ok i will but for now i just want to solve algorithm
so can you help me
Will
@Will-is-Coding
Jul 08 2016 04:23
Well that's part of solving it
Kevin
@KevinBruland
Jul 08 2016 04:23
@gurukd if you want to look into how to do it the hard (but more efficient) way, look into "euclids algorithm"
Brian
@BrianCodes33
Jul 08 2016 04:23
var regex = /\s\W[^ABC]/g;
Mustafijur rahman
@Dinar717
Jul 08 2016 04:23
@BrianCodes33 \w
will check each word character(alphanumaric) and underscore
Brian
@BrianCodes33
Jul 08 2016 04:24
why is it lowercase. it says anything that isn't a word
Enrique Alejandro Arzamendi Picazzo
@AleCx4
Jul 08 2016 04:24
@Will-is-Coding sortakinda hehe, sorry about that
Mustafijur rahman
@Dinar717
Jul 08 2016 04:26
@BrianCodes33 \w Word. Matches any word character (alphanumeric & underscore).
\W is - not a word character.
kuldeep
@gurukd
Jul 08 2016 04:27
@Benalron Okay first i will try to find solution by myself if i stuck then go for the references.
Kevin
@KevinBruland
Jul 08 2016 04:28
@gurukd good call... thats what I did, until I realized I could not find a way to calculate lowest common multiples without a special formula
kuldeep
@gurukd
Jul 08 2016 04:31
```
function smallestCommons(arr) {
  var paramOne=[];
  var paramTwo=[];
  var str=[];
  var flag = false;
  var finalValue;
  var uptoLength = 60;
  lcm(); 

 function lcm(){
  for(var i=1; i<= uptoLength; i++){
     paramOne.push(arr[0]*i);
     paramTwo.push(arr[1]*i);
   }
}
paramOne.map(function(val){
    if(paramTwo.indexOf(val)!==-1){
         str.push(val);
}
}); 
str.map(function(checkDiv){
  for(var j=arr[0]+1; j <arr[1]; j++){
      if(checkDiv % j === 0){
          finalValue = checkDiv;
          flag = true;
}else {
   flag = false;
}
} 
});
if(!flag){
  uptoLength +=10;
  paramOne = [];
  paramTwo = [];
  lcm();
}
else {
return finalValue;
}

}
@Benalron I'm stuck now.
@Benalron Sorry for not commenting
Kevin
@KevinBruland
Jul 08 2016 04:32
@gurukd its looking for the lowest common multiple in the entire range of numbers
Brian
@BrianCodes33
Jul 08 2016 04:34
function palindrome(str) {
  var regex = /\s\w[ABC]/g;
  var lowerCase = str.toLowerCase();
  var reversedStr = str.split('').reverse().join('');

  if (reversedStr === palindrome) {
  return true;
} else {
  return false;
}
}


palindrome("eye");
what am i doing wrong here
Kevin
@KevinBruland
Jul 08 2016 04:34
@gurukd so say for example, you had [1,4]... its looking for the LCM of 1,2,3,4... which in that case... the result would be 12
Srikar Samudrala
@srikarsams
Jul 08 2016 04:36
This message was deleted
CamperBot
@camperbot
Jul 08 2016 04:36
:bulb: to format code use backticks! ``` more info
kuldeep
@gurukd
Jul 08 2016 04:36
@Benalron Yes ur right.
Srikar Samudrala
@srikarsams
Jul 08 2016 04:38
function updateRecords(id, prop, value) {
  if(prop != "tracks" && value.length !== 0){

    collection.id[prop] = value;
  }
  if(prop === "tracks" && collection.hasOwnProperty("tracks")){
    collection.id.tracks = [""];
    collection.id.tracks.push(value);
  }
  if(prop ==="tracks" && value !== null){
    collection.id.tracks.push(value);
  }
  if(collection.id.prop === null){
    delete collection.id.prop;
  }
  return collection;
}
What's wrong in the code?
Will
@Will-is-Coding
Jul 08 2016 04:41
@srikarsams First it may have an issue with value.length !== 0 as value might be '' which is undefined essentially. But also look into bracket notation which is linked in the instructions. Currently you are trying this: collection."2556"."artist"
Eder Rodriguez
@Ederrod
Jul 08 2016 04:43
@srikarsams Doesn't collection.hasOwnProperty("tracks") has to equal false.
Srikar Samudrala
@srikarsams
Jul 08 2016 04:46
@Will-is-Coding @Ederrod I'll change those and try again
Jonathan Leon
@Wo1v3r
Jul 08 2016 04:46
@srikarsams I've had a problem with that yesterday, try wrapping all of it first with if ( value == "") else statement
They expect you do evaluate "value" first for some reason
can someone help me with this :

```js function palindrome(str) {
// Good luck!

//First we will remove all non alpha-numerics:

var regexObj = /[^a-z]/gi;
var newStr = str.replace(regexObj,'');
newStr = newStr.toLowerCase();
var newArr = newStr.split('');
newArr.reverse();
var newStr2= newArr.join('');
console.log(newStr);
console.log(newStr2);
return (newStr == newStr2);

}

palindrome("eye");

oh sorry it didnt markdown

```js function palindrome(str) {
// Good luck!

//First we will remove all non alpha-numerics:

var regexObj = /[^a-z]/gi;
var newStr = str.replace(regexObj,'');
newStr = newStr.toLowerCase();
var newArr = newStr.split('');
newArr.reverse();
var newStr2= newArr.join('');
console.log(newStr);
console.log(newStr2);
return (newStr == newStr2);

}

palindrome("eye");

oh my god sorry :(:(
Jānis
@CodeNewbee
Jul 08 2016 04:49
I'm working on sum all odd fibonacci numbers, but this code doesn't work only on one test (sumFibs(75024)) and i don't understand why since the number is so big and it works on all other test values.

function sumFibs(num) {
  var val = 1;
  var prevVal = 1;
  var sum = 1;
  while (sum <= num) {
    if (val % 2 !== 0) {
      sum += val;
    }
    val += prevVal;
    prevVal = val - prevVal;
  }
  return sum;
}

sumFibs(75024);
Will
@Will-is-Coding
Jul 08 2016 04:51
@Wo1v3r Works for me
Srikar Samudrala
@srikarsams
Jul 08 2016 04:51
@Will-is-Coding @Ederrod @Wo1v3r
Cannot read prop of undefined
Jonathan Leon
@Wo1v3r
Jul 08 2016 04:52
@Will-is-Coding What works? :]
Srikar Samudrala
@srikarsams
Jul 08 2016 04:52
what should i do?
Will
@Will-is-Coding
Jul 08 2016 04:52
@Wo1v3r Your palindrome function. What test is it not passing?
@srikarsams How are accessing the collection?
Jonathan Leon
@Wo1v3r
Jul 08 2016 04:54
@Will-is-Coding Sorry it didnt pass on the 1 eye for 1 ... because I didnt include 0-9 there
just figured it after looking again at the code
Will
@Will-is-Coding
Jul 08 2016 04:55
Oh digits
Jonathan Leon
@Wo1v3r
Jul 08 2016 04:55
@Will-is-Coding ty tho :)
CamperBot
@camperbot
Jul 08 2016 04:55
wo1v3r sends brownie points to @will-is-coding :sparkles: :thumbsup: :sparkles:
:cookie: 461 | @will-is-coding |http://www.freecodecamp.com/will-is-coding
Will
@Will-is-Coding
Jul 08 2016 04:55
Lol, no problem
Markus Kiili
@Masd925
Jul 08 2016 04:55
@CodeNewbee Are you sure you need to test that sum<=num. You are supposed to generate fibos up to <=num.
Rohan Mohammad
@reolander
Jul 08 2016 04:57
How do i add snapshot regarding my problem here?
Brian
@BrianCodes33
Jul 08 2016 04:58
function palindrome(str) {
  var regex = /[^a-z]/gi;
  var replacedStr = str.replace(regex, '').toLowerCase().split('').reverse().join('');

  if (replacedStr === str) {
  return true;
} else {
  return false;
}
}


palindrome("eye");
any clues?
kuldeep
@gurukd
Jul 08 2016 04:59
@CodeNewbee Yes @Masd925 is right. I think val <= num should be there.
Jonathan Leon
@Wo1v3r
Jul 08 2016 04:59
= @BrianCodes33 you compared to str which is the original string without the changes
@BrianCodes33 you need to create a new variable to hold it before reverse and after reverse
Will
@Will-is-Coding
Jul 08 2016 05:00
Also don't make @Wo1v3r mistake and forget numbers
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:00
@Will-is-Coding @BrianCodes33 yup your regex should be [^a-z0-9]
@BrianCodes33 btw you should use console.log(arg) and ctrl-shift-i in chrome and check the console to debug it if you have any problems
Brian
@BrianCodes33
Jul 08 2016 05:03
jonathan you mind helping me on PM ?
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:04
sure
Mustafijur rahman
@Dinar717
Jul 08 2016 05:12
function palindrome(str) {
  var regex = /[^a-z0-9]/gi;
  var replacedStr = str.replace(regex ,'').toLowerCase().split('').reverse().join('');

  str=str.replace(regex,'').toLowerCase();
  if (replacedStr === str) {
  return true;
} else {
  return false;
}
}


palindrome("1 eye for of 1 eye.");
@BrianCodes33
Srikar Samudrala
@srikarsams
Jul 08 2016 05:12
@Ederrod @Will-is-Coding @Wo1v3r thanks guys i got it:)
CamperBot
@camperbot
Jul 08 2016 05:12
srikarsams sends brownie points to @ederrod and @will-is-coding and @wo1v3r :sparkles: :thumbsup: :sparkles:
:cookie: 212 | @ederrod |http://www.freecodecamp.com/ederrod
:cookie: 251 | @wo1v3r |http://www.freecodecamp.com/wo1v3r
:cookie: 462 | @will-is-coding |http://www.freecodecamp.com/will-is-coding
Will
@Will-is-Coding
Jul 08 2016 05:14
Glad you got it working @srikarsams Nicely done
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:16
@srikarsams GJ :D
bradulz
@bradulz
Jul 08 2016 05:20
Can someone please explain how to do the Smallest Common Multiple challenge without having to make 1000's of if statements occur?
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:21
@bradulz I don't know which challenge your talking about but from my experience with algorithms you would have to skipped based on a mathematical reason
to skip*
in order to evaluate common multiples without iterating by ++ untill number was reached
It's really helpful to look up on math exchange after solving an algorithm to see a better solution (again Im not sure about the challenge, I'm talking from SE studies experience)
bradulz
@bradulz
Jul 08 2016 05:24
I was thinking about taking the highest number, times it by highest number - 1, then see if thats a lcm, then if not, times it by highest number -2, etc but don't know if that is reliable
yeah I could but don't want to give up entirely just yet
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:25
well what im sure of is that you can check up to a square root of the number
but I study math in a different language so maybe were talking about different things , can you link me to the challenge?
Keone Martin
@Athaman
Jul 08 2016 05:26
so what i do @Wo1v3r is take the array your passed and sort it, then make a new array containing all the numbers between those two numbers
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:27
oO I was taljing about something else I guess, can you please link me to the challenge?
from what @Athaman says it sounds .map then .reduce would be really helpful here
Keone Martin
@Athaman
Jul 08 2016 05:28
then make a while loop condtional on isCommonMultiple... inside that you set a smallest variable equal to the larger number, and send it to a separate function to test if it's a common
yeah, my solution is not the best i think
but it passes, i'll refactor it at a later date :)
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:28
can you send me the callenge please?
that's the challenge
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:34
Hm
Well you can always check the range first for prime numbers
That would save alot of time
Keone Martin
@Athaman
Jul 08 2016 05:35
well, it would make your code more efficient, but with the ranges you're dealing with implementing a prime check is probably excessive
the best efficiency save is to increase smallest in increments of your highest value instead of ++
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:35
I think Math object already has a prime check function ready, but yes youre right about that anyway
Well thats definetly a challenge to come back to and refractor
It's more like a riddle , solving it straight up is really easy in comparison to other algorithms
but making it efficient is harder
Keone Martin
@Athaman
Jul 08 2016 05:37
oh yeah, if Math already has one then it's probably worth it... i'm pretty new with JS still so i don't know what is premade for us
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:38
Can you paste your solution? did you use the remainder operator ?
Keone Martin
@Athaman
Jul 08 2016 05:38
yeah modulo everything
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:39
oh i was wrong it doesnt have a prime function in math
Keone Martin
@Athaman
Jul 08 2016 05:39
i'll PM it to you so as not to spoil it for bradulz
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:39
at least google doesnt find it
alright
Markus Kiili
@Masd925
Jul 08 2016 05:40
@Athaman Doing Smallest commons on one line is fun.
Keone Martin
@Athaman
Jul 08 2016 05:40
challenge accepted
Mathew Joseph
@MathewtheCoder
Jul 08 2016 05:40
Is there any way to make our page wait for API call to finish in Javascript
Keone Martin
@Athaman
Jul 08 2016 05:40
not right now but i'll get there eventually @Masd925
currently i'm taking ~20 lines
bradulz
@bradulz
Jul 08 2016 05:42
help Smallest Common Multiple
CamperBot
@camperbot
Jul 08 2016 05:42

:point_right: algorithm smallest common multiple [wiki]

Algorithm Smallest Common Multiple

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

The smallest common multiple between two numbers is the smallest number that both numbers can divide into. This concept can be extended to more than two numbers as well.

We can first start with just finding the smallest common multiple between two numbers. Naively, you can start writing out multiple of each number until you write a multiple that exists from both numbers.

An example would be the numbers 3 and 4. The multiples of 3 are 3, 6, 9, 12, 15, 18, ... and the multiples of 4 are 4, 8, 12, 16, 20, .... The first smallest number we run into in both lists is 12 so this is the smallest common multiple between 3 and 4.

This problem can be confusing because most people look for the smallest common multiple of just the two numbers but forget the keyword range. However, this means that if you are given [1,5], then you have to check for the smallest common multiple for all the numbers [1,2,3,4,5] that is evenly divisible by all of them.

Relevant Links

:pencil: read more about algorithm smallest common multiple on the FCC Wiki

Mathew Joseph
@MathewtheCoder
Jul 08 2016 05:43
help API Call wait
CamperBot
@camperbot
Jul 08 2016 05:43
no wiki entry for: api call wait
shanshanwen
@shanshanwen
Jul 08 2016 05:49

从Celsius摄氏度转换为Fahrenheit华氏度的算法是:摄氏度的温度乘于9除于5,再加上32。

创建一个变量 fahrenheit,然后计算出摄氏度对应的华氏度

help me1
CamperBot
@camperbot
Jul 08 2016 05:49
no wiki entry for: me1
shanshanwen
@shanshanwen
Jul 08 2016 05:49
help me
CamperBot
@camperbot
Jul 08 2016 05:49

:point_right: adding environment variables [wiki]

Adding Envirioment Variables in Windows

Via GUI

  1. Download Varpanel.
  2. Open Varpanel.
  3. In PATH variable, add the relevant path (for example).

Via Command Line

Refer to this answer on Super User.

:pencil: read more about adding environment variables on the FCC Wiki

Mahade Walid
@walidmahade
Jul 08 2016 05:50
why does FCC consoles logs everything twice ?
shanshanwen
@shanshanwen
Jul 08 2016 05:50
The algorithm is converted from Celsius degrees Celsius to Fahrenheit degrees Fahrenheit: the temperature by 9 degrees Celsius in addition to 5, plus 32.
Create a variable Fahrenheit, and then calculate the degree of degrees Celsius.
Brian
@BrianCodes33
Jul 08 2016 05:57
someone help me with longest string algorithm please?
Jonathan Leon
@Wo1v3r
Jul 08 2016 05:57
sure
Brian
@BrianCodes33
Jul 08 2016 05:57
jon get back to me on PM
Keone Martin
@Athaman
Jul 08 2016 05:57
@walidmahade it does?
Mahade Walid
@walidmahade
Jul 08 2016 05:58
yes
trying to solve profile lookup challange
:worried:
Markus Kiili
@Masd925
Jul 08 2016 05:59
@walidmahade One of the most discussed challenges here.
Mahade Walid
@walidmahade
Jul 08 2016 06:00
may be
contact[i] has four objects in it, how do I access the first object ?
@Athaman
Markus Kiili
@Masd925
Jul 08 2016 06:01
@walidmahade You just access the object with dot or bracket notation. Checking first name is the first thing.
Mahade Walid
@walidmahade
Jul 08 2016 06:02
I can access objects and its vakues
values
Markus Kiili
@Masd925
Jul 08 2016 06:03
If you have a loop through contacts array, then check if the object is the one you look for (firstname check).
Mahade Walid
@walidmahade
Jul 08 2016 06:03
but how do I check the functions arguments against the objects
Markus Kiili
@Masd925
Jul 08 2016 06:03
Access the firstName property of the object and compare it with the firstName parameter.
Mahade Walid
@walidmahade
Jul 08 2016 06:04
how do I compare ?
if, switch ?
Markus Kiili
@Masd925
Jul 08 2016 06:04
if and ===
Francisco Franco
@frenktico
Jul 08 2016 06:04
Hey Ho people <3 How are y'all?
I have an issue on my code
Keone Martin
@Athaman
Jul 08 2016 06:06
what's causing problems @frenktico
Mahade Walid
@walidmahade
Jul 08 2016 06:06
if ( firstName === contacts[0].firstName )
@Masd925
Markus Kiili
@Masd925
Jul 08 2016 06:06
@walidmahade You need to use the loop index contacts[i]
Mahade Walid
@walidmahade
Jul 08 2016 06:07
for ( i = 0; i < contacts.length; i++) {
      //console.log(contacts[i][0]);
  }

  if ( firstName === contacts[i].firstName )
Francisco Franco
@frenktico
Jul 08 2016 06:07

Let's talk about it? Here it goes. Regarding the exercise Title Case a Sentence, this is what has been built until now:

function titleCase(str) {
  str = str.split(" ");

  for(var sr in str){
    sr = sr.toLowerCase();
    sr[0] = sr[0].toUpperCase();
  }

  return str.join(" ");
}

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

The page isn't accepting the block of code saying: TypeError: Cannot assign to read only property '0' of string '0' this is the issue @Athaman

Markus Kiili
@Masd925
Jul 08 2016 06:08
@walidmahade contacts[i] is an object. It has no "0" property key.
Keone Martin
@Athaman
Jul 08 2016 06:08
@frenktico in Javascript strings are immutable (cannot be altered) so trying to change a single index of a string will throw an error
Mahade Walid
@walidmahade
Jul 08 2016 06:08
soory
Markus Kiili
@Masd925
Jul 08 2016 06:09
@Athaman I believe there is no error, but nothing is changed either.
Mahade Walid
@walidmahade
Jul 08 2016 06:09
 for ( i = 0; i < contacts.length; i++) {

  }

  if ( firstName === contacts[i].firstName ) {

  }
Francisco Franco
@frenktico
Jul 08 2016 06:09
That's why it says that we should use replace in order to proceed
Keone Martin
@Athaman
Jul 08 2016 06:09
so what you need to do @frenktico to make that approach work is overwrite the whole string by saving sr = sr[0].toUpperCase() + theRestOfTheString
or you could use replace as well >.>
Markus Kiili
@Masd925
Jul 08 2016 06:10
This message was deleted
Mahade Walid
@walidmahade
Jul 08 2016 06:10
is it okay to to put my if statement inside for loop ?
Keone Martin
@Athaman
Jul 08 2016 06:10
@Masd925 noted, i used a bad turn of phrase in throwing errors, i meant more 'it's gonna break things'
Jack
@jh0l
Jul 08 2016 06:11
help largest numbers
CamperBot
@camperbot
Jul 08 2016 06:11

:point_right: algorithm return largest numbers in arrays [wiki]

Algorithm Return largest Numbers in Arrays

:triangular_flag_on_post: Remember to use Read-Search-Ask if you get stuck. Try to pair program :busts_in_silhouette: and write your own code :pencil:

:checkered_flag: Problem Explanation:

You will get an array that contains sub arrays of numbers and you need to return an array with the largest number from each of the sub arrays.

:pencil: read more about algorithm return largest numbers in arrays on the FCC Wiki

Markus Kiili
@Masd925
Jul 08 2016 06:11
@walidmahade The simplest way is to put a nested if that checks the property existence, now that you know it is the contact that you seek.
Keone Martin
@Athaman
Jul 08 2016 06:11
@frenktico also on a side note before you split your string you should lowercase the whole lot of it because some of the inputs have random capitals throughout
Francisco Franco
@frenktico
Jul 08 2016 06:12
When I attempted to do that the system returned an error :/
Mahade Walid
@walidmahade
Jul 08 2016 06:13
for ( i = 0; i < contacts.length; i++) {
      if ( firstName === contacts[i].firstName ) {
        console.log("hi");
    }
  }
thanks @Masd925
CamperBot
@camperbot
Jul 08 2016 06:13
walidmahade sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2068 | @masd925 |http://www.freecodecamp.com/masd925
Jack
@jh0l
Jul 08 2016 06:13
who comes up with the wiki solutions? NASA?
Jonathan Leon
@Wo1v3r
Jul 08 2016 06:14
The ISA
Markus Kiili
@Masd925
Jul 08 2016 06:14
@Athaman In general, assigning to a write-only property fails silently in JS (String wrapper object in this case).
Keone Martin
@Athaman
Jul 08 2016 06:15
haha, dammit i hate this language sometimes
Jack
@jh0l
Jul 08 2016 06:15
@Wo1v3r NSA?
Keone Martin
@Athaman
Jul 08 2016 06:15
'oh, this isn't going to work' says the js interpreter ... to itself... quietly... so no one must know
Jonathan Leon
@Wo1v3r
Jul 08 2016 06:16
@Jhollond I have no idea why I said ISA instead of NSA
Jack
@jh0l
Jul 08 2016 06:17
islamic state agency
Francisco Franco
@frenktico
Jul 08 2016 06:17
Hey @Athaman check it out it has been changed

function titleCase(str) {
  str = str.split(" ");

  for(var sr in str){
    sr = sr.toLowerCase();
    sr = sr[0].toUpperCase() + sr.substring(1,sr.length-1);
  }

  return str.join(" ");
}

titleCase("I'm a little tea pot");
Keone Martin
@Athaman
Jul 08 2016 06:17
the International Security Agency?
it's like the NSA... but international
Mahade Walid
@walidmahade
Jul 08 2016 06:17
@Masd925 how do I check for every other properti against prop ?
Jonathan Leon
@Wo1v3r
Jul 08 2016 06:17
Well the NSA is pretty much the ISA going by that definition
I loved the episodes @ the nsa on The Good Wife
Jack
@jh0l
Jul 08 2016 06:18
This message was deleted
more like International Survallience Agency
Francisco Franco
@frenktico
Jul 08 2016 06:18
However it still has an issue when attempting to change these:
titleCase("I'm a little tea pot");
titleCase("sHoRt AnD sToUt");
titleCase("HERE IS MY HANDLE HERE IS MY SPOUT");
Markus Kiili
@Masd925
Jul 08 2016 06:20
@walidmahade You need to make a .hasOwnProperty() check on the object for having property key stored in prop parameter. .propertyIsEnumerable() would work the same here.
Jonathan Leon
@Wo1v3r
Jul 08 2016 06:20
@Jhollond saw what you did there :dancer:
Mahade Walid
@walidmahade
Jul 08 2016 06:20
is it the only way ? @Masd925
Markus Kiili
@Masd925
Jul 08 2016 06:20
@walidmahade If is the proper way. Making a loop or using a keylist is too much work when there is a method that does the check.
Keone Martin
@Athaman
Jul 08 2016 06:21
@frenktico uhmm, a few things, substring is exclusive on the end index (the second argument passed) so you just need sr.length not sr.length - 1
Jonathan Leon
@Wo1v3r
Jul 08 2016 06:22
Hm substring() == substr() ?
looking it up on google I get two results with same documentation for reach
each*
Keone Martin
@Athaman
Jul 08 2016 06:23
i expect they're the same thing? substring does work
for some reason though when it's in the for each loop the words don't seem to be saving
if i change it to a for loop and reference them through str[i] it works fine... but using for(var word in str) { word = ...} they're not updating...
Markus Kiili
@Masd925
Jul 08 2016 06:24
@Wo1v3r They are similar but different meaning of arguments etc.
Keone Martin
@Athaman
Jul 08 2016 06:25
@Masd925 when you use a for in loop does it create a new instance of each element and make it non destructive to the original array?
Chris Cuevo
@ccuevo
Jul 08 2016 06:25
hello, im' not sure why my code isn't working in the mutations challenge. please help.

function mutation(arr) {
  arr[0] = arr[0].toLowerCase();
  arr[1] = arr[1].toLowerCase();
  if (arr[0].indexOf(arr[1]) !== -1) {
    return true;
  } else {
    return false;
  }
}

mutation(["Mary", "Army"]);
Jonathan Leon
@Wo1v3r
Jul 08 2016 06:26
@Athaman Well generally a loop has its own scope so i guess
Markus Kiili
@Masd925
Jul 08 2016 06:26
@Athaman It just loops the property keys (strings).
Keone Martin
@Athaman
Jul 08 2016 06:26
riiight... this is why i always just use regular for loops