These are chat archives for FreeCodeCamp/HelpJavaScript

21st
Apr 2017
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:00
ive only just got into javascript really i used to use little bit of jquery and php
who here uses laravel?
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:02
@webcodeiseasy You know php?
I have heard of php but I do not know what they are used for
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:02
yeah
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:03
Brb :p
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:03
its used for backend development
and use mysql to interact with the database
trying to do that
but dont know node at all
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:08
i see
My friend itndrocted me to fCC like many months ago and he was working on Backend
I think he didnt do frontend..
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:09
i use php for backend with the laravel framework i love it dont know anything about node and that
im suprised FCC dont teach php
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:09
Maybe they teach it in backend?
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:10
nope
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:10
oh
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:10
they teach mogoDB
and nodejs
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:10
yea
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:11
how long have you been with FCC
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:11
Maybe since Aug? I dont really remember
That was first account then I had issues with it
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:12
what challenge number you on?
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:12
This is second and started fCC last Feb
These number are not challenge number
Danny Welstad
@GoonTwo
Apr 21 2017 00:12
can someone please tell me what stupid mistake I'm making with this? My button values in the JS are incrementing, but I am not writing it back to the html with innerHTML. Right now I am only looking at the session-length value
http://codepen.io/DWelstad/pen/PmZxEr?editors=1011
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:12
Im on inderimate scripting challenges
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:13
im on number 145
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:13
They are not challenge number :\
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:13
what are they
Teng Peng
@pt7321
Apr 21 2017 00:13
anyone can tell me why <script>
while(var i=0; i<8; i++) { document.write("number is " + i + "<br>"); } </script>
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:13
Look
about @webcodeiseasy
CamperBot
@camperbot
Apr 21 2017 00:13
:cookie: 145 | @webcodeiseasy |http://www.freecodecamp.com/webcodeiseasy
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:13
See?
Cookies
You get cookie from thanks and one each completed challenge
So you probably have completed 140+ challenges
Teng Peng
@pt7321
Apr 21 2017 00:14
why when I use "while", nothing write, but when I change to "for", it display<script>
while(var i=0; i<8; i++) { document.write("number is " + i + "<br>"); } </script>
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:15
@webcodeiseasy if we want to let someone know what challenge we are on and we have to tell its name
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:15
everytime i complete something the number goes up
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:15
Yes
You get cookie from thanks and one each completed challenge
Even if its 145 without getting thanks we would have to count the challenges..
webcodeiseasy
@webcodeiseasy
Apr 21 2017 00:15
ok im on concatenating-strings-with-the-plus-equals-operator
Stephen James
@sjames1958gm
Apr 21 2017 00:16
@pt7321 Because while only takes a comparison. The syntax of for loop is very different
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:16
var string = Hello
var stringg = World
return string+stringg;
// Hello World
Stephen James
@sjames1958gm
Apr 21 2017 00:16
@pt7321
var i = 0; 
while(i < 8) { 
  //code here 
   i++; 
}
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:16
An example but its not really correct
You need the quotes but didnt add it anyway
Teng Peng
@pt7321
Apr 21 2017 00:17
ok @sjames1958gm thk
fstranathan
@fstranathan
Apr 21 2017 00:19

Assignment always goes from right to left. Everything to the right of the = operator is resolved before the value is assigned to the variable to the left of the operator.

myVar = 5;
myNum = myVar;
Assigns 5 to myVar and then resolves myVar to 5 again and assigns it to myNum.

Instructions
Assign the value 7 to variable a.

Assign the contents of a to variable b.

Saboor Malik
@MathematicsCoding
Apr 21 2017 00:19
@sjames1958gm
fstranathan
@fstranathan
Apr 21 2017 00:19
I have no idea what I'm supposed to type here
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:19
Im not good with while loop but take a look

function convertToRoman(num) {
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
while (num>roNum[0][1]) {
  num -=
}
}

convertToRoman(5000);
That is what I have right now
Teng Peng
@pt7321
Apr 21 2017 00:20
@sjames1958gm so could you teach me how to change <script>
for(var i=0; i<8; i++) { document.write("number is " +i+ "<br>") } </script> to the while syntax?
fstranathan
@fstranathan
Apr 21 2017 00:20
how do i assing A to b using an = sign?
Stephen James
@sjames1958gm
Apr 21 2017 00:20
@MathematicsCoding You'll want to start with the larger numbers first
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:20
So roNum[13][1]
Stephen James
@sjames1958gm
Apr 21 2017 00:20
@pt7321
var i = 0; 
while(i < 8) { 
   document.write("number is " +i+ "<br>") 
   i++; 
}
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:21
lol at first I didnt understand it I thought that was meant for me :\
Stephen James
@sjames1958gm
Apr 21 2017 00:21
@fstranathan the b = a
left to right assignment so b gets the value of a
@MathematicsCoding Well roNum[roNum.length - 1][1]
Teng Peng
@pt7321
Apr 21 2017 00:21
@sjames1958gm thanks!
CamperBot
@camperbot
Apr 21 2017 00:21
pt7321 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6848 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Apr 21 2017 00:21
@MathematicsCoding Or invert the list
@pt7321 :+1:
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:22
Cant I use while loop?
Stephen James
@sjames1958gm
Apr 21 2017 00:22
@MathematicsCoding Sure
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:22
So..
while (num>roNum[13][1]) {
  num -=
}
Change > to <?
fstranathan
@fstranathan
Apr 21 2017 00:22
?
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:22
Not all num wont be bigger than 1000
Stephen James
@sjames1958gm
Apr 21 2017 00:22
yes you want >
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:22
So leave it?
Stephen James
@sjames1958gm
Apr 21 2017 00:23
You'll probably want a loop that goes from 13 to 0 outside that
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:23
for loop
?
Stephen James
@sjames1958gm
Apr 21 2017 00:23
@MathematicsCoding Yeah
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:24

function convertToRoman(num) {
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
  for (var i=13;roNum.length;i--) {

  }
while (num>roNum[13][1]) {
  num -=
}
}

