These are chat archives for FreeCodeCamp/HelpJavaScript

11th
May 2016
Aryan
@aryandua
May 11 2016 00:04
hey guys how do use regex to remove all non word charecters in a string??
Rachel Melville
@rjmelville
May 11 2016 00:04
Looking for help with 'Profile Lookup'...
Aryan
@aryandua
May 11 2016 00:05
be more specific
Norvin Burrus
@ndburrus
May 11 2016 00:05
@rachel can you post what you've got so far?
Aryan
@aryandua
May 11 2016 00:06
@ndburrus how do you remove all non word charecters in a string?
Dan Couper
@DanCouper
May 11 2016 00:07
@aryandua /[^a-z]/gi will select all characters that aren't a-z (flags: g is globally, i is case insensitive)
Norvin Burrus
@ndburrus
May 11 2016 00:07
@aryandua i'd have to work it out with regex - what do you mean by non word? is this one of the challenges?
Aryan
@aryandua
May 11 2016 00:08
non alhanumerical
*non alphanumerical
Dan Couper
@DanCouper
May 11 2016 00:08
@aryandua /\W/g
Aryan
@aryandua
May 11 2016 00:09
so @DanCouper what'll be the exact syntax
with str as the string
Dan Couper
@DanCouper
May 11 2016 00:09
str.replace(/\W/g, '')
Luke
@lhovee
May 11 2016 00:10
function rot13(str) { // LBH QVQ VG!
 var UTF16 = (""); 
 for (var i=0; i < str.length; i++) {UTF16 += str.charCodeAt(i);}


 var goingBack = ("");
  for (var e=0; e < UTF16.length; e+=13) {goingBack += UTF16.fromCharCode(e);}

  return goingBack;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
I can't figure out why the UTF16.fromCharCode isn't being recognized as a function ... help please?
Aryan
@aryandua
May 11 2016 00:10
it works!!!
youa re a genuis :)
Tim
@codemymind
May 11 2016 00:10
thank you for the help today @bitgrower appreciate you as always
CamperBot
@camperbot
May 11 2016 00:10
codemymind sends brownie points to @bitgrower :sparkles: :thumbsup: :sparkles:
:star2: 1039 | @bitgrower |http://www.freecodecamp.com/bitgrower
Aryan
@aryandua
May 11 2016 00:11
thx @DanCouper @ndburrus
CamperBot
@camperbot
May 11 2016 00:11
aryandua sends brownie points to @dancouper and @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 75 | @dancouper |http://www.freecodecamp.com/dancouper
:cookie: 343 | @ndburrus |http://www.freecodecamp.com/ndburrus
Rachel Melville
@rjmelville
May 11 2016 00:11
@ndburrus Trying to but when I try to post my markup into the chat it won't send the message
Dan Couper
@DanCouper
May 11 2016 00:11
@aryandua I’ve used this for years, it's very helpful: http://regexr.com/
Aryan
@aryandua
May 11 2016 00:11
try ctrl + enter
nice site
wait
Luke
@lschoen
May 11 2016 00:12
Hi all, when an assignment asks you to delete a property in a JSON object, does that mean setting it to null or undefined? (assignment 229). The error says the property "should not be set", but I've tried the above, setting it to a blank string, and deleting the property altogether, but none of it works.
Aryan
@aryandua
May 11 2016 00:12
@lschoen it should be-
prop="";
Greg D
@mosaic-greg
May 11 2016 00:12
@lhovee you don't need to use UTF16 i think charCodeAt and fromCharCode are what you need here
Norvin Burrus
@ndburrus
May 11 2016 00:13
@rjmelville also, you can try the chat & compose buttons if that is easier for you
Aryan
@aryandua
May 11 2016 00:13

function palindrome(str) {
str=str.replace(/\W/g, '');
str=str.toLowerCase();
  var newstr=str.split('').reverse().join('');
  if(newstr===str) {
    return true;
  }  
    else {
  return false;
  }
}

palindrome("never odd or even");
Thats my code
but it return false when tested with
Rachel Melville
@rjmelville
May 11 2016 00:13
This message was deleted
Luke
@lschoen
May 11 2016 00:13
@aryandua tried that- doesn't work.
Aryan
@aryandua
May 11 2016 00:14
This message was deleted
Luke
@lhovee
May 11 2016 00:14
@mosaic-greg I was using UFT16 as a variable name. Should I get rid of that?
Aryan
@aryandua
May 11 2016 00:14
it doesnt?
what is the name of the challenge
??
@lschoen
Luke
@lschoen
May 11 2016 00:14
@aryandua Record Challenge
my code:
if (value === ""){
collection[id][prop] = "";
}
Aryan
@aryandua
May 11 2016 00:14
send the url
Greg D
@mosaic-greg
May 11 2016 00:14
@lhovee oh ok. Caps for a variable name is generally bad, it should start lowercase
Norvin Burrus
@ndburrus
May 11 2016 00:15
@lhovee i think the var name (UTF16) should be changed...
Aryan
@aryandua
May 11 2016 00:15
@lschoen post the url
Luke
@lschoen
May 11 2016 00:16
@aryandua sorry, Record Collection : https://www.freecodecamp.com/challenges/record-collection
Luke
@lhovee
May 11 2016 00:16
@ndburrus I changed it to something generic and that didn't fix it. The function 'str.fromCharCode' is still producing an error saying that isn't a function
Aryan
@aryandua
May 11 2016 00:17
then you have to delete the prop
@lschoen
Rachel Melville
@rjmelville
May 11 2016 00:17
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
  if (contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop) === true) {
     return contacts[i][prop];
   }
   else if (contacts[i].firstName !== firstName) {
    return "No such contact";
   }
  else {
    return "No such property";
  }
}
Aryan
@aryandua
May 11 2016 00:17
else if(value==="") {
  delete collection[id][prop];
  }
you delete it like that
maybe you tried-
Norvin Burrus
@ndburrus
May 11 2016 00:17
@lschoen this may be useful:
JavaScript Identifiers
All JavaScript variables must be identified with unique names.

These unique names are called identifiers.

Identifiers can be short names (like x and y), or more descriptive names (age, sum, totalVolume).

The general rules for constructing names for variables (unique identifiers) are:

Names can contain letters, digits, underscores, and dollar signs.
Names must begin with a letter
Names can also begin with $ and _ (but we will not use it in this tutorial)
Names are case sensitive (y and Y are different variables)
Reserved words (like JavaScript keywords) cannot be used as names
Rachel Melville
@rjmelville
May 11 2016 00:17
@ndburrus Finally figured it out. Needed to use cmd + enter
Dan Couper
@DanCouper
May 11 2016 00:17
@aryandua what did it fail on?
Aryan
@aryandua
May 11 2016 00:18
delete prop;
Luke
@lschoen
May 11 2016 00:18
ah... legend! Thanks @aryandua !
CamperBot
@camperbot
May 11 2016 00:18
lschoen sends brownie points to @aryandua :sparkles: :thumbsup: :sparkles:
:cookie: 255 | @aryandua |http://www.freecodecamp.com/aryandua
Aryan
@aryandua
May 11 2016 00:18
@DanCouper 0_0 (: /-\ :) 0-0
where the :) is a colon + )
np @DanCouper
Dan Couper
@DanCouper
May 11 2016 00:19
Oh, I thought it was just a wierd emoticon you were typing the first time :smile:
Aryan
@aryandua
May 11 2016 00:19
nono
Luke
@lhovee
May 11 2016 00:19
@mosaic-greg in the challenge directions it said not to mess with letter case or with anything that isn't a letter/number
Aryan
@aryandua
May 11 2016 00:19
*no no
Dan Couper
@DanCouper
May 11 2016 00:22
@aryandua ah, just reading the description again: try using str.replace(/[^a-z0-9]/g, ‘’) instead
Aryan
@aryandua
May 11 2016 00:22
I did something else
kind of cheated :smile:

function palindrome(str) {
str=str.replace(/\W/g, '');
  str=str.replace('_', '');
str=str.toLowerCase();
  var newstr=str.split('').reverse().join('');
  if(newstr===str) {
    return true;
  }  
    else {
  return false;
  }
}

palindrome("0_0 (: /-\ :) 0-0");
Norvin Burrus
@ndburrus
May 11 2016 00:23
@lhovee
String.fromCharCode Function (JavaScript)