convertToRoman(5000);
brianfurrer
@brianfurrer
Apr 21 2017 00:24
function caseInSwitch(val) {
var answer = "";
// Only change code below this line
switch (val) {
case 1:
answer = "alpha";
break;
case 2:
answer = "beta";
break;
case 3:
answer = "gamma";
break;
case 4:
answer = "delta";
// Only change code above this line
return answer;
}
Why doesn't the above code work? It only works for val=4.
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:24

function convertToRoman(num) {
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
  for (var i=13;roNum.length;i--) {
while (num>roNum[i][1]) {
  num -=
}
}
  }

convertToRoman(5000);
oops forgot something in for loop ()

function convertToRoman(num) {
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
  for (var i=13;i>roNum.length;i--) {
while (num>roNum[i][1]) {
  num -=
}
}
  }

convertToRoman(5000);
Changed > to < in for loop ()
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:26
@brianfurrer what value did you pass into caseInSwitch?
can you show the entire code?
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:27
roNum.length to 0?
cause .length is not used for array?
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:27
@MathematicsCoding length is used for array
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:27
I thought its used for string?
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:28
same
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:28
Well with string in it
So its correct then?
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:28
array.length returns you the number of elements in an array
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:28
Can I change it to 0?
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:28
how does it not work?
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:28
What?
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:28
what do you mean change it to 0?
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:29

function convertToRoman(num) {
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
  for (var i=13;i>=0;i--) {
while (num>roNum[i][1]) {
}
}
}

convertToRoman(5000);
I meant > not <..
Edited it
Emit
@Drienn
Apr 21 2017 00:29

anybody have a minute to help me out on a quick javaScript wall I'm running into? I'm working on getting dashes out an array which I've finally been able to do like so:

var myArray = ['4916-2600-1804-0530', '4779-252888-3972', '4252-278893-7978', '4556-4242-9283-2260']
var DashLess = function(){
for (i=0; i<myArray.length; i++) {
myArray[i] = myArray[i].replace(/-/g,'');
console.log (myArray[i]);
}
}
and that takes out the dashes, but I'm still needing to add the individual numbers within the arrays up, and I'm just not finding the right source material to find out how to do that :-/, any advice?

Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:30
try parseInt?
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:30
Me?
Emit
@Drienn
Apr 21 2017 00:30
I was trying to, but I can't seem to get the code to work for me :-(
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:30
@Drienn parseInt("32") // returns 32
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:30
Oh its not me.
:\
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:31
@MathematicsCoding idk what you're trying to do
Emit
@Drienn
Apr 21 2017 00:31
so it would be like, parseIent(myArray[0]?
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:31
@kuriakinzeng Have you do roman converter?
Emit
@Drienn
Apr 21 2017 00:31
and would I need to do that to each instance of the array?, or would I need to make another for loop that would cycle through and do it to all of them
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:31
5000 will always be larger than any of the number in your array
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:31
challenge
Yeah I know
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:32
you need to decrease number by the amount that you get matched
i think using if else statements can make your life easier
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:32
@kuriakinzeng I did that in different solution
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:33
@Drienn yeah, can you have a global variable?
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:33
Alot of if statements you mean?
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:33
@MathematicsCoding not a lot
Emit
@Drienn
Apr 21 2017 00:33
I don't, just the array
Stephen James
@sjames1958gm
Apr 21 2017 00:33
@MathematicsCoding Looks like a start
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:33
@sjames1958gm Well am I doing anything wrong?

function convertToRoman(num) {
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
  for (var i=13;i>=0;i--) {
while (num>roNum[i][1]) {
}
}
}

convertToRoman(5000);
Is that ok for now?
Stephen James
@sjames1958gm
Apr 21 2017 00:34
@MathematicsCoding No, looks good
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:34
Hm

function convertToRoman(num) {
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
  for (var i=13;i>=0;i--) {
while (num<roNum[i][1]) {
}
}
}

convertToRoman(5000);
Changed the <> in while loop
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:34
@MathematicsCoding you need to update num
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:35
If num is less than big number
So..
Stephen James
@sjames1958gm
Apr 21 2017 00:35
@Drienn Use split('-') then parseInt
Emit
@Drienn
Apr 21 2017 00:35
ooooooooo
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:36

function convertToRoman(num) {
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
  for (var i=13;i>=0;i--) {
while (num<roNum[i][1]) {
}
}
}

convertToRoman(999);
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:36
@Drienn are you supposed to add all elements in the array up?
Emit
@Drienn
Apr 21 2017 00:37
yeah
Tegh
@teghmehta
Apr 21 2017 00:37

function bouncer(arr) {
  arr = arr.filter(function(word){
  return isFalsey(word);
});
  // Don't show a false ID to this bouncer.
  return arr;
}

var isFalsey = function(val) {
  switch (val) {
    case false:
      return false;

    case 0:
      return false;  

    case "":
      return false;

    case null:
      return false;    

    case undefined:
      return false; 

    default: 
      return true;
  }
  if (isNaN(val) || val === null) return false;
};

bouncer([false, null, 0, NaN, undefined, ""]);
Emit
@Drienn
Apr 21 2017 00:37
like the individual numbers, so like the first element int he array would need to be like 4+9+1+6+2+6+0+0+1+8
Tegh
@teghmehta
Apr 21 2017 00:37
THis is returnign null
Emit
@Drienn
Apr 21 2017 00:37
and so on
Stephen James
@sjames1958gm
Apr 21 2017 00:37
@MathematicsCoding No use >
If the number is already less than the value you want to skip that entry
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:37
parseInt on array[i] doesn't turn it into an int?
@Drienn
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:38

function convertToRoman(num) {
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
  for (var i=13;i>=0;i--) {
while (num>roNum[i][1]) {
}
}
}

convertToRoman(5000);
Right?
Stephen James
@sjames1958gm
Apr 21 2017 00:38
@teghmehta isNaN - wont work correctly because "this" isNaN
Try Number.isNaN() instead
Emit
@Drienn
Apr 21 2017 00:38
It's not giving me an error, but I haven't implemented the code to add up the numbers yet
Stephen James
@sjames1958gm
Apr 21 2017 00:38
@MathematicsCoding yes
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:38
What if num is less than that?
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:38
@Drienn you can use split("")
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:38
Like num = 4...
Stephen James
@sjames1958gm
Apr 21 2017 00:38
Then it will go ot the next entry
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:39
it will split strings into individual char
Tegh
@teghmehta
Apr 21 2017 00:39
@sjames1958gm but the array is returning null
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:39
then u use parseInt on each char
Emit
@Drienn
Apr 21 2017 00:39
ahh okay
yeah, that's super helpful :-D I'm looking up stuff on split right now :-D
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:39
@Drienn do it after your regex
Emit
@Drienn
Apr 21 2017 00:40
so the split would be in the for loop
Stephen James
@sjames1958gm
Apr 21 2017 00:40
@teghmehta NaN shows as null in the console window
BTW, you never get to the if (isNaN) because your default: returns
Emit
@Drienn
Apr 21 2017 00:40
so I'd make it like split("myArray[i]);
Stephen James
@sjames1958gm
Apr 21 2017 00:41
@Drienn Don't split on "" split on "-")
@Drienn no myArray[i].split("-")
Emit
@Drienn
Apr 21 2017 00:41
ahh okay
Stephen James
@sjames1958gm
Apr 21 2017 00:41
@Drienn If you know about array .map I would use that
Emit
@Drienn
Apr 21 2017 00:42
I read about it a bit, but I wasn't getting it to work. I could possibly be working on this project too long for today haha
Stephen James
@sjames1958gm
Apr 21 2017 00:42

@teghmehta try this for your default.

default:
   return val == val;

because only for NaN is val == val false

Saboor Malik
@MathematicsCoding
Apr 21 2017 00:43
:zzz:
Stephen James
@sjames1958gm
Apr 21 2017 00:44
@Drienn
return myArray.map(function(val) {
    var nums = val.split('-');
    // now you have an array of string numbers which you can loop over and parseInt and add.
}
Keon Samuel
@keonsam
Apr 21 2017 00:44
I guys should Know I have an IQ of 126.
Tegh
@teghmehta
Apr 21 2017 00:44
@sjames1958gm

function bouncer(arr) {
  arr = arr.filter(function(word){
  return isFalsey(word);
});
  // Don't show a false ID to this bouncer.
  return arr;
}

var isFalsey = function(val) {
  switch (val) {
    case false:
      return false;

    case 0:
      return false;  

    case "":
      return false;

    case null:
      return false;    

    case undefined:
      return false; 

    default: 
      if (isNaN(val)|| val === null) {
        return false;
      } else {
      return true;
      }
  }
};

bouncer([false, null, 0, NaN, undefined, ""]);
Stephen James
@sjames1958gm
Apr 21 2017 00:44
@teghmehta Use Number.isNaN instead
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:45
@keonsam You took IQ test online?
Tegh
@teghmehta
Apr 21 2017 00:45
@sjames1958gm doesnt work
bouncer([7, "ate", "", false, 9]) should return [7, "ate", 9].
bouncer(["a", "b", "c"]) should return ["a", "b", "c"].
^ those dont work
Keon Samuel
@keonsam
Apr 21 2017 00:45
a couple of months ago.
Emit
@Drienn
Apr 21 2017 00:45
@sjames1958gm interesting! I'll see if I can use that, Thanks! :-D
CamperBot
@camperbot
Apr 21 2017 00:45
drienn sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6849 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:45
@keonsam 126? so?
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:46
I took 123test For IQ test They might be fake result says 115-130
Stephen James
@sjames1958gm
Apr 21 2017 00:46
@teghmehta because
isNaN("e")
true
Number.isNaN("e")
false
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:46
Who care about IQ :\
Keon Samuel
@keonsam
Apr 21 2017 00:46
what is your score?
Tegh
@teghmehta
Apr 21 2017 00:46
@sjames1958gm ohh
Keon Samuel
@keonsam
Apr 21 2017 00:46
@kuriakinzeng
Tegh
@teghmehta
Apr 21 2017 00:46
@sjames1958gm thanks it WORKS!
CamperBot
@camperbot
Apr 21 2017 00:46
teghmehta sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6850 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Apr 21 2017 00:47
@teghmehta The first is saying is Not a Number the second is specifically saying is NaN
@teghmehta :+1: NaN is the killer
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:47
@keonsam 374
according to freecodecamp
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:47
@kuriakinzeng lol 373 is impossible
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:47
:smile:
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:47
oh cookies...
about @kuriakinzeng
CamperBot
@camperbot
Apr 21 2017 00:47
:cookie: 374 | @kuriakinzeng |http://www.freecodecamp.com/kuriakinzeng
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:47
yeah
Stephen James
@sjames1958gm
Apr 21 2017 00:47
@kuriakinzeng Sweet mine is 6850 :)
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:47
LOL
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:47
@sjames1958gm :smile:
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:47
6850 IQ
Keon Samuel
@keonsam
Apr 21 2017 00:47
I am 21 by the way so that is no kids score.
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:47
gg
@keonsam 126?
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:48
@keonsam lol IQ takes into consideration of your age
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:48
Yeah..
Keon Samuel
@keonsam
Apr 21 2017 00:48
21 years old.
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:48
Im 16 and result says 115-131
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:48
you guys are so smart
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:48
I dont believe it anyway
Keon Samuel
@keonsam
Apr 21 2017 00:49
he is Chinese so I will say 135.
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:49
lol
Just because he is chinese...
He might be not chinese...
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 00:49
I think we digress
barki mustapha
@barkinet
Apr 21 2017 00:56
I got this today Upon review, this account has been flagged for academic dishonesty. If you’re the owner of this account contact team@freecodecamp.com for details.
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:57
@barkinet you completed front end?
barki mustapha
@barkinet
Apr 21 2017 00:57
And data
Keon Samuel
@keonsam
Apr 21 2017 00:57
lol
about @barkinet
CamperBot
@camperbot
Apr 21 2017 00:57
:cookie: 304 | @barkinet |http://www.freecodecamp.com/barkinet
Saboor Malik
@MathematicsCoding
Apr 21 2017 00:58
@barkinet its because you copied all of example projects.
You have to create your own...
Keon Samuel
@keonsam
Apr 21 2017 00:58
lol
this guy have an IQ of 200.
barki mustapha
@barkinet
Apr 21 2017 00:59
My github since 2011
Keon Samuel
@keonsam
Apr 21 2017 00:59
front-end and data in less than 3 weeks.
fvdave2017
@fvdave2017
Apr 21 2017 01:01
if(strokes === 1){
return "Holes-in-one!";
}else if(strokes <= (par - 2)){
return "Eagle";
}else if(strokes === (par - 1)){
return "Birdie";
}else if(strokes === par){
return "Par";
}else if(strokes === (par + 1)){
return "Bogey";
}else if(strokes === (par + 2)){
return "Double Bogey";
}else if(strokes >= (par + 3)){
return "Go Home!";
}
Here is my code. I am getting an error on golfScore(4, 1) and golfScore(1, 1). Confused.
Keon Samuel
@keonsam
Apr 21 2017 01:02
lol
this guys copied all the codes.
brianfurrer
@brianfurrer
Apr 21 2017 01:03
I passed in 1
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 01:03
@barkinet that's unfortunate? was it a misunderstanding?
barki mustapha
@barkinet
Apr 21 2017 01:03

function golfScore(par, strokes) {
// Only change code below this line
if (strokes === 1) {
return "Hole-in-one!";
} else if (strokes <= par -2){
return "Eagle"
} else if (strokes === par -1) {
return "Birdie"
} else if (strokes === par) {
return "Par";
} else if (strokes === par + 1) {
return "Bogey";
} else if (strokes === par + 2) {
return "Double Bogey";
} else if (strokes >= par + 3) {
return "Go Home!"
}

// Only change code above this line
}

// Change these values to test
golfScore(5, 4);

Saboor Malik
@MathematicsCoding
Apr 21 2017 01:03
@kuriakinzeng so you got your data visual.. cert. like two days ago
congrats :p
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 01:04
thanks :)
David Miller
@DavidMillerFL
Apr 21 2017 01:05
Hey guys I’ve been working on the card counting challenge - I’m pretty close to cracking it, but apparently I’m doing something wrong. I need a hint please.
var count = 0;

function cc(card) {
  // Only change code below this line

    if (card <= 6) return (count +=1) + " Bet";

    if (card <= 9) return (count + 0) + " Hold";

    if (card <= 10) return (count -=1) + " Hold";

    if (card ="J", "Q", "K", "A") return (count -=1) + " Hold";
  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc('J'); cc(9); cc(2); cc(7);
barki mustapha
@barkinet
Apr 21 2017 01:05
I have worked hard for it I m proud to be here even if dishonesty don't belong t me
Keon Samuel
@keonsam
Apr 21 2017 01:05
loll
how old are you?
barki mustapha
@barkinet
Apr 21 2017 01:06
41
Keon Samuel
@keonsam
Apr 21 2017 01:06
14
Stephen James
@sjames1958gm
Apr 21 2017 01:06
@DavidMillerFL You need to test count > 0 before you decide Bet or Hold
Adebiyi Abdulmateen
@Ayandeji
Apr 21 2017 01:07
Hello,
Stephen James
@sjames1958gm
Apr 21 2017 01:07
(card ="J", "Q", "K", "A") also this syntax is wrong you need card == "J" || card == "Q"
Adebiyi Abdulmateen
@Ayandeji
Apr 21 2017 01:07
Kindly help me with this
barki mustapha
@barkinet
Apr 21 2017 01:07
I play with my kids too @keonsam
Adebiyi Abdulmateen
@Ayandeji
Apr 21 2017 01:07

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

function lookUpProfile(firstName, prop){

// Only change code below this line
if (contacts[firstName]!=firstName){
console.log("No such contact");

}
// Only change code above this line
if (contacts.hasOwnProperty(prop)===false){
console.log("No such property");

}if(contacts[firstName]!=firstName && contacts.hasOwnProperty(prop)===false){
return contacts[prop];

 }

}

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

David Miller
@DavidMillerFL
Apr 21 2017 01:07
Ok, I’ll fix the syntax first since I understand that easiest lol.
@sjames1958gm Thanks, just a sec :)
CamperBot
@camperbot
Apr 21 2017 01:07
davidmillerfl sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6851 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 01:07

@barkinet what do you mean?

I have worked hard for it I m proud to be here even if dishonesty don't belong t me

Stephen James
@sjames1958gm
Apr 21 2017 01:08
@Ayandeji FYI - don't post the contacts array - everyone has seen it :)
Here is a link for formatting code
https://forum.freecodecamp.com/t/markdown-code-formatting/18391
Dennis White
@dpwmc93
Apr 21 2017 01:08

Im working on the "Escape Sequences in Strings”.

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

I got it right, but when I do a console.log (myStr) ; it shows the SeccondLine and ThirdLine on the same line. Am I doing something wrong?

Stephen James
@sjames1958gm
Apr 21 2017 01:08
@Ayandeji As to the code - contacts is an array - it has no properties like "firstName"
you need to loop over the array and test the objects inside the array
Keon Samuel
@keonsam
Apr 21 2017 01:09
bro check your projects they have the same code as freecodecamp down to the letter.
Stephen James
@sjames1958gm
Apr 21 2017 01:09
@dpwmc93 No, it isn't going to show like that - I don't know why they did that - it will sort of show like that in the console.
don't worry about it
Dennis White
@dpwmc93
Apr 21 2017 01:10
@sjames1958gm Ok thank You!
CamperBot
@camperbot
Apr 21 2017 01:10
dpwmc93 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6852 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
barki mustapha
@barkinet
Apr 21 2017 01:12
@kuriakinzeng my account flagged doesn't matter what I have learn and what ways I can follow let me tell y that certified or not isn't my issue
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 01:13
@barkinet I see. Good philosophy!
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:13
Anyone on?
Manish Giri
@Manish-Giri
Apr 21 2017 01:14
Everyone off
@barkinet why is your account flagged?
Keon Samuel
@keonsam
Apr 21 2017 01:15
@barkinet are some kind of old programmer ?
barki mustapha
@barkinet
Apr 21 2017 01:16
IM faster than normal @Manish-Giri
fvdave2017
@fvdave2017
Apr 21 2017 01:16

function golfScore(par, strokes) {
// Only change code below this line
if(strokes === 1){
return "Holes-in-one!";
}else if(strokes <= (par - 2)){
return "Eagle";
}else if(strokes === (par - 1)){
return "Birdie";
}else if(strokes === par){
return "Par";
}else if(strokes === (par + 1)){
return "Bogey";
}else if(strokes === (par + 2)){
return "Double Bogey";
}else if(strokes >= (par + 3)){
return "Go Home!";
}

// Only change code above this line
}

// Change these values to test
golfScore(4, 1);

Does anyone see what is my mistakes in this code?

David Miller
@DavidMillerFL
Apr 21 2017 01:17

Am I on the right track?

@sjames1958gm

var count = 0;

function cc(card) {
  // Only change code below this line
    if (count > 0) return (count + 0) + " Hold”;
This doesn’t feel right :-/
Manish Giri
@Manish-Giri
Apr 21 2017 01:17
@fvdave2017 "Hole-in-one!"
Keon Samuel
@keonsam
Apr 21 2017 01:18
that is not how you do and inline if statement.
barki mustapha
@barkinet
Apr 21 2017 01:18
Hole
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:18
This challenge is harder than I thought
fvdave2017
@fvdave2017
Apr 21 2017 01:19
thank you Manish Giri
Keon Samuel
@keonsam
Apr 21 2017 01:19
what challenge?
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 01:19
@barkinet indeed faster than normal
Manish Giri
@Manish-Giri
Apr 21 2017 01:20
lol
@DavidMillerFL that's wrong
unless you have some code before it
that adjusts count according to card.
David Miller
@DavidMillerFL
Apr 21 2017 01:20
@Manish-Giri Hmm.. okay.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:21
Wtf?
This chat doesnt work for me in the challenge
I thought nobody was on...
ok... this is what I have right now
David Miller
@DavidMillerFL
Apr 21 2017 01:21
@sjames1958gm Can you please elaborate why I would need to check if count >0? That may clarify something for me.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:21

function convertToRoman(str) {
 var num = [str];
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
for (var i=13;i>=0;i--) {
while (num>roNum[i][1]) {
  //code
}
}
}

convertToRoman(600);
Joseph
@revisualize
Apr 21 2017 01:22
@DavidMillerFL Counting Cards is a challenge where your function will receive a card parameter. You're supposed to increment or decrement the global count variable according to the card's value
If the value of the card parameter is 2, 3, 4, 5 or 6 you need to increment the global variable count.
If the value of the card parameter is 10, 'J', 'Q', 'K' or 'A' you need to decrement the global variable count.
...
Then the function will return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative.
The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
barki mustapha
@barkinet
Apr 21 2017 01:22
@kuriakinzeng thanks
CamperBot
@camperbot
Apr 21 2017 01:22
barkinet sends brownie points to @kuriakinzeng :sparkles: :thumbsup: :sparkles:
:cookie: 375 | @kuriakinzeng |http://www.freecodecamp.com/kuriakinzeng
Joseph
@revisualize
Apr 21 2017 01:22
about @barkinet
CamperBot
@camperbot
Apr 21 2017 01:22
:cookie: 304 | @barkinet |http://www.freecodecamp.com/barkinet
Stephen James
@sjames1958gm
Apr 21 2017 01:22
@DavidMillerFL Because that is what the instructions say - after increment or decrement count - return Bet if count is greater than zero Hold otherwise
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:22
@revisualize check all of his projects
He copied all of its example
Joseph
@revisualize
Apr 21 2017 01:22
@MathematicsCoding I did.
David Miller
@DavidMillerFL
Apr 21 2017 01:22
@sjames1958gm @revisualize Ok, reading.
Keon Samuel
@keonsam
Apr 21 2017 01:23
lol
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:23
Oh ok
Joseph
@revisualize
Apr 21 2017 01:23
@MathematicsCoding The certs don't work for a reason.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:23
Yeah
Keon Samuel
@keonsam
Apr 21 2017 01:23
he copied the copyright too.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:23
Acadimes dishonestly
Exactly
Joseph
@revisualize
Apr 21 2017 01:23
I that reason.
@MathematicsCoding Copied a bunch of my code too ... verbatim from my Github.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:24
@revisualize I have never seen your code..
Manish Giri
@Manish-Giri
Apr 21 2017 01:24
lol what
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:24
Do you mean me? or him?
Keon Samuel
@keonsam
Apr 21 2017 01:24
lol definitely a kid.
Joseph
@revisualize
Apr 21 2017 01:25
@MathematicsCoding Him.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:25
Oh lol
I didnt like being assumed :\
Joseph
@revisualize
Apr 21 2017 01:25
@MathematicsCoding Look at how many challenging solutions were magically completed on one day.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:25
Yeah
He copied of them in one day?
Joseph
@revisualize
Apr 21 2017 01:26
Yeah.
HEHE.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:26
Still I feel bad for him
Keon Samuel
@keonsam
Apr 21 2017 01:26
the guy is a pro.
120 repo
Manish Giri
@Manish-Giri
Apr 21 2017 01:26
he commented on one of my pull requests
I thought he was a new mod or something..
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:27
...
@revisualize can you help me review while loop?
Im suck with while loop :(
Keon Samuel
@keonsam
Apr 21 2017 01:28
I did some of those projects in about a day I guess he can too.
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 01:28
@MathematicsCoding of course you are stuck in the while loop. try decreasing num by roNum[i][1]
Jason Myers
@Jmyers1101
Apr 21 2017 01:28
Coding is harrrdddd
barki mustapha
@barkinet
Apr 21 2017 01:28
I have more than 520 repo
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 01:28
doesn't necessarily solve the problem, but it's the right direction i think
Stephen James
@sjames1958gm
Apr 21 2017 01:29
@MathematicsCoding Why did you make num and array?
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:29
You mean make num into an array?
Huh... I guess I dont need it....
Keon Samuel
@keonsam
Apr 21 2017 01:30
@barkinet give me the solution for diff two Arr.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:30

function convertToRoman(str) {
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
for (var i=13;i>=0;i--) {
while (str>roNum[i][1]) {
  //code
}
}
}

convertToRoman(600);
Updated code
Stephen James
@sjames1958gm
Apr 21 2017 01:31
@MathematicsCoding Don't call it str - it's not a string. But you do need a string to put the roman numerals in
Joseph
@revisualize
Apr 21 2017 01:32
@MathematicsCoding I tried doing my solution that way. But, I got really really confused. So, I just made two arrays.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:32
@sjames1958gm I cant name any parameter whatever I want?
Stephen James
@sjames1958gm
Apr 21 2017 01:32
@MathematicsCoding Sure, but calling a number str - just confusing.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:32
:p easier to type
I changed it to num back
Stephen James
@sjames1958gm
Apr 21 2017 01:33
@MathematicsCoding So if num > roNum[i][1] what do you want to do?
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:34
Well I want the number if they are greater than 1000 for example then subtract 1000 then if it is more than 900 then subtract 800 so on...
You know?
Continue until it hit zero
@keonsam yeah beta isn't completed yet
Manish Giri
@Manish-Giri
Apr 21 2017 01:36
it's been reported alredy
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:36
@revisualize why dont you have any cert..
@sjames1958gm you know what im talking about?
Keon Samuel
@keonsam
Apr 21 2017 01:38
It has been more than a year. What you guys doing?
Stephen James
@sjames1958gm
Apr 21 2017 01:38
@MathematicsCoding No, what do you want to do if num > roNum[i][1] that is what goes in the while loop
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:39
well..
barki mustapha
@barkinet
Apr 21 2017 01:39
Who removed me from chat ???
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:39
Someone told me that I should do nested while loop like that until it hit zero
I have no idea what he were talking about?
Stephen James
@sjames1958gm
Apr 21 2017 01:40
@MathematicsCoding You have num and roNum[i][0] and roNum[i][1]
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:41
I have no idea how to do that...
0 and 1 same time?
Stephen James
@sjames1958gm
Apr 21 2017 01:41
@MathematicsCoding Those are the values you have and you want a roman numeral.
So if i is 13 and num is 1400 what do you want to do
@MathematicsCoding Let's say you have var answer = "" as well
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:43
alright...
So if i is 13 and num is 1400
blueboy121
@blueboy121
Apr 21 2017 01:43
Hey guys and girls! I can't figure out what is wrong with my code. I get a "TypeError: arr[0].filter is not a function" which doesn't make any sense to me
Anne L
@mathisme
Apr 21 2017 01:43
@MathematicsCoding Nice username :D
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:43
If num is more than 13 [13][1] = 1000 then subtract 1000
Like that?
@mathisme thanks
CamperBot
@camperbot
Apr 21 2017 01:44
mathematicscoding sends brownie points to @mathisme :sparkles: :thumbsup: :sparkles:
:cookie: 321 | @mathisme |http://www.freecodecamp.com/mathisme
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:44
Strange
Stephen James
@sjames1958gm
Apr 21 2017 01:44
@MathematicsCoding That's the idea, what about answer?
blueboy121
@blueboy121
Apr 21 2017 01:44

function destroyer(arr) {
// Remove all the values
var newArr = arr[0].filter(function(val){
for (var i=0; i<arr[1].length; i++){
return arr[1][i]==val;
}
});
return newArr;
}

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

Mohamed Derhalli
@derhallim
Apr 21 2017 01:44
@JLuboff here?
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:44
@sjames1958gm var answer = "num"?
Stephen James
@sjames1958gm
Apr 21 2017 01:44
@blueboy121 arr[0] is a number - arr is [1, 2, 3, 1, 2, 3]
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:44
so use answer then?
Stephen James
@sjames1958gm
Apr 21 2017 01:45
@MathematicsCoding answer starts as "" and should contain roman numerals
blueboy121
@blueboy121
Apr 21 2017 01:45
Really? isn't arr[0] equal to [1, 2, 3, 1, 2, 3]
?
Stephen James
@sjames1958gm
Apr 21 2017 01:45
@blueboy121 no - check arguments object link
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:45
oh
Stephen James
@sjames1958gm
Apr 21 2017 01:45
@MathematicsCoding Don't you want to do something with roNum[13][0] ?
ryan87
@ryan87
Apr 21 2017 01:45
Hey guys, currently stumped on a challenge and don't seem to be getting anywhere. Could anyone possibly offer my help through my ignorance?
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:46
var answer = roNum[i][0]?
ryan87
@ryan87
Apr 21 2017 01:46
me*
Stephen James
@sjames1958gm
Apr 21 2017 01:46
@MathematicsCoding var answer = ""; will be before all the loops.
You want to build up the answer
@ryan87 ask away
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:47
hm..
Good question..
ROBUSTO8
@ROBUSTO8
Apr 21 2017 01:47

can someone point me in the right direction for the "Caesar's Cipher" challenge I've managed to turn the string into an array of numbers matching the letters and then subtracting 13 from all those array numbers but, i can't figure out how to turn those numbers into letters again or how I'm going to join them correctly to fit the original sentence structure here's what I've got so far...:

function rot13(str) { // LBH QVQ VG!
var newStr = "";
for (var i = 0; i < str.length; i++) {
newStr += str.charCodeAt(i) + ',';

}
var newStrSplit = newStr.split(",").map(function(val){
return val -13;
});
newStrSplit.pop();

return newStrSplit;
}

this returns: [70, 56, 69, 69,....etc.] is this even the right way to go about this challenges starting to feel like I'm veering off course and there is a better way to solve this...

Saboor Malik
@MathematicsCoding
Apr 21 2017 01:47
I have no idea :\
ryan87
@ryan87
Apr 21 2017 01:47
unfortunately it's a lot to type. Could I possibly shoot you a link and move from there?
Stephen James
@sjames1958gm
Apr 21 2017 01:48
@MathematicsCoding After the first pass num should be 400 and answer should be "M"
Stephen James
@sjames1958gm
Apr 21 2017 01:48
Mohamed Derhalli
@derhallim
Apr 21 2017 01:48

question.. i have these situations.. when I contact google apis, using this:

https://maps.googleapis.com/maps

it's fine.. then if I do this:

https://mapgoogleapis.com/maps  (removing the s and .)

i get error in the callback.. (error, response, body) ..

when I do this:

https://mapse.googleapis.com/maps

i get null error (no error), but I get response.statusCode = 404..

so how come mapgoogleapis.com is not 404 and mapse.googleapis.com is???

what's the standard in getting 404 in async calls?
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:49
Google what 404 is
Mohamed Derhalli
@derhallim
Apr 21 2017 01:49
i know what it is ...................
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:49
okay..
Mohamed Derhalli
@derhallim
Apr 21 2017 01:50
am asking why in 1 case it gave 404, and why in the other it didn't ..
Stephen James
@sjames1958gm
Apr 21 2017 01:50
@ryan87 myNoun, myAdjective, myVerb, myAdverb these 4 values will hold the words passed into the function
you need to combine these with other strings and use concatenation and assign to result
Mohamed Derhalli
@derhallim
Apr 21 2017 01:50
both of them should get 404 as both Not Found
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:50
well I think mapgoo... doesnt exist
and mapse.google might be incorrect and getting 404
Mohamed Derhalli
@derhallim
Apr 21 2017 01:50
exactly .. but it doesn't give 404 ..!
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:50
Just my theory
barki mustapha
@barkinet
Apr 21 2017 01:51
Isn't sub domain @derhallim
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:51
Have you test these url?
Mohamed Derhalli
@derhallim
Apr 21 2017 01:51
mapgoog doesn't exist, and it should give 404, but it's not returning 404
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:51
Then compare them
Mohamed Derhalli
@derhallim
Apr 21 2017 01:51
yea i did
that's what am asking based on my testing
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:51
:\
Stephen James
@sjames1958gm
Apr 21 2017 01:51
@derhallim because googleapis.com is a host that doesn't not about "mapse" so that host can return 404
But mapgoogleapis this is a host that the internet doesn't know about so no-one to return 404
barki mustapha
@barkinet
Apr 21 2017 01:52
404 is not found
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:52
@MathematicsCoding After the first pass num should be 400 and answer should be "M"
I dont understand
M is 1000?
ryan87
@ryan87
Apr 21 2017 01:52
@sjames1958gm everything makes sense. The only problem is I dont understand where to start. I understand how to make a string but my formatting seems to be wrong
Stephen James
@sjames1958gm
Apr 21 2017 01:52
@MathematicsCoding Yes M is 1000 - so you transfer 1000 from num to answer and tranform it to M using your array
Mohamed Derhalli
@derhallim
Apr 21 2017 01:52
@sjames1958gm :D :D thanks
CamperBot
@camperbot
Apr 21 2017 01:52
derhallim sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6853 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Priya Gurung
@PriyaG88
Apr 21 2017 01:53
@ryan87 show us your code :)
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:53
I dont understand how to do it with that var answer with empty string
Stephen James
@sjames1958gm
Apr 21 2017 01:53
@ryan87 You didn't have any code in the function
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:53
answer+roNum[i][0] somewhere?
Stephen James
@sjames1958gm
Apr 21 2017 01:53
@MathematicsCoding you add roNum[13][0] to answer
Mohamed Derhalli
@derhallim
Apr 21 2017 01:53
@sjames1958gm to the rescue :joy:
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:53
Like that?
ryan87
@ryan87
Apr 21 2017 01:53
I've tried several things but none of it even yielded to partial correctness
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:54
@derhallim Im sorry I failed to rescue you :(
Stephen James
@sjames1958gm
Apr 21 2017 01:54
@ryan87 result = myNoun + " here " + myAdjective + . . .
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:54
answer+roNum[i][0] somewhere?
Can I do that?
ryan87
@ryan87
Apr 21 2017 01:54
i'm completely baffled as where to start. do i create another variable and then fit the string in there with the proper spaces?
hmmmmm.......
Stephen James
@sjames1958gm
Apr 21 2017 01:54
@MathematicsCoding answer += roNum[13][0]
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:55
Okay..
Why not i instead of 13?
Stephen James
@sjames1958gm
Apr 21 2017 01:55
@ryan87 result is there for you to add strings to
ryan87
@ryan87
Apr 21 2017 01:55
I suppose I was confused by the fact that it says my code needed to be below the "result" line
Mohamed Derhalli
@derhallim
Apr 21 2017 01:55
@MathematicsCoding u suspected my awesome knowledge about 404 :joy:
Stephen James
@sjames1958gm
Apr 21 2017 01:55
@ryan87 In that space result += you can also do
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:55
@derhallim lol
ryan87
@ryan87
Apr 21 2017 01:55
i'll try it out. I really appreciate your patience and help
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:56
If you knew then you should be to understand why site 2 isnt returning 404..
I think :\
Stephen James
@sjames1958gm
Apr 21 2017 01:56
@MathematicsCoding We were working in the specific case of 13 - but yes i would be correct
David Miller
@DavidMillerFL
Apr 21 2017 01:56
@sjames1958gm Hah! It worked!
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:56
@sjames1958gm what about all the answer?
Mohamed Derhalli
@derhallim
Apr 21 2017 01:56
@MathematicsCoding nah, it has something to do with domain / sub-domain
as Stephen said
that part I didn't know of
David Miller
@DavidMillerFL
Apr 21 2017 01:56
I can’t believe it!
Mohamed Derhalli
@derhallim
Apr 21 2017 01:56
for me, both of them are unreachable
Stephen James
@sjames1958gm
Apr 21 2017 01:56
@DavidMillerFL Believe it Brudder !
ROBUSTO8
@ROBUSTO8
Apr 21 2017 01:57

can someone point me in the right direction for the "Caesar's Cipher" challenge? I've managed to turn the string into an array of numbers matching the letters and then subtracting 13 from all those array numbers but, i can't figure out how to turn those numbers into letters again or how I'm going to join them correctly to fit the original sentence structure here's what I've got so far...:

function rot13(str) { // LBH QVQ VG!
var newStr = "";
for (var i = 0; i < str.length; i++) {
newStr += str.charCodeAt(i) + ',';

}
var newStrSplit = newStr.split(",").map(function(val){
return val -13;
});
newStrSplit.pop();

return newStrSplit;
}

this returns: [70, 56, 69, 69,....etc.] is this even the right way to go about this challenge? starting to feel like I'm veering off course and there is a better way to solve this...

Stephen James
@sjames1958gm
Apr 21 2017 01:57
@derhallim There is probably an external router or something for the 404 one that can reject.
The other one probably fails DNS lookup altogether and might not even leave your system
@ROBUSTO8 How is this an array of numbers - it looks like a string with a bunch of commas. newStr += str.charCodeAt(i) + ',';
if you want an array you should start with [] and use push.
Saboor Malik
@MathematicsCoding
Apr 21 2017 01:59
@sjames1958gm so add answer+=roNum[..][..] inside while loop block?
Stephen James
@sjames1958gm
Apr 21 2017 01:59
@ROBUSTO8 Oh, I see the split after than - sorry
ryan87
@ryan87
Apr 21 2017 01:59
@sjames1958gm sorry stephen, i must be misunderstanding what your saying to me. I tried your advice in two different ways and still seem to be at a deadlock.
Stephen James
@sjames1958gm
Apr 21 2017 01:59
@ROBUSTO8 But pushing the numbers would be better
@MathematicsCoding Yes. and to answer and subtract from num
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:00
So if I wanted to subtract num
Stephen James
@sjames1958gm
Apr 21 2017 02:00
@ryan87 In the space they tell you
result += myNoun + " here " + myAdjective + . . . just finish out with all the values
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:00
answer+=roNum[..][..];
num-roNum[i][1]
These inside while loop?
Stephen James
@sjames1958gm
Apr 21 2017 02:01
@MathematicsCoding Well the second one doesn't change num, so not exactly
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:01
So first one is correct?
Stephen James
@sjames1958gm
Apr 21 2017 02:01
@MathematicsCoding Yes - you understand what it is doing?
ryan87
@ryan87
Apr 21 2017 02:01
I understand that, however, the directions are saying that my code is supposed to go beneath "result" not within it. I've tried it both ways and neither worked.'
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:02
oh if num is smaller than [13][1] so it would return negative number
I thinks so
Stephen James
@sjames1958gm
Apr 21 2017 02:02
@ryan87
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "";
  // Your code below this line

result += myNoun + " here " + myAdjective + . . . just finish out with all the values

  // Your code above this line
  return result;
}
@MathematicsCoding But it won't be smaller than roNum[i][1]
stargazer32109
@stargazer32109
Apr 21 2017 02:03
I have a issue... I am working on a very complicated program in eclipse no clue even where to start... I am trying to make a program that basically has just the laws of physics earth, quantum physics etc. So It is basically like reality and there is no rules or predefined objects. It is hard to explain and I am really sure that the first step is developing my own engine?
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:03

function convertToRoman(num) {
  var answer = "";
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
for (var i=13;i>=0;i--) {
while (num>roNum[i][1]) {
  answer+=roNum[13][0];
  num-roNum[][1];
}
}
}

convertToRoman(600);
Right... since num>...
Stephen James
@sjames1958gm
Apr 21 2017 02:04
@MathematicsCoding 13 was only for discussion - it should be roNum[i][0]
And you are not changing num in the loop so infinite loop
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:04
...
I said [i][0] but you said "I would be correct"
Never mind...
Ok changed 13 to i
Stephen James
@sjames1958gm
Apr 21 2017 02:05
num-roNum[][1]; this is wrong for two reasons
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:05
Yeah its empty..
I didnt know whats to add
Whats other reason?
Stephen James
@sjames1958gm
Apr 21 2017 02:06
It isn't changing num
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:07

function convertToRoman(num) {
  var answer = "";
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
for (var i=13;i>=0;i--) {
while (num>roNum[i][1]) {
  answer+=roNum[i][0];
  num-roNum[i][1];
}
}
}

convertToRoman(600);
@sjames1958gm I dont understand what you meant
Stephen James
@sjames1958gm
Apr 21 2017 02:07
num-roNum[i][1]; this does not change the value of num
ryan87
@ryan87
Apr 21 2017 02:07
thanks @sjames1958gm . It seems the major issue was that I wasn't mixing "result" in the code. Appreciate your help!
CamperBot
@camperbot
Apr 21 2017 02:07
ryan87 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6854 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:08
@sjames1958gm So I have to change i to number?
Stephen James
@sjames1958gm
Apr 21 2017 02:08
@ryan87 :+1: When the sample code has return someVar provided assume that you need to put the calculation or whatever into that variable
@MathematicsCoding Why
Anthony Contreras
@AmazeCPK
Apr 21 2017 02:08
I am having the toughest time trying to upload an image to cloudinary using a node application. can anyone lend a hand please?
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:08
Im confused...
Stephen James
@sjames1958gm
Apr 21 2017 02:09
num-roNum[i][1]; - this just subtracts from num and just throws the result away
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:09
You said its does not change the value
Stephen James
@sjames1958gm
Apr 21 2017 02:09
num is unchanged
ryan87
@ryan87
Apr 21 2017 02:09
@sjames1958gm , are there any books or sites that you would recommend for additional info on learning javascript?
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:09
change i to right number then?
Anthony Contreras
@AmazeCPK
Apr 21 2017 02:09
I'm just trying to have a form where someone can upload a file, I'm getting all kinds of errors, and dont quite know how to continue
Stephen James
@sjames1958gm
Apr 21 2017 02:09
Look at the line above it and there is something on that line that is not on this line
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:10
@ryan87 Eloquent Javascript or You dont know JS book
@ryan87 if you know JS well I wouldnt recommand Eloquent JS
ryan87
@ryan87
Apr 21 2017 02:10
thanks @MathematicsCoding . I was reading something yesterday about "eloquent javascript". i'll check it out tonight. Thanks!
CamperBot
@camperbot
Apr 21 2017 02:10
ryan87 sends brownie points to @mathematicscoding :sparkles: :thumbsup: :sparkles:
:cookie: 331 | @mathematicscoding |http://www.freecodecamp.com/mathematicscoding
ryan87
@ryan87
Apr 21 2017 02:11
I'm at the point in my javascript career where eloquent javascript will do me well :)
Stephen James
@sjames1958gm
Apr 21 2017 02:11
@MathematicsCoding Trying not to just give you the answer.
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:11
@ryan87 well actually if you do know JS well you probably dont know first second half chapters
But personally I think "You dont know JS" is better
@sjames1958gm because of 0 and 1?
ryan87
@ryan87
Apr 21 2017 02:13
I'll try that out as well . I'm finally having that breakthrough period where it's all starting to make sense and come together but i'm still at rookie status.
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:13
@sjames1958gm Missing =?
Stephen James
@sjames1958gm
Apr 21 2017 02:14
@MathematicsCoding bingo
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:15
oh..

Sorry I didnt read this one

Look at the line above it and there is something on that line that is not on this line

Stephen James
@sjames1958gm
Apr 21 2017 02:15
Without the = the result is just lost
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:15

function convertToRoman(num) {
  var answer = "";
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
for (var i=13;i>=0;i--) {
while (num>roNum[i][1]) {
  answer+=roNum[i][0];
  num-=roNum[i][1];
}
}
}

convertToRoman(600);
Well?
Mohamed Derhalli
@derhallim
Apr 21 2017 02:15
@sjames1958gm got it :)
Stephen James
@sjames1958gm
Apr 21 2017 02:15
@MathematicsCoding Great
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:15
So I have to return something?
Stephen James
@sjames1958gm
Apr 21 2017 02:16
well it will help
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:16

function convertToRoman(num) {
  var answer = "";
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
for (var i=13;i>=0;i--) {
while (num>roNum[i][1]) {
  answer+=roNum[i][0];
  num-=roNum[i][1];
}
  return answer;
}
}

convertToRoman(600);
Return wrong place?
Stephen James
@sjames1958gm
Apr 21 2017 02:16
is it in side a loop/
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:17
Oh return had to be inside while loop?
block
Stephen James
@sjames1958gm
Apr 21 2017 02:17
no not inside any loop
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:17
Because return stop any loops?
I thought its for loop?
Stephen James
@sjames1958gm
Apr 21 2017 02:18
yes
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:18
I see..
Stephen James
@sjames1958gm
Apr 21 2017 02:18
return just exits the function
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:18
So I have to return outside either of these loop?

function convertToRoman(num) {
  var answer = "";
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
for (var i=13;i>=0;i--) {
while (num>roNum[i][1]) {
  answer+=roNum[i][0];
  num-=roNum[i][1];
}
}
  return answer;
}

convertToRoman(600);
Stephen James
@sjames1958gm
Apr 21 2017 02:19
ok
Keon Samuel
@keonsam
Apr 21 2017 02:20
who read one piece manga today?
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:22
@sjames1958gm sorry I dont understand :(
Stephen James
@sjames1958gm
Apr 21 2017 02:22
Try roNum -1 instead of 13
The last entry is index 12 not 13
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:23
which one?
ooo
I see it return answer but a number decreases the value
Like num = 2 but answer return "I"
Try roNum -1 instead of 13
WHich one?
Stephen James
@sjames1958gm
Apr 21 2017 02:25
there was only one 13
Study the code and think why you might be off by one
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:26

function convertToRoman(num) {
  var answer = "";
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
for (var i=-1;i>=0;i--) {
while (num>roNum[i][1]) {
  answer+=roNum[i][0];
  num-=roNum[i][1];
}
}
  return answer;
}

convertToRoman(5);
I thought you are talking about i with roNum...
I did i+1 but didnt work so well
Stephen James
@sjames1958gm
Apr 21 2017 02:29
i = roNum.length is where you need to start
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:31
Sigh I cant figure out whats wrong with the code
I thought it was 0 to roNum.length but..
GaganSinghwa
@GaganSinghwa
Apr 21 2017 02:31
var array=["singh","gagan"];
var newArray=array.forEach((value,index,collection)=>{

  //console.log(value.charAt(0).toUpperCase()+ value.slice(1))

  return value.charAt(0).toUpperCase()+ value.slice(1)

})
my code and i want it to return to an array i tried to create an emety array and then push to it but that didnt do anything
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:32

function convertToRoman(num) {
  var answer = "";
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
for (var i=roNum.length-1;i>=0;i--) {
while (num>roNum[i][1]) {
  answer+=roNum[i][0];
  num-=roNum[i][1];
}
}
  return answer;
}

convertToRoman(2);
roNum.length is 13 but I subtract 1 so It would be 12
Stephen James
@sjames1958gm
Apr 21 2017 02:33
yes [13] is byond the end of the array
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:34
So I cant seem find the problem
Jeez it could be so simple but still
GaganSinghwa
@GaganSinghwa
Apr 21 2017 02:35
your code seems to be working @MathematicsCoding
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:35
@GaganSinghwa Yeah but 2 return "I"
Stephen James
@sjames1958gm
Apr 21 2017 02:35
This is where it counts to be able to think about the output and why it is not what it should be - try some more why would 2 result in I not II
Play computer with the value 2
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:35
Code is a little off
Thats what Im doing right now :\
GOT IT

function convertToRoman(num) {
  var answer = "";
 var roNum = [["I",1],["IV",4],["V",5],["IX",9],["X", 10],["XL",40],["L", 50],["XC",90],["C",100],["CD",400],["D",500],["CM",900],["M",1000]];
for (var i=roNum.length-1;i>=0;i--) {
while (num+1>roNum[i][1]) {
  answer+=roNum[i][0];
  num-=roNum[i][1];
}
}
  return answer;
}

convertToRoman(2);
well?
Stephen James
@sjames1958gm
Apr 21 2017 02:36
Does that work for all the test cases?
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:36
Yea
I passed :\
@sjames1958gm was that not what you expected?
What were you expecting for?
Stephen James
@sjames1958gm
Apr 21 2017 02:37
num >= roNum[i][1] is what I was thinking but yours does the same
Good work
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:37
Well thanks
Thanks @sjames1958gm :)
CamperBot
@camperbot
Apr 21 2017 02:37
mathematicscoding sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6855 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
GaganSinghwa
@GaganSinghwa
Apr 21 2017 02:37
var array=["singh","gagan"];
var newArray=array.forEach((value,index,collection)=>{

  //console.log(value.charAt(0).toUpperCase()+ value.slice(1))

  return value.charAt(0).toUpperCase()+ value.slice(1)

})
@sjames1958gm i am trying to get values to be pushed into the array i tried to push it into an arrya but that didnt work
Stephen James
@sjames1958gm
Apr 21 2017 02:38
forEach doesn't return a value - you want map instead
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:38
@sjames1958gm Can I see your solution?
I wonder what your solution looks like..
Stephen James
@sjames1958gm
Apr 21 2017 02:40
function convertToRoman(num) {

  var result = "";

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

  var i = 0;
  while (num > 0) {
    if (num >= cvrt[i][0]) {
      result += cvrt[i][1];
      num -= cvrt[i][0];
    }
    else i++;
  }

  return result;
}
looks familiar
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:40
Thats alot of code
Two ways?
Stephen James
@sjames1958gm
Apr 21 2017 02:41
pasted twice
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:41
Ah
I noticed that I didnt even use a single method that fCC provided..
I wonder if fCC think I copied some solution somewhere..
Without using a single method that they provided
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 02:43
mornin
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:43
@HeebieGeeBee Morning
Stephen James
@sjames1958gm
Apr 21 2017 02:43
evening
Jason Luboff
@JLuboff
Apr 21 2017 02:43
@derhallim at the gym...so sort of?
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:44
@JLuboff what are you working on?
Chest&Abs, legs, back or..
Well first what kind of workout?
Bodybuilder, crossfit, etc
Jason Luboff
@JLuboff
Apr 21 2017 02:45
Did some cardio. Now doing back and biceps. Just weightlifting
Jeremy Seilhymer
@jseilhymer
Apr 21 2017 02:45
Hey people!! Can anyone help with a JS problem I'm having?
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:45
@JLuboff I see
I do crossfit
Love them :)
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 02:46
isnt crossfit a cult
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:46
Bench press, clean, shouldpress, etc.
cult?
Danny Welstad
@GoonTwo
Apr 21 2017 02:47
can anybody see why the click events for the session length buttons aren't working? They are at the end of the JS code. The session length value should update when the plus and minus are clicked. nothing console logs when they are clicked.
Jason Luboff
@JLuboff
Apr 21 2017 02:49
@HeebieGeeBee it has a strong following, and some members can be....preachy....about it. Sort of like vegans.
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 02:50
@JLuboff lol yeah
Jason Luboff
@JLuboff
Apr 21 2017 02:51
Personally I don't care for the ideology of crossfit but to each their own
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 02:52
@GoonTwo look at your console
the dev tools console
you need $('#time').innerHTML = timerLength + ':' + seconds; this, not - $('#time').innerHTML = timerLength + ':' seconds;
@JLuboff yeah i was just kidding
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:53
@HeebieGeeBee lol you fooled me
I didnt see the difference
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 02:54
i was joking about the way ppl talk about it, is how they talk when theyre in a cult
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:54
I dont understand what cult is
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 02:54
well all religions are cults
just means something that has passionate following or something
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:55
I see
So cult means like religion
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 02:55
but the way i said it is how you refer to one of the crazy religions like scientology
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:56
Yeah crossfit is more like cult to me
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 02:56
or the jones town peoples temple
or mansons family
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:56
Whoa
I had 327 during challenge then I restarted
boom
331
@keonsam
about @keonsam
CamperBot
@camperbot
Apr 21 2017 02:57
:cookie: 332 | @keonsam |http://www.freecodecamp.com/keonsam
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:57
Damn
So close :\
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 02:58
ty @MathematicsCoding
CamperBot
@camperbot
Apr 21 2017 02:58
heebiegeebee sends brownie points to @mathematicscoding :sparkles: :thumbsup: :sparkles:
:cookie: 332 | @mathematicscoding |http://www.freecodecamp.com/mathematicscoding
Jeremy Seilhymer
@jseilhymer
Apr 21 2017 02:58
Can anyone drop some JS knowledge on me? I'm having an issue with the 'Stand in line' challenge.
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:58
Thanks :\ we are equal now
@jseilhymer Use the methods you have learned
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 02:58
@jseilhymer what do you need to know?
Jason Luboff
@JLuboff
Apr 21 2017 02:58
I don't know that I would say religions are cults. I feel like cults are a step above, overly committed, forceful at trying to get others to join, non stop talking about it...I dunno
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:59
Dont try to understand why ,just follow the directions
Danny Welstad
@GoonTwo
Apr 21 2017 02:59
@HeebieGeeBee thanks
CamperBot
@camperbot
Apr 21 2017 02:59
goontwo sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1400 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Jeremy Seilhymer
@jseilhymer
Apr 21 2017 02:59
@MathematicsCoding Like append and prepend?
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:59
@jseilhymer no like shift , pop, push etc
4 methods
You have to use 2 of them for that challenge
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 02:59
@JLuboff im just saying technically they are, but when in general parlance we call things cults when they are a little more freakish
Saboor Malik
@MathematicsCoding
Apr 21 2017 02:59
Shift and push methods
Danny Welstad
@GoonTwo
Apr 21 2017 02:59
@HeebieGeeBee is there something wrong with the last 2 lines of my JS that is stopping it from updating the html?
Jeremy Seilhymer
@jseilhymer
Apr 21 2017 03:00
Gotcha thank you. It's been a while since learning those methods so I'll get with the program. Thanks.
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:00
:+1:
Jason Luboff
@JLuboff
Apr 21 2017 03:01
@HeebieGeeBee ya fair enough
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:02
@jseilhymer sometime it would be useful if you says t h an k s to person whoever helped you :)
Jason Luboff
@JLuboff
Apr 21 2017 03:02
@MathematicsCoding just wondering....why would you tell someone to not try to understand why?
Manish Giri
@Manish-Giri
Apr 21 2017 03:02
lol
:wave: @JLuboff
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:03
@JLuboff well alot of people tried to understand why to do them in descriptions and got them confusing more
You know?
"Why do I have to do that to get same two parameters?"
I think "Stand In line" is most commonly problem..
@jseilhymer You should try use pythontutor to understand JS more
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:06
@Manish-Giri yo
Manish Giri
@Manish-Giri
Apr 21 2017 03:06
@HeebieGeeBee :wave:
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:06
@GoonTwo you might want to use jQuery's .html() method
Jason Luboff
@JLuboff
Apr 21 2017 03:06
@Manish-Giri yo
Jeremy Seilhymer
@jseilhymer
Apr 21 2017 03:07
@MathematicsCoding pythontutor?
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:07
Its a site to explain any programming languages better
Jason Luboff
@JLuboff
Apr 21 2017 03:07
@MathematicsCoding that's all the more reason why they should understand. That's idiotic to tell someone that's trying to learn something to not bother understanding it
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:07
How they worked
@JLuboff I meant to tell them try to not understand during the challenge..
Ugh I dont even want to explain
Just forget it :\
@jseilhymer Try it
Jason Luboff
@JLuboff
Apr 21 2017 03:08
@Manish-Giri finish the first edition yet?
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:09
Pick JS then copy / paste code there
Click Visualize Ex...
Jeremy Seilhymer
@jseilhymer
Apr 21 2017 03:10
@MathematicsCoding Thanks again. Super noob here. How to I give brownie points?
CamperBot
@camperbot
Apr 21 2017 03:10
jseilhymer sends brownie points to @mathematicscoding :sparkles: :thumbsup: :sparkles:
:cookie: 333 | @mathematicscoding |http://www.freecodecamp.com/mathematicscoding
Danny Welstad
@GoonTwo
Apr 21 2017 03:10
@HeebieGeeBee awesome that worked! But I don't think I understand why i needed to use that method as opposed to using innerHTML
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:10
@jseilhymer Like that lol'
You says thanks to @username
CamperBot
@camperbot
Apr 21 2017 03:10
mathematicscoding sends brownie points to @username :sparkles: :thumbsup: :sparkles:
:warning: @username's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:10
You see?
Jeremy Seilhymer
@jseilhymer
Apr 21 2017 03:12
nope.
Mohamed Derhalli
@derhallim
Apr 21 2017 03:12
is Ramda gd to learn?
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:12
@jseilhymer thanks
CamperBot
@camperbot
Apr 21 2017 03:12
mathematicscoding sends brownie points to @jseilhymer :sparkles: :thumbsup: :sparkles:
:cookie: 173 | @jseilhymer |http://www.freecodecamp.com/jseilhymer
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:13
see?
Just say thanks
with @camperbot
@username*
Jeremy Seilhymer
@jseilhymer
Apr 21 2017 03:13
@MathematicsCoding thanks
CamperBot
@camperbot
Apr 21 2017 03:13
jseilhymer sends brownie points to @mathematicscoding :sparkles: :thumbsup: :sparkles:
:warning: jseilhymer already gave mathematicscoding points
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:13
@jseilhymer You have already did it lol
Jeremy Seilhymer
@jseilhymer
Apr 21 2017 03:14
@MathematicsCoding Ha i see that now. But i had no idea how i did it :)
Mohamed Derhalli
@derhallim
Apr 21 2017 03:14
@JLuboff aaaa :D
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:14
@MathematicsCoding Thanks again. Super noob here. How to I give brownie points?
CamperBot
@camperbot
Apr 21 2017 03:14
sorry mathematicscoding, you can't send brownie points to yourself! :sparkles: :sparkles:
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:14
That what you said
Mohamed Derhalli
@derhallim
Apr 21 2017 03:15
@JLuboff @sjames1958gm did u use Ramda before?
Palak Trivedi
@Palaklive
Apr 21 2017 03:15
```
for i in a:
for i in a:
what is meaning of ":" sing
Mohamed Derhalli
@derhallim
Apr 21 2017 03:16
@Palaklive post the whole code
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:16
That looks like Python rather than JS
@Palaklive
Where did you see that
Jason Luboff
@JLuboff
Apr 21 2017 03:17
@derhallim never used it
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:17
@derhallim I used Ramda before
Or rather, tried
Helpful for currying functions
Mohamed Derhalli
@derhallim
Apr 21 2017 03:18
@JLuboff it;s alright
@kuriakinzeng recommend to learn?
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:19
@GoonTwo i dunno the technical reason, but theres issues using the jquery selectors accessing the element object sometimes
@derhallim yo
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:19
@derhallim yeah it's cool. Functional programming
Palak Trivedi
@Palaklive
Apr 21 2017 03:19
It JS
a = [1, 2, 3, 4, 5, 6]
b = [3, 5, 6, 8, 9, 1]
def array_diff(a, b):
    new_list = []
    for i in a:
        if i not in b:
            new_list += [i]
    return new_list

print(array_diff(a, b))
Mohamed Derhalli
@derhallim
Apr 21 2017 03:19
@kuriakinzeng got u
thanks @kuriakinzeng
CamperBot
@camperbot
Apr 21 2017 03:19
derhallim sends brownie points to @kuriakinzeng :sparkles: :thumbsup: :sparkles:
:cookie: 376 | @kuriakinzeng |http://www.freecodecamp.com/kuriakinzeng
Mohamed Derhalli
@derhallim
Apr 21 2017 03:19
@Palaklive that's not JS
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:20
That's mf python
@Palaklive
Palak Trivedi
@Palaklive
Apr 21 2017 03:21
It's ecmascript means advance javascript
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:21
its not
Mohamed Derhalli
@derhallim
Apr 21 2017 03:21
ecmascript is javacript
javascript is ecmascript
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:21
we are ecmascript
ecmascript is us
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:22
@Palaklive would be helpful if you tell us where u get that from
Mohamed Derhalli
@derhallim
Apr 21 2017 03:22
def / print is not javascript
Palak Trivedi
@Palaklive
Apr 21 2017 03:22
JavaScript no more required semicolon if we want to write 2 sttatment in same line then required semicolon
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:22
what is happening
runs away
Mohamed Derhalli
@derhallim
Apr 21 2017 03:22
:joy: @HeebieGeeBee
Daniel López
@whatsupbro
Apr 21 2017 03:23
Hello everyone, I am learning how to code, I am currently learning Javascript but I' ve seeing that they write strings like that " " or like this ' ', is there any rule, or we caun use whatever we want.
Mohamed Derhalli
@derhallim
Apr 21 2017 03:23
@Palaklive that is true
but that code is not JS
Palak Trivedi
@Palaklive
Apr 21 2017 03:23
@kuriakinzeng I'm working with NodeJs and also learn ES6 so I develope some code
a27-suryansh
@a27-suryansh
Apr 21 2017 03:23
What am i doing wrong?
Mohamed Derhalli
@derhallim
Apr 21 2017 03:23
@whatsupbro no rule, both valid, but they use ' ' more than " " ..
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:23
@Palaklive Where did you get that chunk of code?
a27-suryansh
@a27-suryansh
Apr 21 2017 03:23

Instructions

Combine the two if statements into one statement which returns "Outside" if val is not between 10 and 20, inclusive. Otherwise, return "Inside".

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

  if (val>=10 || val<=20) {
    return "Outside";
  }
  // Only change code above this line
  return "Inside";
}

// Change this value to test
testLogicalOr(15);
Jason Luboff
@JLuboff
Apr 21 2017 03:24
Technically ECMAscript is a standard, it just encompasses JavaScript
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:24
@Palaklive If you don't know what it does, it's probably not written by you right?
Daniel López
@whatsupbro
Apr 21 2017 03:24
@derhallim Thanks man
CamperBot
@camperbot
Apr 21 2017 03:24
whatsupbro sends brownie points to @derhallim :sparkles: :thumbsup: :sparkles:
:cookie: 247 | @derhallim |http://www.freecodecamp.com/derhallim
Mohamed Derhalli
@derhallim
Apr 21 2017 03:24
:v:
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:24
@Palaklive yeah so if you select Javascript on top, you see different thing
If you select python, you get the syntax you're showing us
def is python brahh
Mohamed Derhalli
@derhallim
Apr 21 2017 03:25
@kuriakinzeng :joy:
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:25
and ruby
Palak Trivedi
@Palaklive
Apr 21 2017 03:25
Thanks for support
Mohamed Derhalli
@derhallim
Apr 21 2017 03:25
ruby is a name of an arabic singer
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:26
lol np @Palaklive
to make the obligatory meme, trust us, we are engineers
Marlon
@mblmarlon
Apr 21 2017 03:27

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

return arr; // Change this line
}

Khoa Le
@Zacele
Apr 21 2017 03:27
hi guys
Marlon
@mblmarlon
Apr 21 2017 03:27
what is wrong??
Khoa Le
@Zacele
Apr 21 2017 03:27
currently have little trouble with the challenge of finding the longest word in a string
here is my code
function findLongestWord(str) {
var a= str.split(" ");
var max=0;
for(var x=0; x<=a.length;x++){
if(a[x].length>max){
max= a[x].length;
return a[x];
} continue;
}
}
function findLongestWord(str) {
var a= str.split(" ");
var max=0;
for(var x=0; x<=a.length;x++){
if(a[x].length>max){
max= a[x].length;
return max;
} continue;
}
}
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:28
@mblmarlon shift doesnt need an argument and youre meant to return the shift
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:28
@mblmarlon indeed, shift removes the first element and returns the element you just removed
Marlon
@mblmarlon
Apr 21 2017 03:29

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

return shift; // Change this line
}

Khoa Le
@Zacele
Apr 21 2017 03:29
why my code always was stopped right at the begginning of the array but not loop through the whole array ?
Marlon
@mblmarlon
Apr 21 2017 03:29
like this?
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:29
return arr.shift()
@Zacele cus youre returning in the loop
when the function reaches a return it ends the function
Marlon
@mblmarlon
Apr 21 2017 03:30
@HeebieGeeBee still wrong :///
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:31
theres only meant to be one shift in the function @mblmarlon
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:33
lol
I was trying to watch anime
but
You either have Javascript turned off or an old version of Flash Player.
Marlon
@mblmarlon
Apr 21 2017 03:35

@HeebieGeeBee thank you i passed it :) but just for understanding.

return arr.shift() is like an arr shift within the function wich is written out? so it is an individual manipulation with or without return, right?

CamperBot
@camperbot
Apr 21 2017 03:35
mblmarlon sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1401 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:35
@mblmarlon yes
Saboor Malik
@MathematicsCoding
Apr 21 2017 03:35
ok its working now for some reason
Cya watching anime
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:35
cya
Brandon
@Minneanimal
Apr 21 2017 03:37

OK, I've been racking my brain over this one all day....REGEX / .replace / a palindromes function. I am able to return the string with all digits and special characters removed. However, my if statement is still returning false for strings in which special characters were removed. I have a feeling I'm doing this the hard way.... ```
function palindrome(str) {
// Good luck!
var reverseStr = str.split('').reverse().join('').toLowerCase();
if (str === reverseStr.replace(/\s|\d|\W|_/g, '')) {
return true;
} else {
return false;
}
}