Returns a string from a number of Unicode character values.
Syntax
String.fromCharCode([code1[, code2[, ...[, codeN]]]]) 
Parameters
String
Required. The String object.
code1, . . . , codeN
Optional. A series of Unicode character values to convert to a string. If no arguments are supplied, the result is the empty string.
Dan Couper
@DanCouper
May 11 2016 00:24
@aryandua /\W/ selects any non-alphanumeric characters apart from underscores, if you use the other version, that selects anything that’s not a-z or 0-9, which is correct for the challenge
Aryan
@aryandua
May 11 2016 00:24
Yeah
Dan Couper
@DanCouper
May 11 2016 00:24
The cheat works, but you shouldn’t need to do that
Aryan
@aryandua
May 11 2016 00:24
yes
Dan Couper
@DanCouper
May 11 2016 00:25
You don’t need to return true or false either
Aryan
@aryandua
May 11 2016 00:25
why not?
Dan Couper
@DanCouper
May 11 2016 00:25
function palindrome(str) {
  str = str.toLowerCase().replace(/[^a-z0-9]/g, '')
  newstr = str.split('').reverse().join('')
  return newstr === str
}
Aryan
@aryandua
May 11 2016 00:26
ok yeh better idea
Dan Couper
@DanCouper
May 11 2016 00:26
newstr === str returns true or false
Aryan
@aryandua
May 11 2016 00:26
optimisitations
Norvin Burrus
@ndburrus
May 11 2016 00:26
@lhovee i think the issue has to do with the use of UTF16 as a variable (not a string or function)
Rachel Melville
@rjmelville
May 11 2016 00:27
Ok, going to try this again for 'Profile Lookup'. Here's what I have (without the JSON setup included)
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
  if (contacts[i].firstName == firstName && contacts[i].hasOwnProperty(prop) === true) {
     return contacts[i][prop];
   }
   else if (contacts[i].firstName !== firstName) {
    return "No such contact";
   }
  else {
    return "No such property";
  }
}
if i remove the 'else if' and 'else' the if part of the statement works correctly, however, it doesn't satisfy the other two tests
Dan Couper
@DanCouper
May 11 2016 00:28
@ndburrus String.fromCharacterCode() is a static method
Rachel Melville
@rjmelville
May 11 2016 00:28
with what i have now, it returns "no such contact" even when firstName does match a firstName
Dan Couper
@DanCouper
May 11 2016 00:28
@ndburrus It’s literally String.fromCharacterCode(// code here)
Norvin Burrus
@ndburrus
May 11 2016 00:29
@rjmelville it's all in the logic.... might you consider a nested if - very clean...
Luke
@lhovee
May 11 2016 00:29
@ndburrus here is my updated code. I changed the variable name and that didn't work :(
function rot13(str) { // LBH QVQ// 

  var firstStr = ("");
  for (var i=0; i < str.length; i++) {firstStr += str.charCodeAt(i);}

  var secondStr = ("");
  for (var e=0; e < firstStr.length; e += 13) {secondStr += firstStr.fromCharCode(e);}

  return secondStr;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Dan Couper
@DanCouper
May 11 2016 00:30
@lhovee String.fromCharacterCode() is a static method, String at the start is not an invitation to replace it with a variable or a literal string
Rachel Melville
@rjmelville
May 11 2016 00:30
@ndburrus I did try a nested for loop and then it didn't return anything. maybe i put it in the wrong place?
Norvin Burrus
@ndburrus
May 11 2016 00:30
@lhovee which challenge is this?
Dan Couper
@DanCouper
May 11 2016 00:30
This message was deleted
Luke
@lhovee
May 11 2016 00:31
@DanCouper hey thanks! that helps
CamperBot
@camperbot
May 11 2016 00:31
lhovee sends brownie points to @dancouper :sparkles: :thumbsup: :sparkles:
:cookie: 76 | @dancouper |http://www.freecodecamp.com/dancouper
Luke
@lhovee
May 11 2016 00:31
@ndburrus the Caesars Cipher challenge
Norvin Burrus
@ndburrus
May 11 2016 00:31
@lhovee ok, im not there yet...
Dan Couper
@DanCouper
May 11 2016 00:31
@lhovee just put the code, or a series of codes into the function, it’ll give you a string back
Norvin Burrus
@ndburrus
May 11 2016 00:32
@rjmelville i imagine that was the case...
@rjmelville
  if (firstName === contacts[i].firstName) {

      if (contacts[i][prop]) {
Johnathon Sykes
@seesykescode
May 11 2016 00:33
I think im pretty close to a solution for Search and Replace....but I cant figure out how to pickup on whether the before word is upper or lowercase . I guess I need a crash course in RegEx
My code

function myReplace(str, before, after) {
  str = str.split(" ");


  for (var i=0; i<=str.length; i++){
    if (str[i] === before) {
      var reg = new RegExp (after, 'g');
      var test = str[i].replace(before,reg);
      console.log(test);
    }
  }
  return str;
}

myReplace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
Luke
@lhovee
May 11 2016 00:33
@DanCouper I'm not sure I understand your last suggestion?
Dan Couper
@DanCouper
May 11 2016 00:34
@lhovee String.fromCharCode(65, 66, 67) will give you ABC
Johnathon Sykes
@seesykescode
May 11 2016 00:34
if I use that reg expression I end up with "/"after word/g
Luke
@lhovee
May 11 2016 00:35
@DanCouper I get that. so if my acii or whatchyamicallit is 86888990 for example is that a problem?
Norvin Burrus
@ndburrus
May 11 2016 00:36
@rjmelville how are you doing?
Rachel Melville
@rjmelville
May 11 2016 00:37
@ndburrus I think I follow you. Trying it again as you suggested. Thanks!
CamperBot
@camperbot
May 11 2016 00:37
rjmelville sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:cookie: 344 | @ndburrus |http://www.freecodecamp.com/ndburrus
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:37
var board = "";
var size = 8

for (var x = 0; x < size; x++) {
  for (var y = 0; y < size; y++) {
    if ((x + y) % 2 == 0) {
      board += "";
    } else {
      board += "#";
    }
  }
}

console.log(board);
may i ask whats wrong with my chess board lol my brain sucks
Norvin Burrus
@ndburrus
May 11 2016 00:38
@rjmelville the branches from both are very simple (hint) :)
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:40
halp ; _ ;
Ozan Araz
@haraldur12
May 11 2016 00:40
var size = 8;
nostrahistoria
@nostrahistoria
May 11 2016 00:40
Hi. Can anyone help me out with this one? Call the processArg function with an argument of 7 and assign its return value to the variable processed.
Ozan Araz
@haraldur12
May 11 2016 00:40
2 === 0
Dan Couper
@DanCouper
May 11 2016 00:40
@lhovee so if that one thing is amended, you get:
function rot13(str) {
 var UTF16 = (""); 
 for (var i=0; i < str.length; i++) {
   UTF16 += str.charCodeAt(i);
 }


 var goingBack = ("");
  for (var e=0; e < UTF16.length; e+=13) {
    goingBack += String.fromCharCode(e);
  }

 return goingBack;
}
This won’t work
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:40
what lol
it’s more than just the ===
oh i forgot a \n
Ozan Araz
@haraldur12
May 11 2016 00:41
can you be specific about what you are doing with the board
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:42
trying to make a chess board

# # #

# # #

Ozan Araz
@haraldur12
May 11 2016 00:42
arent there more than 16 tiles
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:42
eloquent js exercise 4
Dan Couper
@DanCouper
May 11 2016 00:43
@lhovee the character codes for A-Z are 65-90
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:43

Chess board

Write a program that creates a string that represents an 8×8 grid, using newline characters to separate lines. At each position of the grid there is either a space or a “#” character. The characters should form a chess board.

Ozan Araz
@haraldur12
May 11 2016 00:44
8x8 would be 64 tiles
yours has only 16 atm
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:44
Screen Shot 2016-05-10 at 5.44.18 PM.png
Eric Murta
@murtinha
May 11 2016 00:47
Guys I'm doing the Pomodoro Clock challange and I have a question about my code
are all those ifs normal?
its not responsive so look at it full page
https://codepen.io/murtinha/full/mPoOaY/
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:48
oh lol ok, so using == worked cause they are the same type of data
but my board += “” is empty, needs a space inside the “ "
and needed a board += “\n” outside the first loop
inside*
Ozan Araz
@haraldur12
May 11 2016 00:49
@murtinha eric isnt it => normally like this
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:50
wow computers are crazy
Ozan Araz
@haraldur12
May 11 2016 00:50
i thought you were going to format it on html @JonathanSchwob
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:50
@murtinha may i ask where you found that pomodoro challenge, i’d like to complete it
Ozan Araz
@haraldur12
May 11 2016 00:51
@JonathanSchwob it is one of the advanced challenges
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:51
oh no @haraldur12 i have no idea how to do html, just trying to get ready to bootcamp admissions
gotcha ty
Aryan
@aryandua
May 11 2016 00:52
how do you get to know the length of an array??
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:53
nameofarray.length i think
Ozan Araz
@haraldur12
May 11 2016 00:53
array.length;
nostrahistoria
@nostrahistoria
May 11 2016 00:53
Hi, everyone. Can anyone help on this task. It is #184: Call the processArg function with an argument of 7 and assign its return value to the variable processed.
Aryan
@aryandua
May 11 2016 00:53
it says
Cant read property of length of undefined
Ozan Araz
@haraldur12
May 11 2016 00:53
can you post your code
Justin Woodward
@jwoo92
May 11 2016 00:54
@aryandua are you using .length?
Ozan Araz
@haraldur12
May 11 2016 00:54
@nostrahistoria name of the challange '
Aryan
@aryandua
May 11 2016 00:54
yes @jwoo92
nostrahistoria
@nostrahistoria
May 11 2016 00:54
Assignment with a Returned Value
Justin Woodward
@jwoo92
May 11 2016 00:55
@aryandua posting your code and the current challenge will help us help you.
Aryan
@aryandua
May 11 2016 00:55

function findLongestWord(str) {
  var arr=[];
  var max;
  arr=str.split(' ');
  for(i=0;;i++) {
     var ret= determineLongest(arr[i], arr[i+1]);
     if(ret>max) {
       ret=max;
     }  
   }
  return  max.length;

function determineLongest(a, b) {
    if(a.length>b.length) {
      return a.length;
    }
  return b.length;
  }


}

findLongestWord("The quick brown fox jumped over the lazy dog");
nostrahistoria
@nostrahistoria
May 11 2016 00:55
It is in JavaScript
Justin Woodward
@jwoo92
May 11 2016 00:55
@aryandua you sure did move quick to be on the algorithms already, nice job.
Aryan
@aryandua
May 11 2016 00:56
thx
I work 2-6 hrs every day
Justin Woodward
@jwoo92
May 11 2016 00:56
@aryandua my answer to that challenge was 3 lines inside of the function.
Ozan Araz
@haraldur12
May 11 2016 00:56
@nostrahistoria where are you stuck ?
nostrahistoria
@nostrahistoria
May 11 2016 00:57
I do not know what to write at all.
Call the processArg function with an argument of 7 and assign its return value to the variable processed.
Aryan
@aryandua
May 11 2016 00:57
really?
how?
Justin Woodward
@jwoo92
May 11 2016 00:57
@aryandua for a hint check out .sort.
Aryan
@aryandua
May 11 2016 00:57
oh!!
Justin Woodward
@jwoo92
May 11 2016 00:57
@aryandua :)
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:57
do you ever have to create a new function using var?
Ozan Araz
@haraldur12
May 11 2016 00:58
@aryandua max is undefined because you are not attributing anything to it
@nostrahistoria so you have the fuunction right ? do you see it ? processArg
Jonathan Schwob
@JonathanSchwob
May 11 2016 00:58
or can one just type nameoffunction function(parameter) {}
Justin Woodward
@jwoo92
May 11 2016 00:58
@aryandua once you get it, ill show you what worked for me.
nostrahistoria
@nostrahistoria
May 11 2016 00:58
Yes, I see it. And?
Ozan Araz
@haraldur12
May 11 2016 00:58
so it gets your number and adds (number)
Aryan
@aryandua
May 11 2016 00:58
I think i got it
shanethughes
@shanethughes
May 11 2016 00:58
Has anyone here completed "No repeats please" in the Front End section?
Ozan Araz
@haraldur12
May 11 2016 00:58
process = processedArg(7);
Rachel Melville
@rjmelville
May 11 2016 00:58
@ndburrus I was able to get 4/5 tests to work this time, but there's still an issue with the first 'if' where it's returning "No such contact" for tests where firstName does exist. here's my update
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
  if (firstName == contacts[i].firstName) {
    if (contacts[i].hasOwnProperty(prop) === true) {
        return contacts[i][prop];
    }
    else {
        return "No such property";
    }  
  }
  else {
    return "No such contact";
  }
}
Aryan
@aryandua
May 11 2016 00:59

function findLongestWord(str) {
  var arr = str.split(' ');
  arr.sort(function(a, b){return a.length - b.length;});
  return arr.pop().length;
}

findLongestWord("The quick brown fox jumped over the lazy dog");
thats it
Justin Woodward
@jwoo92
May 11 2016 00:59
@aryandua and mine:

function findLongestWord(str) {
  var arr = str.split(' ');
  arr.sort(function(a, b){return a.length - b.length;});
  return arr.pop().length;
}

findLongestWord("The quick brown fox jumped over the lazy dog");
nostrahistoria
@nostrahistoria
May 11 2016 00:59
It does not work @haraldur12
Aryan
@aryandua
May 11 2016 01:00
exact same!!
:) @jwoo92
Ozan Araz
@haraldur12
May 11 2016 01:00
// Example
var changed = 0;

function change(num) {
  return (num + 5) / 3;
}

changed = change(10);

// Setup
var processed = 2;

function processArg(num) {
  return (num + 3) / 5;
}

// Only change code below this line

processed = processArg(7);
Aryan
@aryandua
May 11 2016 01:00
thx @jwoo92
CamperBot
@camperbot
May 11 2016 01:00
aryandua sends brownie points to @jwoo92 :sparkles: :thumbsup: :sparkles:
:cookie: 299 | @jwoo92 |http://www.freecodecamp.com/jwoo92
shanethughes
@shanethughes
May 11 2016 01:00
Has anyone here completed "No repeats please" in the Front End section?
nostrahistoria
@nostrahistoria
May 11 2016 01:01
It does not work
Aryan
@aryandua
May 11 2016 01:01
d#
This message was deleted
Justin Woodward
@jwoo92
May 11 2016 01:01
@aryandua no problem. at your rate, youll pass me up soon. im not as fortunate as you to have that much time to spend on FCC.
nice job
Aryan
@aryandua
May 11 2016 01:01
:)
Ozan Araz
@haraldur12
May 11 2016 01:01
@nostrahistoria how come it doesn't work that was my code ahah just tested it
can you post your code ?
Aryan
@aryandua
May 11 2016 01:02
Since you are an adult you probably have other stuff to do
nostrahistoria
@nostrahistoria
May 11 2016 01:02

// Example
var changed = 0;

function change(num) {
return (num + 5) / 3;
}

changed = change(10);

// Setup
var processed = 2;

function processArg(num) {
return (num + 3) / 5;
}

// Only change code below this line

processed = processedArg(7);

Aryan
@aryandua
May 11 2016 01:02
I am 12
I got all day :)
Justin Woodward
@jwoo92
May 11 2016 01:02
@shanethughes i know a guy on here name coy that may be able to help you, but i havent seen him post anything in here since i have been on.
Aryan
@aryandua
May 11 2016 01:02
@coysanders
Dan Couper
@DanCouper
May 11 2016 01:03
@lhovee e+=13 means you’re increasing e by 13 each iteration of the loop. So in the example, it looks at the first character (the one at position 0), the 13th character, then there are no more characters. You need to get each character code, and then add 13 to the value.
Note that this still will fail (what happens when the character code + 13 is greater than 90?), but will get you a lot closer
Ozan Araz
@haraldur12
May 11 2016 01:03
replace it processed = processArg(7);
it should work now
do you get the idea though ?
nostrahistoria
@nostrahistoria
May 11 2016 01:03
Awesome! Thank you so much! Have a nice day!
Ozan Araz
@haraldur12
May 11 2016 01:04
np
it didnt work because you didnt have such function called processedArg
typos suck :D
nostrahistoria
@nostrahistoria
May 11 2016 01:04
Thanks so much. I was thinking the same thing, but I did not change the 2 in the "setup"
Aryan
@aryandua
May 11 2016 01:05
@coymeetsworld can help almost everyone!!
Ozan Araz
@haraldur12
May 11 2016 01:06
@aryandua I am sure you would love codewars.com and projecteuler.net
shanethughes
@shanethughes
May 11 2016 01:06
ok thx justin
Ozan Araz
@haraldur12
May 11 2016 01:06
I wish my little cousins were interested in programming as well gosh
Aryan
@aryandua
May 11 2016 01:08
thx @haraldur12
CamperBot
@camperbot
May 11 2016 01:08
aryandua sends brownie points to @haraldur12 :sparkles: :thumbsup: :sparkles:
:cookie: 273 | @haraldur12 |http://www.freecodecamp.com/haraldur12
Aryan
@aryandua
May 11 2016 01:08
I will now spend 1/3 of my time on fcc
anthonyjl92
@anthonyjl92
May 11 2016 01:08

Hey guys, I have a question about concatenating strings that escape special characters

For example:

var str='<!DOCTYPE html><html><head><style>*{margin:0;padding:0;}</style></head><body>'+
"<script type=\"text/javascript\" src=\"//food.jpg\"><\/script>"+
'</body></html>'

In this example I'm escaping " by place a \ before it. When all 3 strings become concatenated, will that \ be included in the result?
what will be stored in str after the strings concatenate?

Aryan
@aryandua
May 11 2016 01:09
1/3 of projecteuler.net
and 1/3 on codewars!
Ozan Araz
@haraldur12
May 11 2016 01:09
@aryandua don't get frustrated if you cannot work it out though I am a linguist who is studying math and i have already filled the floor with a4 sheets :D
Joe
@joemanriquez
May 11 2016 01:11

Hey guys. I'm still relatively new to github and free code camp. Just started javascript tutorials in free code camp. Was wondering if someone could point me in the right direction on a tutorial. I need to convert celsius to fahrenheit using +=, =, and /=. The equation is C (9/5) + 32. function convertToF(celsius) {
// Only change code below this line