palindrome("_eye");``` Any help tips on solving this would be extremely appreciated!

HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:38
@Minneanimal you need to remove special charcters from both the forward and reverse or the word
and btw you need to keep the numbers
so just \W|_ will be enough for the regex
Chris Cullen
@123xylem
Apr 21 2017 03:44
function Dog(name,age){
this.name=name;
this.age=age;
this.bark=function(){
console.log(this.name +"just Barked!")}
}
In this constructor.. Why is it that this.bark() refers to the name? If i defined age first would it only work with age number?
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:45
it doesnt
this.bark refers to the dog
Chris Cullen
@123xylem
Apr 21 2017 03:45
yes
but if i say rex.bark()
Ogundele Olumide
@Lumexralph
Apr 21 2017 03:46
@123xylem it does not refer to name, it will be method inherited by the instance of Dog constructor using new keyword
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:46
@Lumexralph mornin
Ogundele Olumide
@Lumexralph
Apr 21 2017 03:46
@HeebieGeeBee good morning
Brandon
@Minneanimal
Apr 21 2017 03:46
@HeebieGeeBee thanks, sir. I'm not ignoring you. Just trying to apply your guidance!
CamperBot
@camperbot
Apr 21 2017 03:46
minneanimal sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1402 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Ogundele Olumide
@Lumexralph
Apr 21 2017 03:46
@HeebieGeeBee you're faster
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:46
had my liter of coffee already
Chris Cullen
@123xylem
Apr 21 2017 03:47
so if i said 20 =new Dog(rex,9) ? what would this.bark() do?
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:47
nothing
Ogundele Olumide
@Lumexralph
Apr 21 2017 03:48
@123xylem it will be passed to 20 to use as its method
Teng Peng
@pt7321
Apr 21 2017 03:48
anyone can tell me how to make change that this code below to fulfill when type empty dispaly "input cannot be empty". im really stucking
<html>
<head>

<script>

function input_empty() {
alert("input cannot be empty");
}


</script>
</head>
<body>
<div>
<input onblur="input_empty()"></div>

</body>


</html>
Victoria Zambrano
@vzambrano98
Apr 21 2017 03:48
trying to find the greatest common divisor and i'm stuck with an infinite loop some where in here. I can't see what I've missed. Anyone have a suggestion?
function gcd(arr){
      var temp;
  var a=arr[0]; var b=arr[1];
    while (temp!==0){
    temp=a%b;
    a=b;
    b=temp;
    }
    return b;

}
gcd (1, 5);
Chris Cullen
@123xylem
Apr 21 2017 03:48
@Lumexralph @HeebieGeeBee ok i tried it and first it wont take a number as the new instance.. but it always uses the name property in the bark
im an idiot
the method isdefined like that
just i was using the name to call this.bark and it threw me
thanks
Ogundele Olumide
@Lumexralph
Apr 21 2017 03:50
@123xylem :+1:
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:50
@vzambrano98 im guessing that it doesnt know that temp will ever be exactly 0 so theres possible infinite loop
@vzambrano98 though there looks like some oddness with the whole code
when you call the function gcd(1,5) i dont see an array here
CatherineKa
@CatherineKa
Apr 21 2017 03:52
Hi everyone! I am Catherine
Victoria Zambrano
@vzambrano98
Apr 21 2017 03:52
@HeebieGeeBee oh my bad, that was me. it's supposed to be an array
Hi @CatherineKa
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:52
@CatherineKa hi
CatherineKa
@CatherineKa
Apr 21 2017 03:52
I am the new one to learn code.
Ogundele Olumide
@Lumexralph
Apr 21 2017 03:53
@CatherineKa cool
CatherineKa
@CatherineKa
Apr 21 2017 03:53
I am learning javaScript now
Gulsvi
@gulsvi
Apr 21 2017 03:53
Much nicer people here @CatherineKa :)
CatherineKa
@CatherineKa
Apr 21 2017 03:53
aha that's you
Gulsvi
@gulsvi
Apr 21 2017 03:53
(don't tell the other room I said that lol)
Victoria Zambrano
@vzambrano98
Apr 21 2017 03:53
@HeebieGeeBee besides the calling of the function, is there another location in the code that I should take a closer loop at? is it just the set up of the while loop
CatherineKa
@CatherineKa
Apr 21 2017 03:54
Hahah
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:54
@vzambrano98 i just dont understand the logic inside the while loop
CatherineKa
@CatherineKa
Apr 21 2017 03:54
let's learn together
anyone is learning "Profile Lookup"? I just get stuck there
Ogundele Olumide
@Lumexralph
Apr 21 2017 03:55
@CatherineKa tried anything?
Palak Trivedi
@Palaklive
Apr 21 2017 03:55
What is a meaning of .match(/([^])\1+/g)
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:55
@vzambrano98 sorry maybe theres something im not getting maybe @SkyCoder01 or @Lumexralph can understand it better
CatherineKa
@CatherineKa
Apr 21 2017 03:56
blob
Ogundele Olumide
@Lumexralph
Apr 21 2017 03:56
@Palaklive it's to match a certain regex pattern in a string
Brandon
@Minneanimal
Apr 21 2017 03:57

@HeebieGeeBee you are a baller! I still can't figure out how to get markdown to appear in the chat. But here's what I came up with. Thanks for the help `function palindrome(str) {
// Good luck!
str = str.replace(/\W|_/g,'').toLowerCase();
var reverseStr = str.split('').reverse().join('');
if (str === reverseStr) {
return true;
} else {
return false;
}
}

palindrome("A man, a plan, a canal. Panama");`

CamperBot
@camperbot
Apr 21 2017 03:57
minneanimal sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:warning: minneanimal already gave heebiegeebee points
Victoria Zambrano
@vzambrano98
Apr 21 2017 03:57

@HeebieGeeBee No it's not you, I'm just not super strong at algorithms. so apologies. I'll explain how i got. in wikipedia it talks about Euclid's algorithm and how to find the greatest common divisor, it explains the concept with this:

>
To compute gcd(48,18), divide 48 by 18 to get a quotient of 2 and a remainder of 12. Then divide 18 by 12 to get a quotient of 1 and a remainder of 6. Then divide 12 by 6 to get a remainder of 0, which means that 6 is the gcd. Note that we ignored the quotient in each step except to notice when the remainder reached 0, signalling that we had arrived at the answer.

Victoria Zambrano
@vzambrano98
Apr 21 2017 03:57
oh! I didn't know I could crazy indent like that! lol cool
CatherineKa
@CatherineKa
Apr 21 2017 03:57
this is the code I write. I think the problem is at the what to return, but I don't know how to fix it.
HeebieGeeBee
@HeebieGeeBee
Apr 21 2017 03:58
@vzambrano98
function gcd(arr){
      var temp;
  var a=arr[0]; var b=arr[1];
    while (temp!==0){
    temp=a%b;     // so in this call temp is going to be 5
    a=b;       //then you make a === 5
    b=temp;   //then you make b === 5
    }
    return b;

}
gcd (1, 5);
Palak Trivedi
@Palaklive
Apr 21 2017 03:58
Thanks @Lumexralph
CamperBot
@camperbot
Apr 21 2017 03:58
palaklive sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1539 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Apr 21 2017 03:58
@CatherineKa prop just like a variable though a parameter can't be used to access the object using dot notation, use bracket notation
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 03:59
@CatherineKa indeed, use contact[prop]
For your return statement
Ogundele Olumide
@Lumexralph
Apr 21 2017 03:59
@Palaklive :+1:
barki mustapha
@barkinet
Apr 21 2017 03:59
function loadProfile() {
getUser(function (err, user) {
if (err) {
handleError(err);
} else {
getProfile(user.id, function (err, profile) {
if (err) {
handleError(err)
} else {
displayProfile(profile);
}
});
}
});
}
Kuriakin Zeng
@kuriakinzeng
Apr 21 2017 04:00
@barkinet ?
barki mustapha
@barkinet
Apr 21 2017 04:01

Firefox 52 also includes a brand new JavaScript feature from ES2017: asynchronous functions and their companion, the await operator. Async functions build on top of ES2015 Promises, allowing authors to write asynchronous code in a similar way to how they would write their synchronous equivalents.

Take the following example, which takes the result of one asynchronous request, and uses part of it as the argument to a second asynchronous function. Here’s how it would look with a traditional callback approach:

Victoria Zambrano
@vzambrano98
Apr 21 2017 04:01
@HeebieGeeBee Oh shucks. thanks..lol! I'm gonna make this thing work somehow...some way lol
CamperBot
@camperbot
Apr 21 2017 04:01
vzambrano98 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1403 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Sergii
@Doomkrat
Apr 21 2017 04:01
function isLess(a, b) {
  // Fix this code

    return a===b;
}

// Change these values to test
isLess(10, 15);
Fix the function isLess to remove the if/else statements.
what I miss?
CatherineKa
@CatherineKa
Apr 21 2017 04:02
Thanks both of you @kuriakinzeng @Lumexralph ,but it still didnt work, maybe the code is wrong
CamperBot
@camperbot
Apr 21 2017 04:02
catherineka sends brownie points to @kuriakinzeng and @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 377 | @kuriakinzeng |http://www.freecodecamp.com/kuriakinzeng
:star2: 1540 | @lumexralph |http://www.freecodecamp.com/lumexralph