// Only change code above this line
return fahrenheit;

}

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

rphares
@rphares
May 11 2016 01:11
what you have already is kinda close, @joemanriquez -
Rachel Melville
@rjmelville
May 11 2016 01:11
Can anyone help with 'Profile Lookup'?
Aryan
@aryandua
May 11 2016 01:11
wow! @haraldur12
You can do soo much!
FCC
Math
rphares
@rphares
May 11 2016 01:12
you just need to turn that equation, C (9/5) + 32. into code, and store it in the var they give you.... @joemanriquez
Aryan
@aryandua
May 11 2016 01:12
and foriegn langs!
Ozan Araz
@haraldur12
May 11 2016 01:12
@rjmelville where are you stuck rachel ?
Aryan
@aryandua
May 11 2016 01:12
@joemanriquez F=(C*9/5)+32;
F=(C*9/5)+32;
Ozan Araz
@haraldur12
May 11 2016 01:12
@aryandua I have enough time to study as much as you do Aryan ahah
Aryan
@aryandua
May 11 2016 01:13
```
F=(C*9/5)+32;
```
Rachel Melville
@rjmelville
May 11 2016 01:13
@haraldur12 Here's what I have...
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
  if (firstName == contacts[i].firstName) {
    if (contacts[i].hasOwnProperty(prop) === true) {
        return contacts[i][prop];
    }
    else {
        return "No such property";
    }
  }
  else {
    return "No such contact";
  }
}
Aryan
@aryandua
May 11 2016 01:13
@haraldur12 i have to go to school too so you probaly have more time
Joe
@joemanriquez
May 11 2016 01:13
@rphares @aryandua thank you. let me give it a try. btw. how do you copy your code like that into the chat? Sorry. newbie.
CamperBot
@camperbot
May 11 2016 01:13
joemanriquez sends brownie points to @rphares and @aryandua :sparkles: :thumbsup: :sparkles:
:cookie: 258 | @aryandua |http://www.freecodecamp.com/aryandua
:star2: 4445 | @rphares |http://www.freecodecamp.com/rphares
rphares
@rphares
May 11 2016 01:14
so, first, you need to create your variable, fahrenheit. then use that equation, and include the variable celsius by name~
explain format
CamperBot
@camperbot
May 11 2016 01:14

: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 the code.

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

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

Aryan
@aryandua
May 11 2016 01:14
help format
CamperBot
@camperbot
May 11 2016 01:14

: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 the code.

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

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

rphares
@rphares
May 11 2016 01:14
@joemanriquez :point_up: like that
Rachel Melville
@rjmelville
May 11 2016 01:14
@haraldur12 if i remove the final 'else' it passes 4/5 tests. with the final 'else' it returns "no such contact" in cases where contacts[i].firstName === firstName... which isn't correct
Joe
@joemanriquez
May 11 2016 01:16
@rphares @aryandua thanks! passed the tutorial. once i saw your formatting it made more sense. Thanks for the help!
CamperBot
@camperbot
May 11 2016 01:16
joemanriquez sends brownie points to @rphares and @aryandua :sparkles: :thumbsup: :sparkles:
:warning: joemanriquez already gave rphares points
:warning: joemanriquez already gave aryandua points
Dan Couper
@DanCouper
May 11 2016 01:16
@shanethughes what are you having an issue with wrt no repeats please?
Ozan Araz
@haraldur12
May 11 2016 01:16
@rjmelville sec I think it is because of the if
rphares
@rphares
May 11 2016 01:16
anytime~
Aryan
@aryandua
May 11 2016 01:16
@joemanriquez np
Ozan Araz
@haraldur12
May 11 2016 01:16
if (contacts[x].firstName === firstName) {
        if (contacts[x][prop]) {
this is from my setup
Jessica Dembe
@jmdembe
May 11 2016 01:17
Hi, I have a question about "Stand in Line"
Aryan
@aryandua
May 11 2016 01:17
bye everyone I have to go to math club...
Be back in 2 hrs
:)
Jessica Dembe
@jmdembe
May 11 2016 01:18
i'm not understanding the directions
Ozan Araz
@haraldur12
May 11 2016 01:18
@jmdembe Where are you stuck ?

@rjmelville ```js
function lookUpProfile(firstName, prop){
// Only change code below this line

for (var x = 0; x < contacts.length; x++){
if (contacts[x].firstName === firstName) {
if (contacts[x][prop]) {
return contacts[x][prop];
} else {
return "No such property";
}
}
}
return "No such contact";
```

Jessica Dembe
@jmdembe
May 11 2016 01:19
maybe i'm just not understanding the directions. When it says "add the number to the end of the array, then remove the first element"
perhaps im stuck on how to proceed?
Aryan
@aryandua
May 11 2016 01:19
hint: push and shift
CamperBot
@camperbot
May 11 2016 01:19
Set a bonfire to talk about with bonfire name
Ozan Araz
@haraldur12
May 11 2016 01:20
okay so you have to use unshift
you have to use array.shift and array.unshift if i am not mistaken
Aryan
@aryandua
May 11 2016 01:21
no not unshift()
push and shift
Ozan Araz
@haraldur12
May 11 2016 01:21
oh sorry yeah aryan is right you have to add the value
Aryan
@aryandua
May 11 2016 01:21
unshift removes
// Setup
var myArr = [1,2,3,4,5];

function queue(arr, item) {

  arr.push(item);  
  return arr.shift();
}

// Display Code
console.log("Before: " + JSON.stringify(myArr));
console.log(queue(myArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(myArr));
like that
Rachel Melville
@rjmelville
May 11 2016 01:22
@haraldur12 I just copied what you have (using var i instead of x) and it's doing the same thing.
function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
  if (contacts[i].firstName === firstName) {
    if (contacts[i][prop]){
        return contacts[i][prop];
    }
    else {
        return "No such property";
    }
  }
  else {
    return "No such contact";
  }
}
Aryan
@aryandua
May 11 2016 01:22
@jmdembe did you get through???
Ozan Araz
@haraldur12
May 11 2016 01:22
@rjmelville which one is failing ?
Rachel Melville
@rjmelville
May 11 2016 01:23
@haraldur12 the outer (1st) if
Ozan Araz
@haraldur12
May 11 2016 01:23
the first three
Aryan
@aryandua
May 11 2016 01:23
did you get through??
Justin Woodward
@jwoo92
May 11 2016 01:23
are you able to one line the challenge 'where do i belong'.?
Ozan Araz
@haraldur12
May 11 2016 01:23

function lookUpProfile(firstName, prop){
// Only change code below this line

  for (var x = 0; x < contacts.length; x++){
    if (contacts[x].firstName === firstName) {
        if (contacts[x][prop]) {
            return contacts[x][prop];
        } else {
            return "No such property";
        }
    }
}
return "No such contact";
Rachel Melville
@rjmelville
May 11 2016 01:24
@haraldur12 If I remove the last 'else' then that outer 'if' works
V Arun Kumar
@arunvkumr
May 11 2016 01:24
@haraldur12 Try removing outer else and then returning no such contact outside the for loop.
Aryan
@aryandua
May 11 2016 01:25
abey yaar!
Jessica Dembe
@jmdembe
May 11 2016 01:25
Yes I did ! Thank you @haraldur12 @aryandua
CamperBot
@camperbot
May 11 2016 01:25
jmdembe sends brownie points to @haraldur12 and @aryandua :sparkles: :thumbsup: :sparkles:
:cookie: 274 | @haraldur12 |http://www.freecodecamp.com/haraldur12
:cookie: 260 | @aryandua |http://www.freecodecamp.com/aryandua
Aryan
@aryandua
May 11 2016 01:25
so close!
nice job @jmdembe
Jessica Dembe
@jmdembe
May 11 2016 01:25
I'll go re-visit the previous lessons to get a better handle of this.
Rachel Melville
@rjmelville
May 11 2016 01:25
@arunkumrv @haraldur12 That worked!
Justin Woodward
@jwoo92
May 11 2016 01:25
has anyone completed the algorithm 'where do i belong'?
Aryan
@aryandua
May 11 2016 01:25
good idea @jmdembe
bye
!
Ozan Araz
@haraldur12
May 11 2016 01:25
Have a nice day guys I am going to sleep
Rachel Melville
@rjmelville
May 11 2016 01:26
Thanks @haraldur12
CamperBot
@camperbot
May 11 2016 01:26
rjmelville sends brownie points to @haraldur12 :sparkles: :thumbsup: :sparkles:
:cookie: 275 | @haraldur12 |http://www.freecodecamp.com/haraldur12
Rachel Melville
@rjmelville
May 11 2016 01:26
@arunkumrv Why does the outer 'else' have to be outside of the for loop?
ereinertsen
@ereinertsen
May 11 2016 01:27
I am stuck on Stand in Line. Can anyone help me?
Ozan Araz
@haraldur12
May 11 2016 01:27
Justin I havent done it but i just checked it it seems like you should split and slice the first arrr and then adjoint them to one variable and then sort them
Coy Sanders
@coymeetsworld
May 11 2016 01:27
sure @ereinertsen what do you have?
Ozan Araz
@haraldur12
May 11 2016 01:27
just split it I dont think you have to slice it sorry
ereinertsen
@ereinertsen
May 11 2016 01:28
Screen Shot 2016-05-10 at 6.27.29 PM.png
Coy Sanders
@coymeetsworld
May 11 2016 01:28
so you got the right idea but a couple of things
V Arun Kumar
@arunvkumr
May 11 2016 01:28
@rjmelville when you are inside for loop, you are checking for contacts if it exists or not. the loop exits when no such contact exists that you are looking for(as 2 return statements inside for loop returns for no such propery and contact details.).
ereinertsen
@ereinertsen
May 11 2016 01:28
I know I am messing up those lines and I read the previous tutorials. But I can't figure it out
Coy Sanders
@coymeetsworld
May 11 2016 01:28
don't use testArr, use the array youre passing into the function (i.e. arr)
Kyle B.
@manbearkyle
May 11 2016 01:28
help chunky monkey
CamperBot
@camperbot
May 11 2016 01:28

:point_right: algorithm chunky monkey [wiki]

Explanation

Our goal for this Algorithm is to split arr (first argument) into smaller chunks of arrays with the length provided by size (second argument). There are 4 green checks (objectives) our code needs to pass in order to complete this Algorithm:

  1. (['a', 'b', 'c', 'd'], 2) is expected to be [['a', 'b'], ['c', 'd']]
  2. ([0, 1, 2, 3, 4, 5], 3) is expected to be [[0, 1, 2], [3, 4, 5]]
  3. ([0, 1, 2, 3, 4, 5], 2) is expected to be [[0, 1], [2, 3], [4, 5]]
  4. ([0, 1, 2, 3, 4, 5], 4) is expected to be [[0, 1, 2, 3], [4, 5]]

Click More information under the Algorithm title and read the helpful links if you haven't yet.

:pencil: read more about algorithm chunky monkey on the FCC Wiki

Coy Sanders
@coymeetsworld
May 11 2016 01:29
2nd don't hardcode what you're pushing in, you're pushing in the item parameter
Rachel Melville
@rjmelville
May 11 2016 01:29
@arunkumrv Ah, ok. That makes sense. Thank you for the explanation.
CamperBot
@camperbot
May 11 2016 01:29
rjmelville sends brownie points to @arunkumrv :sparkles: :thumbsup: :sparkles:
:cookie: 539 | @arunkumrv |http://www.freecodecamp.com/arunkumrv
Coy Sanders
@coymeetsworld
May 11 2016 01:29
3rd Array.shift() actually returns the removed item from the array, so return the result of that instead
V Arun Kumar
@arunvkumr
May 11 2016 01:30
@ereinertsen try using the arr varibale that is passed to you by function and and don't push 10 directly to arr you are hardcoding code to insert 10 everytime. you need to insert the item tha is passed to you by function.
ereinertsen
@ereinertsen
May 11 2016 01:31
@coymeetsworld so it should read return arr. shift(); ?
amistein
@amistein
May 11 2016 01:31
find 227
CamperBot
@camperbot
May 11 2016 01:31
find 227
nothing found
Riston Denaux
@ToccataN
May 11 2016 01:31

function titleCase(str) {
var words = str.toLowerCase().split(' ');
var caps =[];

for(var i=0; i<words.length; i++){
var letter=[];
var word = words[i].split('');
for(var j = 0; j <word.length; j++){
var letters;
if (j===0){
letters = word[j].toUpperCase();
letter.push(letters);

  } else {
    letter.push(word[j]);
  }    
}
caps.push(letter);

}
return caps.join(" ");
}
Everything appears to work in this code, minus the commas between the letters, why is join not eliminating these?

Coy Sanders
@coymeetsworld
May 11 2016 01:31
yeah thats the best way @ereinertsen
amistein
@amistein
May 11 2016 01:31
find Generate Random Whole Numbers within a Range
CamperBot
@camperbot
May 11 2016 01:31

find generate random whole numbers within a range

:zero: challenge generate random whole numbers within a range

Coy Sanders
@coymeetsworld
May 11 2016 01:32
it will not only remove the item from the array but also return the value which is what the function is supposed to do
Riston Denaux
@ToccataN
May 11 2016 01:33
for some reason the variable 'letter' produces commas even when I enact join on it specifically
Coy Sanders
@coymeetsworld
May 11 2016 01:33
@coymeetsworld can help almost everyone!!
:thumbsup: :) @aryandua
ereinertsen
@ereinertsen
May 11 2016 01:34
Screen Shot 2016-05-10 at 6.34.14 PM.png
@coymeetsworld I've cleaned it up but now it I am still missing something
Diego Mayer
@Chrono79
May 11 2016 01:35
@ereinertsen you're using shift twice
Coy Sanders
@coymeetsworld
May 11 2016 01:35
thats because you're running it twice yeah
arr.shift() will remove the first element from the array, so your code is removing 2 elements
Diego Mayer
@Chrono79
May 11 2016 01:35
@ereinertsen also forgot the push param
Coy Sanders
@coymeetsworld
May 11 2016 01:36
yeah, need to push something into the array, but not the hardcoded value 10
Justin Woodward
@jwoo92
May 11 2016 01:38
i am on algorithm challenge 'where do i belong'. i am not sure what i am doing wrong, but i feel close.

function getIndexToIns(arr, num) {
  var result = arr.apply(num).sort(function(a,b) {return a-b;}).indexOf(num);
  return result;
}

getIndexToIns([40, 60], 50);
i see my .indexOf may be incorrect after applying to arr.
Diego Mayer
@Chrono79
May 11 2016 01:39
@jwoo92 it says TypeError: arr.apply is not a function
V Arun Kumar
@arunvkumr
May 11 2016 01:39
@ToccataN caps is a 2d array which has subarray of letter and the outer array holds all the subarray of letter of each word. when you are push the array letter array in the caps array try joining it. rest of the code looks good.
Riston Denaux
@ToccataN
May 11 2016 01:40
Thanks man, I actually just got it
ereinertsen
@ereinertsen
May 11 2016 01:40
@coymeetsworld I think where I am confused is I don't know what to push. I don't understand what the lesson is looking for and the push lesson used strings and hard coded values
Coy Sanders
@coymeetsworld
May 11 2016 01:40
@ereinertsen youre pushing the item (i.e. 2nd variable) you're passing into the function
Riston Denaux
@ToccataN
May 11 2016 01:40
I created an empty string variable to hold letter.join(''); <---derp
Coy Sanders
@coymeetsworld
May 11 2016 01:41
so if you ran nextInLine([1,2,3,4,5], 6)
what would happen is you put 6 at the end of the array: [1,2,3,4,5,6]
then remove and return the first item, 1. So the function would return 1, and array would be [2,3,4,5,6]
Diego Mayer
@Chrono79
May 11 2016 01:46
@jwoo92 I have a one line solution to Where do I belong, you're very close
Justin Woodward
@jwoo92
May 11 2016 01:47
@Chrono79 thankyou, i believed i could do it with one line. ill see if i can solve it with that confirmed.
CamperBot
@camperbot
May 11 2016 01:47
jwoo92 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:cookie: 698 | @chrono79 |http://www.freecodecamp.com/chrono79
Justin Woodward
@jwoo92
May 11 2016 01:49
@Chrono79 i solved it, but ill see if i can one line it
Coy Sanders
@coymeetsworld
May 11 2016 01:49
don't worry about it being all on one line @jwoo92, get the logic down that's more important
:thumbsup:
Remember the Einstein quote, "Make things as simple as possible but not any simpler"
Justin Woodward
@jwoo92
May 11 2016 01:49
@coymeetsworld i solved it, ill see if i can line it up a little more clean.
this is what i used to have it work for me

function getIndexToIns(arr, num) {
  arr.push(num);
  arr.sort(function(a,b) {return a-b;});
  return arr.indexOf(num);
}

getIndexToIns([40, 60], 50);
Diego Mayer
@Chrono79
May 11 2016 01:52
@jwoo92 I can give a hint if you want
Justin Woodward
@jwoo92
May 11 2016 01:52
how would i break that down to one line? as soon as i put .push() and .sort() together i would get an error

function getIndexToIns(arr, num) {
  arr.push(num);
  return arr.sort(function(a,b) {return a-b;}).indexOf(num);  
}

getIndexToIns([40, 60], 50);
@Chrono79 ill take a hint, i am curious.
@coymeetsworld thanks, that is a good quote.
CamperBot
@camperbot
May 11 2016 01:55
jwoo92 sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:cookie: 797 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Diego Mayer
@Chrono79
May 11 2016 01:55
@jwoo92 ok, you can't chain sort and push because push doesn't return an array, you have to find a way to add num to arr and the result must be an array so you can chain sort with it
V Arun Kumar
@arunvkumr
May 11 2016 01:56
@jwoo92 yea push doesn't go with sort... try with concat function. that way you can make your code one line.
Justin Woodward
@jwoo92
May 11 2016 01:58
@Chrono79 @arunkumrv thanks guys, i completely forgot about .concat().
CamperBot
@camperbot
May 11 2016 01:58
jwoo92 sends brownie points to @chrono79 and @arunkumrv :sparkles: :thumbsup: :sparkles:
:warning: jwoo92 already gave chrono79 points
:cookie: 540 | @arunkumrv |http://www.freecodecamp.com/arunkumrv
Justin Woodward
@jwoo92
May 11 2016 01:58
i may have only used it once before.
Islam Ibakaev
@dagman
May 11 2016 01:58
what about my recipe box guys?
Diego Mayer
@Chrono79
May 11 2016 01:59
if you're going for one-liners you'll have to use it more often it seems
Thomas Nguyen
@thomasnguyen
May 11 2016 01:59
hey all i have a question on the factorization challenge
I'm using recursion and for some reason i get a call stack size exceded

function factorialize(num) {
if ((num === 0) || (num === 1)){
return 1;
}
else{
return factorialize(num) * factorialize(num-1);
}

}
factorialize(5);

Diego Mayer
@Chrono79
May 11 2016 02:00
@toshiru let's see your code
Thomas Nguyen
@thomasnguyen
May 11 2016 02:00
oh how do i put in the code box
Diego Mayer
@Chrono79
May 11 2016 02:00
help format
CamperBot
@camperbot
May 11 2016 02:00

: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 the code.

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

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

Thomas Nguyen
@thomasnguyen
May 11 2016 02:00
function factorialize(num) {
  if ((num === 0) || (num === 1)){
    return 1;
  }
  else{
    return factorialize(num) * factorialize(num-1);
  }


}

factorialize(5);
Islam Ibakaev
@dagman
May 11 2016 02:01
@toshiru num <= 0
VultureBetrayer
@VultureBetrayer
May 11 2016 02:01
just type ``` hit SHIFT+ENTER then paste your code then CTRL+ENTER to post
Diego Mayer
@Chrono79
May 11 2016 02:01
edit your post, the ... at the top right corner of it
Thomas Nguyen
@thomasnguyen
May 11 2016 02:02
ok thanks
Diego Mayer
@Chrono79
May 11 2016 02:02
@toshiru :+1:
Thomas Nguyen
@thomasnguyen
May 11 2016 02:02
and @dagman ill try that out
Islam Ibakaev
@dagman
May 11 2016 02:03
@toshiru return factorialize(num) * factorialize(num-1);???
Diego Mayer
@Chrono79
May 11 2016 02:03
@toshiru I think you're calling twice you need there
Islam Ibakaev
@dagman
May 11 2016 02:03
@toshiru change this line
Thomas Nguyen
@thomasnguyen
May 11 2016 02:03
oh right
so just num * facortilize(num-1) ???
Islam Ibakaev
@dagman
May 11 2016 02:03
@toshiru yep
Thomas Nguyen
@thomasnguyen
May 11 2016 02:04
yep, got it to work thanks @dagman
CamperBot
@camperbot
May 11 2016 02:04
toshiru sends brownie points to @dagman :sparkles: :thumbsup: :sparkles:
:cookie: 524 | @dagman |http://www.freecodecamp.com/dagman
Thomas Nguyen
@thomasnguyen
May 11 2016 02:04
@Chrono79 thanks for the formatting help too
CamperBot
@camperbot
May 11 2016 02:04
toshiru sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:cookie: 699 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
May 11 2016 02:04
no problem
Justin Woodward
@jwoo92
May 11 2016 02:23
the challenge 'Caesars Cipher' seems a little tricky. anyone have any pointers?
this is what i have so far:

function rot13(str) { // LBH QVQ VG!
var result =[];
for(var i = 0; i < str.length; i++){
  result = result.push(str.charCodeAt[0][i]);






}  

}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Edward Hernández
@syntactician
May 11 2016 02:25
@jwoo92: fun tip. the String.replace() method can take a function as its second argument
Blake Harris
@bharris62
May 11 2016 02:25
what is this error?
https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js Failed to load resource: the server responded with a status of 404 ()
from codepen on the developer console
Justin Woodward
@jwoo92
May 11 2016 02:26
@syntactician ohhh good idea, thanks!
CamperBot
@camperbot
May 11 2016 02:26
jwoo92 sends brownie points to @syntactician :sparkles: :thumbsup: :sparkles:
:cookie: 288 | @syntactician |http://www.freecodecamp.com/syntactician
Diego Mayer
@Chrono79
May 11 2016 02:28
@bharris62 I've tried opening in the browser and it works
Ken Haduch
@khaduch
May 11 2016 02:32
@bharris62 - looks like it could not load your jquery.min.js that you are requesting? Maybe a glitch? I was able to just load it directly in the browser.
ereinertsen
@ereinertsen
May 11 2016 02:34
@Chrono79 is this closer?
function nextInLine(arr, item) {
// Your code here
arr.push(item);
arr.shift();
return arr; // Change this line
}
Diego Mayer
@Chrono79
May 11 2016 02:34
@ereinertsen better, but you could return arr.shift(); directly
you have to return the element removed form the array (arr)
Johnathon Sykes
@seesykescode
May 11 2016 02:35
help search and replace
CamperBot
@camperbot
May 11 2016 02:35

:point_right: algorithm search and replace [wiki]

Problem Explanation:

  • You will create a program that takes a sentence, then search for a word in it and replaces it for a new one while preserving the uppercase if there is one.
:pencil: read more about algorithm search and replace on the FCC Wiki
Chris Lacaille
@ChrisL108
May 11 2016 02:37
Are there any advantages to knowing or using regular javascript DOM Manipulation vs jQuery?
tekac
@tekac
May 11 2016 02:39
if (target.indexOf(test[i]) < 0)
someone help me understand what this means exactly?

function mutation(arr) {  
  var test = arr[1].toLowerCase();
  var target = arr[0].toLowerCase();
  for (i = 0; i < test.length; i++) {
    if (target.indexOf(test[i]) < 0)
      return false;
  }

  return true;
}

mutation(["hello", "hey"]);
Yolixtly
@yolixtly
May 11 2016 02:40
hi! I am trying to convert a string into an array, so I do this: var myName = “yoli”; var arr1 = myName.split(“,”) //logs arr1 = [“yoli"]; however I want to obtain this: “[“y”, “o”, ”l” , "i”]; do you have any suggestions ? thank you
Diego Mayer
@Chrono79
May 11 2016 02:40
@tekac indexOf returns -1 if the thing you use as needle isn't in the haystack, in this case, if test[i] isn't in target
Ken Haduch
@khaduch
May 11 2016 02:40
@tekac - the .indexOf() method will return the index (location within the string) of the character that you are passing as the argument. If it doesn't find one, it returns -1.
Edward Hernández
@syntactician
May 11 2016 02:40
@ChrisL108 I've seen some folks say that raw javascript is theoretically better, but if you try to avoid it you'll spend a lot of time trying to reinvent the wheel. jQuery is well written and does what it is meant to do well.
ereinertsen
@ereinertsen
May 11 2016 02:41
@Chrono79 finally got it. return arr. shift(); thanks!
CamperBot
@camperbot
May 11 2016 02:41
ereinertsen sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:cookie: 700 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
May 11 2016 02:41
@yolixtly use split("")
Edward Hernández
@syntactician
May 11 2016 02:41
@ChrisL108 if you have a principled stance against jQuery, check out lightweight alternatives like Zepto.js
Yolixtly
@yolixtly
May 11 2016 02:41
This message was deleted
Chris Lacaille
@ChrisL108
May 11 2016 02:42
@syntactician Thanks!
CamperBot
@camperbot
May 11 2016 02:42
chrisl108 sends brownie points to @syntactician :sparkles: :thumbsup: :sparkles:
:cookie: 291 | @syntactician |http://www.freecodecamp.com/syntactician
tekac
@tekac
May 11 2016 02:42
@Chrono79 @khaduch so because its -1 .. this means its less than 1 which means its not in the string so returns false... else it is and returns true? correct?
Chris Lacaille
@ChrisL108
May 11 2016 02:42
@ChrisL108 nothing against it just wondering if I was taking a 'shortcut' but with cross-browser stuff as well, it seems hard to pass up on JQ @syntactician
Diego Mayer
@Chrono79
May 11 2016 02:42
@tekac not the same, 0 is a valid index value (it's the first position)
that's why it says < 0, you could use === -1 too
Yolixtly
@yolixtly
May 11 2016 02:42
@Chrono79 thank you ;) it worked
CamperBot
@camperbot
May 11 2016 02:42
:cookie: 701 | @chrono79 |http://www.freecodecamp.com/chrono79
yolixtly sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
tekac
@tekac
May 11 2016 02:43
gawwww people weren't kidding when learning programming is hard.
Ken Haduch
@khaduch
May 11 2016 02:43
@tekac - -1 means that it is < 0, which is what you are checking. And it is not in the string so it is returning false. If it makes it through the entire string without finding anything missing, the it returns true. Which is what I think you meant to say.
Edward Hernández
@syntactician
May 11 2016 02:43

@ChrisL108. jQ is very much not taking a shortcut. It's standing on the shoulders of giants.

That said, Zepto looks pretty good.

Suren VB
@surenz298
May 11 2016 02:44

Help time - I guess I am missing something simple here - the below pen - I would expect when I click tweet it - it will open up a new window with my text ready to tweet

But it does not happen

Any pointers

http://codepen.io/surenz298/pen/xVBqmR

CamperBot
@camperbot
May 11 2016 02:44
no wiki entry for: time - i guess i am missing something simple here - the below pen - i would expect when i click tweet it - it will open up a new window with my text ready to tweetbut it does not happenany pointershttpcodepeniosurenz298penxvbqmr
Ken Haduch
@khaduch
May 11 2016 02:44
@tekac - it is hard, but you can persevere and learn, it takes a while to get used to the so-called "idioms" - common things that you use when you're writing code, standard ways to check for things, solve problems, etc.
Bobby McDonald
@BobbyMcWho
May 11 2016 02:44
Can someone help me figure out why my click doesn't change F to C? http://codepen.io/BobbyMcWho/pen/pyQOWj
Chris Lacaille
@ChrisL108
May 11 2016 02:45
@syntactician Yea I keep wondering if it will be included in javascript itself eventually, Ill check out Zepto
tekac
@tekac
May 11 2016 02:45
yes that is what I was thinking exactly . thanks @khaduch and @Chrono79
CamperBot
@camperbot
May 11 2016 02:45
tekac sends brownie points to @khaduch and @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 1093 | @khaduch |http://www.freecodecamp.com/khaduch
:cookie: 702 | @chrono79 |http://www.freecodecamp.com/chrono79
Ken Haduch
@khaduch
May 11 2016 02:45
@BobbyMcWho - looks like you have a syntax error in your javascript? I see something near the bottom of the JS window "unexpected token". So it isn't doing anything right now...
Bobby McDonald
@BobbyMcWho
May 11 2016 02:46
@khaduch forgot to save, look again
Justin Woodward
@jwoo92
May 11 2016 02:49
for ceasers cipher, am i on the right path?
Ken Haduch
@khaduch
May 11 2016 02:49
@BobbyMcWho - you have some problems besides the click. YOu should not have <html>, <head>, <body> tags in a CodePen project. They are in the template that is used by CodePen to generate the HTML page. It results in invalid HTML (which could be a problem that is causing this... but I'll look at your code.) Also, all of the things that you have - the stylesheets, etc. will not load as you have them coded. They are using relative addressing, which doesn't work on CodePen (unless you have a premium account, where I think you can do that kind of stuff.)
Justin Woodward
@jwoo92
May 11 2016 02:49

function rot13(str) { // LBH QVQ VG!

  str.replace(/A-Z/g, function deCode() {
    if (str.charCodeAt() - 13 < 0) {
      return 26 + (str.charCodeAt() - 13);
    } else {
      return str.charCodeAt() - 13;
    }



  });






return str.fromCharCode();  

}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Samuel Cupidon
@Zerazera
May 11 2016 02:50
Hi all, looking for feedback on my Simon game. http://codepen.io/Zeratul/full/LNMxGY/
Johnathon Sykes
@seesykescode
May 11 2016 02:51
@BobbyMcWho I dont see an event that's supposed to fire off when you click that link.
Bobby McDonald
@BobbyMcWho
May 11 2016 02:51
@khaduch those are just because I copy paste from my local editor into codepen, they haven't given me any issues before
Ken Haduch
@khaduch
May 11 2016 02:51
@BobbyMcWho - you have your changeU set up to be a click handler on #units, but I don't see where #units is in your html...
Edward Hernández
@syntactician
May 11 2016 02:51
@jwoo92 check the character codes for letters! capital letters run from 65-90 i think
Johnathon Sykes
@seesykescode
May 11 2016 02:51
oh i see it at the bottom now.
Bobby McDonald
@BobbyMcWho
May 11 2016 02:51
@khaduch it's added in the getTemp() function
Ken Haduch
@khaduch
May 11 2016 02:52

@BobbyMcWho - if you look at the console - you see this:

Failed to load resource: the server responded with a status of 404 (Not Found)
http://s.codepen.io/boomerang/20544c47edf33bf89451ba52326eaf101462934794508/css/style.css Failed to load resource: the server responded with a status of 404 (Not Found)
http://s.codepen.io/boomerang/20544c47edf33bf89451ba52326eaf101462934794508/css/bootstrap-theme.css Failed to load resource: the server responded with a status of 404 (Not Found)
http://s.codepen.io/boomerang/20544c47edf33bf89451ba52326eaf101462934794508/js/bootstrap.min.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://s.codepen.io/boomerang/20544c47edf33bf89451ba52326eaf101462934794508/js/main.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://s.codepen.io/boomerang/20544c47edf33bf89451ba52326eaf101462934794508/css/bootstrap.min.css Failed to load resource: the server responded with a status of 404 (Not Found)
http://s.codepen.io/boomerang/20544c47edf33bf89451ba52326eaf101462934794508/css/bootstrap-theme.css Failed to load resource: the server responded with a status of 404 (Not Found)
http://s.codepen.io/boomerang/20544c47edf33bf89451ba52326eaf101462934794508/css/style.css Failed to load resource: the server responded with a status of 404 (Not Found)

Looks like lots of errors failing to load those things...

Edward Hernández
@syntactician
May 11 2016 02:52
@jwoo92 here's a table
@jwoo92 other than that, it seems like you're on the right track
Bobby McDonald
@BobbyMcWho
May 11 2016 02:53
@khaduch there I removed those, no issue.
those weren't causing the problem
Ken Haduch
@khaduch
May 11 2016 02:54

@BobbyMcWho - oh, the problem then is that when you are trying to set that click handler, the #units element does not exist. Any reason why you don't just put it directly in the HTML?

And if you aren't using bootstrap, etc. that's fine - just remove them.

Mike Moss
@MMux
May 11 2016 02:56
help drop it
CamperBot
@camperbot
May 11 2016 02:56

:point_right: algorithm drop it [wiki]

Explanation:

Basically while the second argument is not true, you will have to remove the first element from the left of the array that was passed as the first argument.

:pencil: read more about algorithm drop it on the FCC Wiki

Ken Haduch
@khaduch
May 11 2016 02:57
@BobbyMcWho - I guess the other option is that after you create the #units element, then set the click handler...
Bobby McDonald
@BobbyMcWho
May 11 2016 02:57
@khaduch because if I put it in the HTML then when I insert the temp from the JSON it will overwrite the anchor
Ken Haduch
@khaduch
May 11 2016 02:59
@BobbyMcWho - okay, but you don't really need an anchor - you can just put a click handler on the div (if you just store it in a div) - or you can add it after you add the element.
Justin Woodward
@jwoo92
May 11 2016 02:59

function rot13(str) { // LBH QVQ VG!

  str.replace(/A-Z/g, function deCode() {
    if (str.charCodeAt() - 13 < 65) {
      return 90 -(65 - (str.charCodeAt() - 13));
    } else {
      return str.charCodeAt() - 13;
    }



  });

return str.fromCharCode();  

}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Edward Hernández
@syntactician
May 11 2016 03:01
@jwoo92 is that working?
@jwoo92 if not, i think that function may not be the right sort of object to be passed as an argument
Justin Woodward
@jwoo92
May 11 2016 03:02
@syntactician i changed to this and i am returning the same output as input:

function rot13(str) { // LBH QVQ VG!

  return str.replace(/A-Z/g, function deCode() {
    if (str.charCodeAt() - 13 < 65) {
      return 90 -(65 - (str.charCodeAt() - 13));
    } else {
      return str.charCodeAt() - 13;
    }



  });

}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
Diego Mayer
@Chrono79
May 11 2016 03:02
@jwoo92 it's String.fromCharCode
Edward Hernández
@syntactician
May 11 2016 03:04

@Chrono79 good call.

also @jwoo92 the function passed to String.replace() needs to take the argument (the character being replaced)

Veronica
@veronicarbulu
May 11 2016 03:05

Hi all - I'm stuck at the counting card assignment. I'm still playing it with but I feel I might not fully understand what I'm being asked to to. This is the code I have:
var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
console.log(count + "Bet");
break;

case 7:
case 8:
case 9:

  console.log(count++ || count-- + "Hold");
  break;

case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
  count ++;
  console.log (count + "hold");
  break;

}

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

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

Edward Hernández
@syntactician
May 11 2016 03:07
@jwoo92 something like...
str.replace(/A-Z/g, (function(c) {

}));
VultureBetrayer
@VultureBetrayer
May 11 2016 03:08
I'm wondering if this is a bug, or if it's just something I'm not understanding clearly. I have a challenge where dot notation doesn't work, but it doesn't seem to be logical why
I mean I can complete the challenge using bracket notation fine, but just not sure why dot notation breaks it
here is the code that works:
Ken Haduch
@khaduch
May 11 2016 03:08
@VultureBetrayer - what is the challenge / code?
Edward Hernández
@syntactician
May 11 2016 03:08
@veronicarbulu you don't need your console.log calls in your switch! just increment the count in the switch.
VultureBetrayer
@VultureBetrayer
May 11 2016 03:08
// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here

  if (myObj.hasOwnProperty(checkProp) === true){

    return myObj[checkProp];

  }

  return "Not Found";
}

// Test your code by modifying these values
checkObj("gift");
so this answer works
Edward Hernández
@syntactician
May 11 2016 03:09
@VultureBetrayer where would you be using dot notation?
for checkProp?
Ken Haduch
@khaduch
May 11 2016 03:09
@VultureBetrayer - you have to be using bracket notation there, because your property name is stored in a variable...
VultureBetrayer
@VultureBetrayer
May 11 2016 03:09
but if I set the following:
return myObj.checkProp;
it fails
not sure what that is
Mike Moss
@MMux
May 11 2016 03:10
help steamroller
CamperBot
@camperbot
May 11 2016 03:10

:point_right: algorithm steamroller [wiki]

Explanation:

This problem seems simple but you need to make sure to flatten any array, regardless of the level which is what adds a bit of difficulty to the problem.

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

Ken Haduch
@khaduch
May 11 2016 03:10
@VultureBetrayer - you can only use dot notation when you have the literal property name - myObj.gift, myObj.pet, etc.
Veronica
@veronicarbulu
May 11 2016 03:10
@syntactician so how do I have it read "bet" or "hold". Should I use return?
Johnny K Juarez
@Reapnsow
May 11 2016 03:11
Hello, I'm having a hard time on "Counting Cards", specifically with I believe Sequencing, i'm trying to use switch, but i'm getting confused.
Here's what i've got so far.
```
VultureBetrayer
@VultureBetrayer
May 11 2016 03:11
okay so you can't use dot notation if it's a variable, got it
Johnny K Juarez
@Reapnsow
May 11 2016 03:11

var count = 0;

function cc(card) {
  // Only change code below this line
  switch (card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      return "5 Bet";
      break;
    case 7:
    case 8:
    case 9:
      return "0 Hold";
      break;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      return "-5 Hold";
      break;
    case 3:
    case 7:
    case 'Q':
    case 8:
    case 'A':
      return "-1 Hold";
      break;

  }

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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
VultureBetrayer
@VultureBetrayer
May 11 2016 03:11
that really isn't explained so I was confused why one worked and the other didn't, thanks for that @khaduch 3
CamperBot
@camperbot
May 11 2016 03:11
vulturebetrayer sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1094 | @khaduch |http://www.freecodecamp.com/khaduch
Coy Sanders
@coymeetsworld
May 11 2016 03:11
@VultureBetrayer you don't want to return anything in your switch statement
you want to modify the count variable, increment it if you see a 2-6, decrement if you see 10-A, don't modify at all if its 7-9
VultureBetrayer
@VultureBetrayer
May 11 2016 03:12
@coymeetsworld I think you mean @Reapnsow ;-)
Edward Hernández
@syntactician
May 11 2016 03:12
@veronicarbulu Yep! you'll need to use return
Coy Sanders
@coymeetsworld
May 11 2016 03:12
then after the switch statement, evaluate the count variable. If its greater than 0 you bet, if its 0 or less you hold
you can remove these last few case statements too as they are already accounted for:
case 3:
    case 7:
    case 'Q':
    case 8:
    case 'A':
      return "-1 Hold";
      break;
Edward Hernández
@syntactician
May 11 2016 03:13
also @veronicarbulu @Reapnsow since 7, 8, 9 increment +0, they don't even need to be in the switch
Coy Sanders
@coymeetsworld
May 11 2016 03:14
yes they do @syntactician
Johnny K Juarez
@Reapnsow
May 11 2016 03:14
@coymeetsworld I understand what you're saying, but the uhhh, instructions? say to return, or is this just a term for the command box?
Veronica
@veronicarbulu
May 11 2016 03:14
@syntactician Thanks. Trying now.
CamperBot
@camperbot
May 11 2016 03:14
veronicarbulu sends brownie points to @syntactician :sparkles: :thumbsup: :sparkles:
:cookie: 297 | @syntactician |http://www.freecodecamp.com/syntactician
Johnny K Juarez
@Reapnsow
May 11 2016 03:14
@coymeetsworld Cards Sequence 2, 3, 4, 5, 6 should return "5 Bet"
Cards Sequence 7, 8, 9 should return "0 Hold"
Cards Sequence 10, J, Q, K, A should return "-5 Hold"
Cards Sequence 3, 7, Q, 8, A should return "-1 Hold"
Cards Sequence 2, J, 9, 2, 7 should return "1 Bet"
Cards Sequence 2, 2, 10 should return "1 Bet"
Cards Sequence 3, 2, A, 10, K should return "-1 Hold"
Coy Sanders
@coymeetsworld
May 11 2016 03:14
you return at the end of the function @Reapnsow
VultureBetrayer
@VultureBetrayer
May 11 2016 03:14
@Reapnsow you are doing the counting cards no?
Johnny K Juarez
@Reapnsow
May 11 2016 03:15
@VultureBetrayer yes.
Ken Haduch
@khaduch
May 11 2016 03:15

@VultureBetrayer

that really isn't explained so I was confused why one worked and the other didn't...

Well, it probably was explained - but it is a slightly confusing concept... if you go back and review those lessons now that you've seen it in action, you'll probably reinforce the idea.
And you're welcome - glad to be of service!

Coy Sanders
@coymeetsworld
May 11 2016 03:15
well ok, so Cards Sequence 10, J, Q, K, A should return "-5 Hold" for example actually returns 5 times
the last time it returns "-5 Hold" so that isn't worded exactly correctly
VultureBetrayer
@VultureBetrayer
May 11 2016 03:15
@Reapnsow so to help out, first think of this, how do you increment a variable in a loop?
Justin Woodward
@jwoo92
May 11 2016 03:15
here is what i have currently.

function rot13(str) { // LBH QVQ VG!

  return str.replace(/A-Z/g, function deCode(char) {
    if (str.charCodeAt(char) - 13 < 65) {
      return str.fromCharCode(90 -(65 - (str.charCodeAt(char) - 13)));
    } else {
      return str.fromCharCode(charCodeAt(char) - 13);
    }
  });

}

// Change the inputs below to test
rot13("SERR PBQR PNZC");
VultureBetrayer
@VultureBetrayer
May 11 2016 03:16
there are a few things I see broken in your code, so we need to do this step by step
Bobby McDonald
@BobbyMcWho
May 11 2016 03:16
@khaduch Okay now I have some other funkiness going on http://codepen.io/BobbyMcWho/pen/pyQOWj
Johnny K Juarez
@Reapnsow
May 11 2016 03:17
@VultureBetrayer so maybe instead of return "-5 hold" i should use count -= 5?
Tyler Wulf
@WulfingItDown
May 11 2016 03:17
help
CamperBot
@camperbot
May 11 2016 03:17

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

:speechballoon: meet CamperBot in [![FreeCodeCamp/camperbotPlayground](https://img.shields.io/badge/Gitter_Chat_Room:-FreeCodeCamp/camperbotPlayground⮭-006400.svg?style=flat-square&maxAge=2592000)](https://gitter.im/FreeCodeCamp/camperbotPlayground)

:pencil: read more about camperbot on the FCC Wiki

Tyler Wulf
@WulfingItDown
May 11 2016 03:18
find wiki Escape Sequences in strings
CamperBot
@camperbot
May 11 2016 03:18
find wiki escape sequences in strings
nothing found
Tyler Wulf
@WulfingItDown
May 11 2016 03:18
wiki escape sequences in strings
CamperBot
@camperbot
May 11 2016 03:18

:point_right: challenge escape sequences in strings [wiki]

Escape Sequences in Strings

Quotes are not the only characters that can be escaped inside a string. Here is a table of common escape sequences:

Code Output
\' single quote
\" double quote
\ backslash
\n new line
\r carriage return
\t tab
\b backspace
\f form feed

Note that the backslash itself must be escaped in order to display as a backslash.

:pencil: read more about challenge escape sequences in strings on the FCC Wiki

VultureBetrayer
@VultureBetrayer
May 11 2016 03:18
@Reapnsow that's close, if you increment (add 1 to the variable count, how would you write it)
Johnny K Juarez
@Reapnsow
May 11 2016 03:18
count+=1?
Tyler Wulf
@WulfingItDown
May 11 2016 03:18
find escape sequences in strings
CamperBot
@camperbot
May 11 2016 03:18

find escape sequences in strings

:zero: challenge escape sequences in strings

VultureBetrayer
@VultureBetrayer
May 11 2016 03:18
just start with that, once you get the formatting we can move on to case
bob = bob + 1; would be an example increment
tekac
@tekac
May 11 2016 03:20
 function bouncer(arr) {
  var filteredArr = arr.filter(function(val) {
    return !(val === "" || typeof val == "undefined" || val === null);
  });
  var newVar = arr.filter(function(val) {
    return !(val = Boolean(false));
  });
  return filteredArr;
}

bouncer([7, "ate", "", false, 9]);
I was in the right direction but I feel like I'm steering off. I can't figure out the second function to get false, 0 and NaN. I know I need to use isNan()
VultureBetrayer
@VultureBetrayer
May 11 2016 03:20
function bobs(burgers){
do something to bob;
bob = bob + 1;
}
Johnny K Juarez
@Reapnsow
May 11 2016 03:20
@VultureBetrayer I'm understanding this now
VultureBetrayer
@VultureBetrayer
May 11 2016 03:21
@Reapnsow good, did that get you moving along without any need for more help or do you still have questions?
Johnny K Juarez
@Reapnsow
May 11 2016 03:21
@VultureBetrayer So first, i'll use Switch to define the cases and then use if else to return the hold or bet?
VultureBetrayer
@VultureBetrayer
May 11 2016 03:22
btw I get my increments mixed up too as it's different syntax in C, VB, Java
I tend to try all the different ways just to try and reinforce what I'm doing wrong
Coy Sanders
@coymeetsworld
May 11 2016 03:22
C, Java and JavaScript all increment integers same way
idk about VB
Ashwin
@ashwins93
May 11 2016 03:23
VB is a mess
VultureBetrayer
@VultureBetrayer
May 11 2016 03:24
well I do programming in python and vb mostly, do a little c still, and vb does it weirdly, but yes they are all the same normally, you can do stuff like bob++ in VB and I think in C as well
Johnny K Juarez
@Reapnsow
May 11 2016 03:24
Would this be correct?
  switch (card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
       count=count+1;
      break;
    case 7:
    case 8:
    case 9:
      count=count;
      break;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      count=count-1;
      break;
Miguel Asse
@cubang8r
May 11 2016 03:24
Hey all, working on the javascript algorithms and stuck on #2 around creating a factor function
Ashwin
@ashwins93
May 11 2016 03:24
I really miss the the preincrement and predecrement operators
Miguel Asse
@cubang8r
May 11 2016 03:24
I just want to understand the math behind this, can someone explain why I'm getting 625?

function factorialize(num) {
  var product = 1;
  var total = [];

  if(num === 0){
    return 1;
  }
  else{
    for(i = 1; i < num; i++){
      product *= num;
    }
  }


  return product;
}

factorialize(5);
Coy Sanders
@coymeetsworld
May 11 2016 03:24
yeah thats good @Reapnsow
VultureBetrayer
@VultureBetrayer
May 11 2016 03:24
why not test it? :P
Coy Sanders
@coymeetsworld
May 11 2016 03:25
python also increments like Java C and JavaScript
VultureBetrayer
@VultureBetrayer
May 11 2016 03:25
also you need to do your if statement at the end to give the result
Johnny K Juarez
@Reapnsow
May 11 2016 03:26
@coymeetsworld @VultureBetrayer Thanks guys, I'm gonna give the rest a shot on my own, if I get stuck i'll be back haha.
CamperBot
@camperbot
May 11 2016 03:26
reapnsow sends brownie points to @coymeetsworld and @vulturebetrayer :sparkles: :thumbsup: :sparkles:
:cookie: 799 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
:cookie: 230 | @vulturebetrayer |http://www.freecodecamp.com/vulturebetrayer
VultureBetrayer
@VultureBetrayer
May 11 2016 03:26
python doesnt support ++
not sure if you can do that in java either, but I know you can in vb and think you can in c as wel
Ashwin
@ashwins93
May 11 2016 03:26
@cubang8r product *= num that's where you are wrong
Yeah Python doesn't have increment operators
Coy Sanders
@coymeetsworld
May 11 2016 03:26
oh wow interesting about Python
Ashwin
@ashwins93
May 11 2016 03:27
Such a bummer
VultureBetrayer
@VultureBetrayer
May 11 2016 03:27
but I don't code those much so I could be wrong, my point was that I try all the different ways to increment when doing certain things
Coy Sanders
@coymeetsworld
May 11 2016 03:27
hmm, yeah Java has it
Brian Danowski
@mailtruck
May 11 2016 03:27
hi! does anyone know how to use angular with ui router?
Coy Sanders
@coymeetsworld
May 11 2016 03:27
haven't really used Python, did more Perl for sysadmin work
Ashwin
@ashwins93
May 11 2016 03:27
Perl is great for sys utilities and godly for regex
VultureBetrayer
@VultureBetrayer
May 11 2016 03:27
trust me I broke an important mission critical system a while back trying ++ in python lol I learned that one
Coy Sanders
@coymeetsworld
May 11 2016 03:28
but it sucks to read @ashwins93
can't even read my own code once i wrote it lol
Ashwin
@ashwins93
May 11 2016 03:28
Haha yeah it's beautiful in its own way
Miguel Asse
@cubang8r
May 11 2016 03:28
@ashwins93 thanks. Going to sleep on it and take another crack tomorrow. Any other thoughts on what to consider?
CamperBot
@camperbot
May 11 2016 03:28
cubang8r sends brownie points to @ashwins93 :sparkles: :thumbsup: :sparkles:
:cookie: 293 | @ashwins93 |http://www.freecodecamp.com/ashwins93
0x0936 @0x0936 feels lucky to have never learned Perl
Coy Sanders
@coymeetsworld
May 11 2016 03:28
but other than that yeah its not a bad language
Ashwin
@ashwins93
May 11 2016 03:28
Well the creator of Perl is kinda
Haha
One should read his blogs
VultureBetrayer
@VultureBetrayer
May 11 2016 03:29
but in the end, best practice, memorize all those increments and try em out in different languages so you can adjust to fit your needs, at least that's been my newbie experience
Ashwin
@ashwins93
May 11 2016 03:31
Memorize?
Johnny K Juarez
@Reapnsow
May 11 2016 03:31
@VultureBetrayer @coymeetsworld aaaaaand I'm back.
VultureBetrayer
@VultureBetrayer
May 11 2016 03:32
@Reapnsow wb!
Johnny K Juarez
@Reapnsow
May 11 2016 03:32
if (count+1) {
   return "5 Bet";
whoops
Ashwin
@ashwins93
May 11 2016 03:32
@cubang8r just step through one iteration at a time to see where you are going wrong. Have console.log at each iteration to print the variables. That will be a good practice for debugging logical errors
Johnny K Juarez
@Reapnsow
May 11 2016 03:32
forgot to put the closing }
Coy Sanders
@coymeetsworld
May 11 2016 03:33
couple of things @Reapnsow
VultureBetrayer
@VultureBetrayer
May 11 2016 03:33
@Reapnsow one question for you
Coy Sanders
@coymeetsworld
May 11 2016 03:33
go ahead @VultureBetrayer :)
VultureBetrayer
@VultureBetrayer
May 11 2016 03:33
@Reapnsow what happens when you type count+1
Johnny K Juarez
@Reapnsow
May 11 2016 03:34
@VultureBetrayer it refers to case's 2-6.
Coy Sanders
@coymeetsworld
May 11 2016 03:34
@Reapnsow can you post all your code?
VultureBetrayer
@VultureBetrayer
May 11 2016 03:34
@Reapnsow try this trick, read out loud to your self your if statement
@coymeetsworld feel free to add what you'd like
Coy Sanders
@coymeetsworld
May 11 2016 03:35
should see the whole code first i think before i say anything else
VultureBetrayer
@VultureBetrayer
May 11 2016 03:35
gotcha, probably a good policy
Bobby McDonald
@BobbyMcWho
May 11 2016 03:35
@khaduch thanks for the looks, I got it solved: http://codepen.io/BobbyMcWho/pen/pyQOWj
CamperBot
@camperbot
May 11 2016 03:35
bobbymcwho sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1095 | @khaduch |http://www.freecodecamp.com/khaduch
Ken Haduch
@khaduch
May 11 2016 03:36

@BobbyMcWho - ok... it was baffling me until I noticed that you have this code at the bottom:

    $('#units').click(changeU());

and it should really be this - without that extra set of parens:

    $('#units').click(changeU);

And it would be more efficient

Johnny K Juarez
@Reapnsow
May 11 2016 03:36

var count = 0;

function cc(card) {
  // Only change code below this line
  switch (card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
       count=count+1;
      break;
    case 7:
    case 8:
    case 9:
      count=count;
      break;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      count=count-1;
      break;
  }
  if (count+1) {
    return "5 Bet";
  } if (count-1) {
    return "-5 Hold";
  } if (count) {
    return "0 Hold";
  }

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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Bobby McDonald
@BobbyMcWho
May 11 2016 03:37
@khaduch that was part of what fixed it, i'm not certain why those parentheses broke it so much
Veronica
@veronicarbulu
May 11 2016 03:37

@syntactician Still having issues. I tried removing console.log and using return, but it gives me issues and asks I remove "break;". What am I doing wrong?
var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
console.log(count + " " + "Bet");
break;

case 7:
case 8:
case 9:
console.log(count + " " + "Hold");
break;

case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count--;
console.log(count + " " + "Hold");
break;

}

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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
_

Ken Haduch
@khaduch
May 11 2016 03:37
@BobbyMcWho - it would be more efficient if you just stored the temperature that you got on the original call, and when you were changing units, just use the conversion equation to change between Fahrenheit and Celsius, that way you wouldn't have to go through the whole openweather transaction multiple times, just to change the temperature units.
VultureBetrayer
@VultureBetrayer
May 11 2016 03:38
@Reapnsow ok so now that we see your if statements, does reading the first statement out loud help with anything?
Ken Haduch
@khaduch
May 11 2016 03:38
@BobbyMcWho - the parens broke it because you were invoking the function with that notation - so it was making multiple calls to the changeU function. That was confusing me stepping through the debugger!
Johnny K Juarez
@Reapnsow
May 11 2016 03:39
@VultureBetrayer Not really now, I mean it makes sense in my head, if the count is +1 then you should Bet.
@VultureBetrayer the code does return "5 Bet" but I don't get any other returns.
Ashwin
@ashwins93
May 11 2016 03:40
@Reapnsow thats not how you check if a number is positive
Johnny K Juarez
@Reapnsow
May 11 2016 03:40
JavaScripts makes me feel so stupid.
VultureBetrayer
@VultureBetrayer
May 11 2016 03:40
@Reapnsow so if I read your first statement this is how I would read it to myself: "if count has 1 added to it then return 5 bet"
Ashwin
@ashwins93
May 11 2016 03:41
more like if (add 1 to count) return 5 bet
VultureBetrayer
@VultureBetrayer
May 11 2016 03:41
that's another way to read it @ashwins93
Ashwin
@ashwins93
May 11 2016 03:42
your if statement will never fail because the condition never becomes zero (false)
VultureBetrayer
@VultureBetrayer
May 11 2016 03:42
now that we've determine the if statement has an issue, how do you think you should adjust it?
Johnny K Juarez
@Reapnsow
May 11 2016 03:42
card +1
VultureBetrayer
@VultureBetrayer
May 11 2016 03:43
remember your incrementation is happening in your switch statement
so you don't need to add anything, you just need to test the condition of your variable
Ashwin
@ashwins93
May 11 2016 03:43
@Reapnsow all you have to do is check whether the count is positive or negative and give a decision based on that
VultureBetrayer
@VultureBetrayer
May 11 2016 03:44
so think wayyyyy back to when you tested variables, how would you test to see if the value is correct for the return value?
Ashwin
@ashwins93
May 11 2016 03:44
think, how will you check if a number is positive or not?
Johnny K Juarez
@Reapnsow
May 11 2016 03:44
oooh wooow
less than or greater than.
VultureBetrayer
@VultureBetrayer
May 11 2016 03:44
there you go!
Johnny K Juarez
@Reapnsow
May 11 2016 03:44
facepalm
VultureBetrayer
@VultureBetrayer
May 11 2016 03:44
now what does the problem ask you to check
Ashwin
@ashwins93
May 11 2016 03:45
@Reapnsow kudos!
VultureBetrayer
@VultureBetrayer
May 11 2016 03:45
nice, eureka moments are great eh?
Ashwin
@ashwins93
May 11 2016 03:45
you'll get a lot of those
VultureBetrayer
@VultureBetrayer
May 11 2016 03:45
honestly I think this challenge combines a few things which makes it easy to get stuck
Ashwin
@ashwins93
May 11 2016 03:46
all beginners get stuck in this challenge and the nextInLIne one
and the gear changing one
Johnny K Juarez
@Reapnsow
May 11 2016 03:46
still stuck
haha
VultureBetrayer
@VultureBetrayer
May 11 2016 03:46
it's okay, post your code and lets step through it again
Ken Haduch
@khaduch
May 11 2016 03:47
@ashwins93 - and the contact list, and the record albums... I think that those are steep points on the learning curve!
Ashwin
@ashwins93
May 11 2016 03:47
@Reapnsow another mistake with your code was something you were returning. What did the instruction ask you to return? and what are you returning?
VultureBetrayer
@VultureBetrayer
May 11 2016 03:47
@ashwins93 agreed, I think nextInLine is badly written though, I really believe that
Ashwin
@ashwins93
May 11 2016 03:47
@khaduch yeah we see that a lot here
may be the description for the challenge could be made better without giving away the solution?
Johnny K Juarez
@Reapnsow
May 11 2016 03:48
I actually don't think it's a code thing this time @VultureBetrayer , it's more of a math thing. the next things i need are
"Cards Sequence 3, 7, Q, 8, A should return "-1 Hold"
Cards Sequence 2, J, 9, 2, 7 should return "1 Bet"
Cards Sequence 2, 2, 10 should return "1 Bet"
Cards Sequence 3, 2, A, 10, K should return "-1 Hold""
Ken Haduch
@khaduch
May 11 2016 03:48
@ashwins93 - I've helped a hundred people with those... I think that the nextInLine needs a little bit of an explanation of a queue structure... but that might just confuse the issue... :)
Justin Woodward
@jwoo92
May 11 2016 03:48
@Chrono79 thanks for helping me through ceasers cipher, really do appreciate it.
CamperBot
@camperbot
May 11 2016 03:48
jwoo92 sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:cookie: 703 | @chrono79 |http://www.freecodecamp.com/chrono79
VultureBetrayer
@VultureBetrayer
May 11 2016 03:48
@ashwins93 it could be, I explained in detail how I'd explain it, basically I think the pseudocode for that one needs to embed it within a function so new folks can see what variables get moved around easier
Ashwin
@ashwins93
May 11 2016 03:49
data structures for beginners is a little steep
i do really believe programming should start with C
Ken Haduch
@khaduch
May 11 2016 03:51

@ashwins93

i do really believe programming should start with C

Well, that would be interesting... maybe it should be "go" nowadays? (Although I know C, I don't know much about "go"...)

Johnny K Juarez
@Reapnsow
May 11 2016 03:51
I read that JavaScript is one of the most discouraging languages.
VultureBetrayer
@VultureBetrayer
May 11 2016 03:52
@ashwins93 well I started with C, and honestly things have changed so much since I was compiling with Borland 1 . . . I kind of think the opposite, java makes more sense IMO and since you get results quicker it really helps you get going quicker
@Reapnsow if you want discouraging, try pascal :P
or fortran . . . shudder
Johnny K Juarez
@Reapnsow
May 11 2016 03:52
@VultureBetrayer @coymeetsworld @ashwins93 I don't how to get the mixed sequencing to return a statement....
VultureBetrayer
@VultureBetrayer
May 11 2016 03:53
@Reapnsow please post your code and we will step through it
Johnny K Juarez
@Reapnsow
May 11 2016 03:54
Code hasn't changed it, I tried using <= and >= but no go :/

var count = 0;

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

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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Coy Sanders
@coymeetsworld
May 11 2016 03:54
almost got it, minus some cleanupp
think you're missing what to return though
what you want to return is Bet or Hold depending on the count, and you want to return the count value
not just a hardcoded 5 or -5 value
Aryan
@aryandua
May 11 2016 03:54
count=count is pointless
VultureBetrayer
@VultureBetrayer
May 11 2016 03:54
here's a tip: you only have to test for greater than 0
Coy Sanders
@coymeetsworld
May 11 2016 03:55
@VultureBetrayer @aryandua we can clean it up later
Aryan
@aryandua
May 11 2016 03:55
ok
Coy Sanders
@coymeetsworld
May 11 2016 03:55
for now need to get it working first more important
VultureBetrayer
@VultureBetrayer
May 11 2016 03:55
@coymeetsworld gotcha I'll shut it :P
Coy Sanders
@coymeetsworld
May 11 2016 03:55
:)
he almost has it though
VultureBetrayer
@VultureBetrayer
May 11 2016 03:55
take it away
Taulut Hossain Washi
@WASHINPI
May 11 2016 03:56

@Reapnsow you can try this way
var count = 0;

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

if(card1 >= 2 && card1 <= 6)
{

count += 1;

} else if(card*1 == 10 || card == 'J' || card == 'Q' || card == 'K' || card == 'A') {

count -= 1;

}

return (count > 0) ? count+' Bet' : count+' Hold';

// Only change code above this line
}

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

Aryan
@aryandua
May 11 2016 03:56
This message was deleted
Coy Sanders
@coymeetsworld
May 11 2016 03:57
@WASHINPI his switch is ok
Aryan
@aryandua
May 11 2016 03:57
This message was deleted
Coy Sanders
@coymeetsworld
May 11 2016 03:57
almost, but don't want to give code out remember @aryandua
Aryan
@aryandua
May 11 2016 03:57
oh yeh
Coy Sanders
@coymeetsworld
May 11 2016 03:57
but the idea is right
Taulut Hossain Washi
@WASHINPI
May 11 2016 03:57
@coymeetsworld yep I know but he want to use <= or >=
Johnny K Juarez
@Reapnsow
May 11 2016 03:58
@aryandua I appreciate that, truly I do, but the answer doesn't teach.
Aryan
@aryandua
May 11 2016 03:58
soryr
*sorry
Coy Sanders
@coymeetsworld
May 11 2016 03:58
@Reapnsow your if statements are ok
just what your returning
you want to return the count variable plus either bet or hold
depending on the count
so you got that part right, you're saying Bet or Hold in correct places
but instead of returning a hardcoded number you want to return count
Johnny K Juarez
@Reapnsow
May 11 2016 03:59
@coymeetsworld so if i use count+"Hold" or count+"Bet", that should work since it's using a value + a statement, right?
VultureBetrayer
@VultureBetrayer
May 11 2016 03:59
@coymeetsworld I think the return statement stumped me for 10 mins due to syntax probs
Coy Sanders
@coymeetsworld
May 11 2016 03:59
it will work @Reapnsow
VultureBetrayer
@VultureBetrayer
May 11 2016 03:59
@Reapnsow remember you need a space after the count number for it to be good for the challenge
Coy Sanders
@coymeetsworld
May 11 2016 04:00
I am not 100% sure exactly how JavaScript does it, but you can concatenate a number to a String and it will make a string
so count +"Hold" is fine (except put a space before Hold)
VultureBetrayer
@VultureBetrayer
May 11 2016 04:00
for mine to work I had to make sure the space was declared
Coy Sanders
@coymeetsworld
May 11 2016 04:00
yeah so just use " Hold" instead of "Hold"
VultureBetrayer
@VultureBetrayer
May 11 2016 04:00
@coymeetsworld exactly
Coy Sanders
@coymeetsworld
May 11 2016 04:00
thats a minor detail
VultureBetrayer
@VultureBetrayer
May 11 2016 04:01
it is but the answer coming up wrong can be frustrating
my mistake was doing count & variable or count && variable (vb would do it this way)
Johnny K Juarez
@Reapnsow
May 11 2016 04:01
@coymeetsworld @VultureBetrayer @aryandua @WASHINPI Thank you guys, I completed the challenge, but more importantly, I understood how it was completed, I appreciate the patience guys!
CamperBot
@camperbot
May 11 2016 04:01
reapnsow sends brownie points to @coymeetsworld and @vulturebetrayer and @aryandua and @washinpi :sparkles: :thumbsup: :sparkles:
:warning: reapnsow already gave coymeetsworld points
:warning: reapnsow already gave vulturebetrayer points
:cookie: 261 | @aryandua |http://www.freecodecamp.com/aryandua
:cookie: 242 | @washinpi |http://www.freecodecamp.com/washinpi
Coy Sanders
@coymeetsworld
May 11 2016 04:02
awesome good job @Reapnsow
VultureBetrayer
@VultureBetrayer
May 11 2016 04:02
@Reapnsow great congrats
Johnny K Juarez
@Reapnsow
May 11 2016 04:02
in the future I could probably use if else though for the return haha.
VultureBetrayer
@VultureBetrayer
May 11 2016 04:02
I would recommend going back and redoing the last 4 challenges
Ashwin
@ashwins93
May 11 2016 04:02
@khaduch i haven't tried "go" myself, will take a look.
@VultureBetrayer the reason to start with C is that you get a clarity of what the computer really does when you use Objects and what is an object really. I would even go to say use assembly to learn programming but that would be very crue;
VultureBetrayer
@VultureBetrayer
May 11 2016 04:02
that will reinforce this (it's what I do when I get stuck)
Johnny K Juarez
@Reapnsow
May 11 2016 04:03
@VultureBetrayer Great advice, I will do that now. Cheers.
VultureBetrayer
@VultureBetrayer
May 11 2016 04:03
@ashwins93 I get what you're saying, we went from C to assembly in college but it really just made things confusing for me and was really impractical for real world jobs
I have never, not once, ever, had a boss say "go modify that program to be more memory efficient for our main frame using assembly" lol
Jason
@BoilingOil
May 11 2016 04:04
anyone familiar with react-native?
ereinertsen
@ereinertsen
May 11 2016 04:04
Screen Shot 2016-05-10 at 9.04.01 PM.png
Veronica
@veronicarbulu
May 11 2016 04:04

So this is what I have: if (count >= 2 || count <=6) {
return count + " " + "Bet";
}

else {
return "Hold";
}

ereinertsen
@ereinertsen
May 11 2016 04:04
I need help with the Golf Code lesson. Here is my code
VultureBetrayer
@VultureBetrayer
May 11 2016 04:05
@veronicarbulu you doing the card counting one too?
ereinertsen
@ereinertsen
May 11 2016 04:05
It is passing for everything except golfScore (4 , 1) returning "Hole-in-one!".
Veronica
@veronicarbulu
May 11 2016 04:05
@VultureBetrayer yes

@VultureBetrayer
var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
console.log(count + " " + "Bet");
break;

case 7:
case 8:
case 9:
  console.log(count + " " + "Hold");
break;

case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
 count--;
 console.log(count + " " + "Hold");
  break;

}

if (count >= 2 || count <=6) {
return count + " " + "Bet";
}

else {
return count + " " + "Hold";
}
// Only change code above this line
}

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

VultureBetrayer
@VultureBetrayer
May 11 2016 04:05
@veronicarbulu okay so first thing, what does it ask you to give for the results?
Taulut Hossain Washi
@WASHINPI
May 11 2016 04:06
This message was deleted
Aryan
@aryandua
May 11 2016 04:06

function largestOfFour(arr) {

  max=0;
  for(count=0;count<arr.length;count++) {
    for(j=0;j<4;j++) {
       ret = checkBig(arr[count][j], arr[count+1]);
       if(ret>max) {
         ret=max;
       }
    }

  }
  return arr;
}
function checkbig(a, b)  {
  if(a>b) {
    return a;
  }
  return b;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Veronica
@veronicarbulu
May 11 2016 04:07
@VultureBetrayer The count plus the string (either hold or bet)
Aryan
@aryandua
May 11 2016 04:07
i have to find the biggest number in the array
ereinertsen
@ereinertsen
May 11 2016 04:07
I need some help on Golf Code. Can anyone help?
Ashwin
@ashwins93
May 11 2016 04:07
@VultureBetrayer no haha that would be impractical plus with today's technology memory management isn't that big an issue we can trust the automatic GCs like in Java i guess, its debatable
Aryan
@aryandua
May 11 2016 04:07
what is wrong with my code??
VultureBetrayer
@VultureBetrayer
May 11 2016 04:07
@veronicarbulu so the challenge asks for this: "The function will then 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"
@ashwins93 agreed ;-) I started in the early 90s
Coy Sanders
@coymeetsworld
May 11 2016 04:08
the problem looks like your 2nd for loop
VultureBetrayer
@VultureBetrayer
May 11 2016 04:08
@veronicarbulu so what are we testing for?
Ashwin
@ashwins93
May 11 2016 04:08
@aryandua you got the question wrong, you need to return an "array" consisting of largest numbers from each sub array
Coy Sanders
@coymeetsworld
May 11 2016 04:08
actually its your checkBig function call
your second argument is this: arr[count+1] thats not right
Ashwin
@ashwins93
May 11 2016 04:09
@VultureBetrayer early 90s wow! thats when i was born, i do really envy you people getting to work on DOS systems
Veronica
@veronicarbulu
May 11 2016 04:09
@VultureBetrayer We are testing if it's positive or negative
Coy Sanders
@coymeetsworld
May 11 2016 04:09
i wouldn't rely on calling a function here @aryandua, just do a simple comparison
VultureBetrayer
@VultureBetrayer
May 11 2016 04:09

@veronicarbulu perfect, and what does this test for:

if (count >= 2 || count <=6)

Aryan
@aryandua
May 11 2016 04:09
ok @coymeetsworld
Coy Sanders
@coymeetsworld
May 11 2016 04:09
basically that 2nd for loop is going to iterate through one of those sub arrays
Veronica
@veronicarbulu
May 11 2016 04:10
@VultureBetrayer if numbers are between 2 and 6?
Coy Sanders
@coymeetsworld
May 11 2016 04:10
you need to find the largest value in it, and store/modify it in your max variable
VultureBetrayer
@VultureBetrayer
May 11 2016 04:10
@veronicarbulu so if you're returning results based on that, the if statement is looking for the wrong info, it should be looking for what?
@ashwins93 my first comp was an NEC 8080
:P
Ashwin
@ashwins93
May 11 2016 04:11
@VultureBetrayer i need a time machine badly
VultureBetrayer
@VultureBetrayer
May 11 2016 04:11
@ashwins93 ebay!
Ashwin
@ashwins93
May 11 2016 04:11
or that! hahaha
Veronica
@veronicarbulu
May 11 2016 04:12
@VultureBetrayer It should be looking if the count is positive or negative.
VultureBetrayer
@VultureBetrayer
May 11 2016 04:12
@veronicarbulu perfect, and how would you check for that?
Veronica
@veronicarbulu
May 11 2016 04:13

@VultureBetrayer mmm...having problems figuring it out. Something like this: if (count === +1) {
return count + " " + "Bet";
}

else {
return "Hold";
}

VultureBetrayer
@VultureBetrayer
May 11 2016 04:13
@veronicarbulu I don't want to give you the answer, so please bear with me. if you want to see if a variable is greater than 0 how would you write that?
let's just take small steps to the answer it will make sense if you break it down piece by piece
Aryan
@aryandua
May 11 2016 04:14

function largestOfFour(arr) {

  max=0;
  for(count=0;count<arr.length;count++) {
    for(j=0;j<4;j++) {
       if(arr[count][j]>arr[count][j+1]) {
         arr[count][j]=max;
       }
       else if(arr[count][j+1]){
         arr[count][j+1]=max;
       }
    }
  }
  return arr;
} 
function checkbig(a, b)  {
  if(a>b) {
    return a;
  }
  return b;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
thats my neew coxe
*new code
Veronica
@veronicarbulu
May 11 2016 04:15
@VultureBetrayer thank you. if (count >0) { return count + "Bet";}
CamperBot
@camperbot
May 11 2016 04:15
veronicarbulu sends brownie points to @vulturebetrayer :sparkles: :thumbsup: :sparkles:
:cookie: 232 | @vulturebetrayer |http://www.freecodecamp.com/vulturebetrayer
Coy Sanders
@coymeetsworld
May 11 2016 04:15
you want to assign max
VultureBetrayer
@VultureBetrayer
May 11 2016 04:15
perfect, you just need the space before the Bet
Aryan
@aryandua
May 11 2016 04:15
what do you mean??
@coymeetsworld
Coy Sanders
@coymeetsworld
May 11 2016 04:16
arr[count[j] = max is out of order
you don't want to modify the array, you want to modify max
Aryan
@aryandua
May 11 2016 04:16
oh yeh my bad used to C :)
Coy Sanders
@coymeetsworld
May 11 2016 04:16
C is the same way lol
value goes on right side
Veronica
@veronicarbulu
May 11 2016 04:16

@VultureBetrayer if (count > 0 ) {
return count + " " + "Bet";
}

else {
return "Hold";
}

Aryan
@aryandua
May 11 2016 04:16
you are right:)
my bad
Coy Sanders
@coymeetsworld
May 11 2016 04:17
@veronicarbulu you also want to return the count for hold too
VultureBetrayer
@VultureBetrayer
May 11 2016 04:17
@veronicarbulu doesn't it also want the number and a space before hold?
Ashwin
@ashwins93
May 11 2016 04:17
@aryandua your inner for loop determines the biggest element of a sub array, good. Question is what do you do with that element? (your max variable)
Coy Sanders
@coymeetsworld
May 11 2016 04:17
@aryandua also you should just compare the array values to your max
your code will have an error in it
when j=3
Aryan
@aryandua
May 11 2016 04:17
i doesnt actually
Coy Sanders
@coymeetsworld
May 11 2016 04:17
you sure?
Aryan
@aryandua
May 11 2016 04:18
whats wrong when j=3??
Veronica
@veronicarbulu
May 11 2016 04:18

@VultureBetrayer @coymeetsworld
if (count > 0 ) {
return count + " " + "Bet";
}

else {
return count + " " + "Hold";
}

Coy Sanders
@coymeetsworld
May 11 2016 04:18
bingo
VultureBetrayer
@VultureBetrayer
May 11 2016 04:18
that part looks good
Coy Sanders
@coymeetsworld
May 11 2016 04:18
one minor thing, you can simplify and put the space in Bet and Hold
Veronica
@veronicarbulu
May 11 2016 04:18
It still does not work :(
Aryan
@aryandua
May 11 2016 04:18
its just going to be like arrcount
Coy Sanders
@coymeetsworld
May 11 2016 04:18
i.e.
if (count > 0) {
  return count + " Bet";
} else {
  return count + " Hold";
}
VultureBetrayer
@VultureBetrayer
May 11 2016 04:18
now I'm not 100% on the switch statements can you post the whole code again? I think there were some things in there that need adjusted
Coy Sanders
@coymeetsworld
May 11 2016 04:19
can you post entire code again @veronicarbulu?
VultureBetrayer
@VultureBetrayer
May 11 2016 04:19
I focused on the last part since that one needed to be fixed first
Coy Sanders
@coymeetsworld
May 11 2016 04:19
@aryandua what happens when j=3 and say count=0? arr[0][3] > arr[0][4]
Veronica
@veronicarbulu
May 11 2016 04:19

@VultureBetrayer @coymeetsworld
var count = 0;

function cc(card) {
// Only change code below this line
switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
count++;
console.log(count + " " + "Bet");
break;

case 7:
case 8:
case 9:
  console.log(count + " " + "Hold");
break;

case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
 count--;
 console.log(count + " " + "Hold");
  break;

}

if (count > 0 ) {
return count + " " + " Bet";
}

else {
return count + " " + "Hold";
}
// Only change code above this line
}

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

Coy Sanders
@coymeetsworld
May 11 2016 04:19
arr[0][4] shouldn't return
idk if cause index out of bounds issue or not in JS
but its an element that doesn't exist
VultureBetrayer
@VultureBetrayer
May 11 2016 04:20
ok so first
Coy Sanders
@coymeetsworld
May 11 2016 04:20
that should work @veronicarbulu
PattyCreates
@PattyCreates
May 11 2016 04:20
Hi guys. Stuck on a question. Anyone familiar with switch statements?

"If you have many options to choose from, use a switch statement. A switch statement tests a value and can have many case statements which defines various possible values. Statements are executed from the first matched case value until a break is encountered.

Here is a pseudocode example:

switch (num) {
case value1:
statement1;
break;
case value2:
statement2;
break;
...
case valueN:
statementN;
break;
}
case values are tested with strict equality (===). The break tells JavaScript to stop executing statements. If the break is omitted, the next statement will be executed.

Instructions
Write a switch statement which tests val and sets answer for the following conditions:
1 - "alpha"
2 - "beta"
3 - "gamma"
4 - "delta"

Here are some helpful links:"

I've never seen it these before and am unsure of what to do.
Coy Sanders
@coymeetsworld
May 11 2016 04:21
try refreshing your browser @veronicarbulu
VultureBetrayer
@VultureBetrayer
May 11 2016 04:21
I think the issue is the console.log there shouldn't be a need for it and not sure if that breaks it for the checker
Coy Sanders
@coymeetsworld
May 11 2016 04:21
yes @PattyCreates what part you having trouble w/?
Aryan
@aryandua
May 11 2016 04:21

function largestOfFour(arr) {

  max=0;
  for(count=0;count<arr.length;count++) {
    for(j=0;j<4;j++) {
       if(arr[count][j]>arr[count][j+1]) {
         max=arr[count][j];
       }
       else if(arr[count][j+1]){
         max=arr[count][j+1];
       }
       arr[count]=max;      
    }
  }
  return arr;
} 
function checkbig(a, b)  {
  if(a>b) {
    return a;
  }
  return b;
}
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Ashwin
@ashwins93
May 11 2016 04:21
@PattyCreates you don't understand the example?
Aryan
@aryandua
May 11 2016 04:22
@coymeetsworld can you help me?
VultureBetrayer
@VultureBetrayer
May 11 2016 04:22
help format
CamperBot
@camperbot
May 11 2016 04:22

: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 the code.

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

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

PattyCreates
@PattyCreates
May 11 2016 04:22
@coymeetsworld and @ashwins93 I am not sure what proper syntax to do.
Coy Sanders
@coymeetsworld
May 11 2016 04:22
yeah @aryandua, did what I say make sense earlier?
Ashwin
@ashwins93
May 11 2016 04:22
@aryandua again [j+1] will become 4 in the last iteration
Aryan
@aryandua
May 11 2016 04:22
huh?
oh!!
PattyCreates
@PattyCreates
May 11 2016 04:22
I generally get it. It's like a for loop that stops after it's interupted.
Coy Sanders
@coymeetsworld
May 11 2016 04:22
its not really a for loop @PattyCreates
Aryan
@aryandua
May 11 2016 04:23
When j=3...
Ashwin
@ashwins93
May 11 2016 04:23
@PattyCreates its not a loop its a condition structure
Aryan
@aryandua
May 11 2016 04:23
there is no arr[count][4]!
Coy Sanders
@coymeetsworld
May 11 2016 04:23
correct @aryandua
when you enter the switch statement it goes down each case until it finds one that matches
Ashwin
@ashwins93
May 11 2016 04:23
@PattyCreates are you familiar with if..else if... structure?
Aryan
@aryandua
May 11 2016 04:23
then my whole algorithom is wrong
Veronica