These are chat archives for FreeCodeCamp/HelpJavaScript

14th
Apr 2017
Ty N.
@mynameislink
Apr 14 2017 00:00
I have been doing this project for 3 days now and it's such a pita
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:00
@mynameislink you'll need to style it
David Amanze
@GodKingShogun
Apr 14 2017 00:00
@mynameislink use inside voices :smile:
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:00
@GodKingShogun :joy:
Conor Murphy
@cmurphy580
Apr 14 2017 00:00
@sjames1958gm alright! thanks for the help. Let me look over this and see if i have any questions. Hope your still here when i get back.
CamperBot
@camperbot
Apr 14 2017 00:00
cmurphy580 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6692 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ty N.
@mynameislink
Apr 14 2017 00:01
@Lumexralph I did that's the problem and it's like sublime is just mentally challenged
Can someone look at this and tell me where it is I am going wrong?
var div = document.createElement('div');
div.id = 'container';
div.style.border = '2px solid black';
div.style.padding = '10px';
document.body.appendChild(div);
@GodKingShogun Lol that was funny
Sam Houlahan
@Sam-Houlahan
Apr 14 2017 00:05
@HeebieGeeBee thanks for the help man can I get a bit of an explanation on preventDefault(); documentation on it isnt the clearest.
CamperBot
@camperbot
Apr 14 2017 00:05
sam-houlahan sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1300 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Manish Giri
@Manish-Giri
Apr 14 2017 00:06
@HeebieGeeBee gz on 1300
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:07
oh sweet
@Sam-Houlahan and yeah it just stops the default action for when you press enter inside an input box
well in that case
David Amanze
@GodKingShogun
Apr 14 2017 00:09
@GodKingShogun thanks
CamperBot
@camperbot
Apr 14 2017 00:09
sorry godkingshogun, you can't send brownie points to yourself! :sparkles: :sparkles:
David Amanze
@GodKingShogun
Apr 14 2017 00:09
@GodKingShogun im going to go jump off a building now :cry:
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:10
@Sam-Houlahan you saw it was refreshing the page every time you hit enter, seems like that was preventing your search function from running
Sam Houlahan
@Sam-Houlahan
Apr 14 2017 00:10
Ah i see as the default wasn't letting it trigger the api properly. Thanks man been losing sleep trying to figure this one out.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:11
well it was @Manish-Giri who spotted it first
so i cant take all the credit
Manish Giri
@Manish-Giri
Apr 14 2017 00:12
:blush:
David Amanze
@GodKingShogun
Apr 14 2017 00:12
@Manish-Giri can you look at my simon game. it is not doing what i want it to do :cry:
Sam Houlahan
@Sam-Houlahan
Apr 14 2017 00:13
yeah thanks @Manish-Giri i tried playing with it but was putting the preventDefault in the wrong place.
CamperBot
@camperbot
Apr 14 2017 00:13
sam-houlahan sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 5151 | @manish-giri |http://www.freecodecamp.com/manish-giri
David Amanze
@GodKingShogun
Apr 14 2017 00:13
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:14
@HeebieGeeBee that's why he ggm :smiling_imp:
Joshua Arnett
@josha5
Apr 14 2017 00:14
Hey guys, I am having trouble with the "Iterate Through an Array with a For Loop" challenge. My error code keeps giving me that "total is not defined" when its already been declared and was wondering if anyone could help?
Manish Giri
@Manish-Giri
Apr 14 2017 00:14
@GodKingShogun what's happening/not happening?
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:14
indeed
Manish Giri
@Manish-Giri
Apr 14 2017 00:14
:joy:
David Amanze
@GodKingShogun
Apr 14 2017 00:14
@josha5 post what you have so far
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:14
@josha5 show your code
Joshua Arnett
@josha5
Apr 14 2017 00:14
var myArr = [ 2, 3, 4, 5, 6];
var myTotal = 0;
Manish Giri
@Manish-Giri
Apr 14 2017 00:14
actually, tbh, for setTimeout thingies, @HeebieGeeBee and @Lumexralph are your best bet
@GodKingShogun
Joshua Arnett
@josha5
Apr 14 2017 00:14
for (var i = 0; i < myArr.length; i++) {
myTotal += myArr[i];
}
yuggup
@yuggup
Apr 14 2017 00:15
Need help please. It's saying it "should have encoded text with the proper escape sequences and no spacing." I'm not getting what it means.
var myStr ="FirstLine\n\SecondLine\r\ThirdLine";
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:15
@Manish-Giri sounds like youre passing the buck
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:15
@josha5 is myTotal defined
Joshua Arnett
@josha5
Apr 14 2017 00:15
var myArr = [ 2, 3, 4, 5, 6];
var myTotal = 0;
Manish Giri
@Manish-Giri
Apr 14 2017 00:15
lol pls I'm so broke I'd never pass a buck
:smiling_imp:
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:15
@yuggup escaped backslash ?
Joshua Arnett
@josha5
Apr 14 2017 00:15
Sorry my comp is lagging haha
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:15
@Manish-Giri :joy:
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:16
omg
yuggup
@yuggup
Apr 14 2017 00:16
It says i should have two escaped backslash characters as well though
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:16
@GodKingShogun make that stop
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:16
@yuggup backslash before carriage return
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:16
think it just blew my speakers
yuggup
@yuggup
Apr 14 2017 00:17
var myStr ="FirstLine\n\SecondLine\r\ThirdLine";
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:17
@josha5 was it declared before or after ?
David Amanze
@GodKingShogun
Apr 14 2017 00:17
@Manish-Giri right now i want to get the sequence down. so on the first iteration i want a sound and a button to blink and on the second iteration i want the previous iteration and the current iteration to happen and on the third iteration i want the first second and current iteration to go and so forth until the 20th time.
@HeebieGeeBee make what stop
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:17
@yuggup \\\r
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:17
and yeah i havent done the simon game so dont know how its meant to work
Manish Giri
@Manish-Giri
Apr 14 2017 00:17
omg you have a rifle shot as the sound!!!!#$#$#
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:17
@GodKingShogun those sounds
David Amanze
@GodKingShogun
Apr 14 2017 00:17
and @HeebieGeeBee @Lumexralph feel free to chime in
Manish Giri
@Manish-Giri
Apr 14 2017 00:17
i'm not gonna open the pen at all :joy:
Joshua Arnett
@josha5
Apr 14 2017 00:17
declared before
David Amanze
@GodKingShogun
Apr 14 2017 00:18
@HeebieGeeBee you dont like my chosen sounds
Manish Giri
@Manish-Giri
Apr 14 2017 00:18
gosh my ears
yuggup
@yuggup
Apr 14 2017 00:18
var myStr ="FirstLine\\nSecondLine\\rThirdLine"; \
minus that last backslash
Manish Giri
@Manish-Giri
Apr 14 2017 00:18
I was listening to led zep in full volume on my headphones and then I clicked his button
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:18
@GodKingShogun not a fan, no
Manish Giri
@Manish-Giri
Apr 14 2017 00:18
:gun:
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:18
@Manish-Giri yeah had my speakers up way too much too
Manish Giri
@Manish-Giri
Apr 14 2017 00:18
:ear: :gun: :syringe:
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:19
@josha5 it should work
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:19
and the only way to stop it was to close the window
Joshua Arnett
@josha5
Apr 14 2017 00:19

// Setup
var myArr = [ 2, 3, 4, 5, 6];
var myTotal = 0;

// Only change code below this line

for (var i = 0; i < myArr.length; i++) {
myTotal += myArr[i];
}

David Amanze
@GodKingShogun
Apr 14 2017 00:19
@HeebieGeeBee i posted the wrong one
Joshua Arnett
@josha5
Apr 14 2017 00:19
No idea what its not working
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:19
@josha5 that should work
Joshua Arnett
@josha5
Apr 14 2017 00:19
why**
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:19
@GodKingShogun im not going to look sorry
Manish Giri
@Manish-Giri
Apr 14 2017 00:19
@josha5 where is myTotal coming from?
isn't it just total?
Joshua Arnett
@josha5
Apr 14 2017 00:20
It was given in the setup I've tried both ways
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:20
@yuggup var myStr ="FirstLine\n\\SecondLine\\\rThirdLine";
Joshua Arnett
@josha5
Apr 14 2017 00:20
I keep getting [ReferenceError: total is not defined
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:21
@Manish-Giri code can make my headache when you know it's working and the person didn't use the variable FCC wanted
Manish Giri
@Manish-Giri
Apr 14 2017 00:21
lol
:joy:
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:21
@josha5 what's FCC instruction ?
Manish Giri
@Manish-Giri
Apr 14 2017 00:21
@josha5 where is myTotal coming from?
isn't it just total?
yuggup
@yuggup
Apr 14 2017 00:21
@Lumexralph Thanks, that worked.
CamperBot
@camperbot
Apr 14 2017 00:21
yuggup sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1511 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:22
@Manish-Giri and I think FCC should allow that, there should be flexibility
David Amanze
@GodKingShogun
Apr 14 2017 00:22
@HeebieGeeBee please do for my sanity :smile:
Joshua Arnett
@josha5
Apr 14 2017 00:22
@Lumexralph Instructions: Declare and initialize a variable total to 0. Use a for loop to add the value of each element of the myArr array to total.
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:22
@josha5 means you're to use total not myTotal
Manish Giri
@Manish-Giri
Apr 14 2017 00:22
you don't see it still?
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:23
@GodKingShogun i looked
Manish Giri
@Manish-Giri
Apr 14 2017 00:23
@Lumexralph the only problem is, if you allow it in one place, you should do it everywhere else, and that's a huuuuge ass area
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 00:23
no idea how to fix it
David Amanze
@GodKingShogun
Apr 14 2017 00:23
my only hope left is @Manish-Giri :smile:
Manish Giri
@Manish-Giri
Apr 14 2017 00:23
lol
@Lumexralph is there
brb
Joshua Arnett
@josha5
Apr 14 2017 00:24
@Lumexralph total += myArr[i]
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:24
@josha5 yes
Joshua Arnett
@josha5
Apr 14 2017 00:24
Still giving me the reference error
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:24
@josha5 did you declare the variable total ?
Joshua Arnett
@josha5
Apr 14 2017 00:25
Yeah
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:25
@GodKingShogun let's see if I have mental energy for your issue, what's the problem?
@josha5 show your code
Joshua Arnett
@josha5
Apr 14 2017 00:25
Holdon I'm gonna try refreshing my browser this is driving memad
Yup that worked..I hate FCC sometimes lol thanks for the help
David Amanze
@GodKingShogun
Apr 14 2017 00:26
@Lumexralph it is this function i created
function colorToClick(){
  console.log(this);
    var counter=0;
  var sequence=[];
 for(var i=0; i<=20; i++) {
sequence.push(Math.ceil(Math.random()*4));
  }
  var playSequence=false;
  var sequenceEvent=[];
   for (var j=0; j<sequence.length; j++){
      if (!playSequence){
  sequenceEvent= sequenceEvent.concat(sequence[j]);
      playSequence=true; 
    if (playSequence===true) {
for (var k=0; k<sequenceEvent.length; k++) {
  if (sequenceEvent[k]===1){  
  setTimeout(function(){
 $("#red").animate({opacity:".5"},1000).animate({opacity:"1"},1000);
  redSound.play();
  },2000*k);
      } else if(sequenceEvent[k]===2){
   setTimeout(function(){
  $("#blue").animate({opacity:".5"},1000).animate({opacity:"1"},1000);
    blueSound.play();
   },2000*k);
      }else if (sequenceEvent[k]===3){
  setTimeout(function(){
 $("#yellow").animate({opacity:".5"},1000).animate({opacity:"1"},1000);
   yellowSound.play();
  },2000*k);
  } else if(sequenceEvent[k]===4){
   setTimeout(function(){
 $("#green").animate({opacity:".5"},1000).animate({opacity:"1"},1000);
 greenSound.play();
   },2000*k);
 }
  clearTimeout();
} 
      playSequence=false;
 }
}
}
};
@Lumexralph and this is my issue. right now i want to get the sequence down. so on the first iteration i want a sound and a button to blink and on the second iteration i want the previous iteration and the current iteration to happen and on the third iteration i want the first second and current iteration to go and so forth until the 20th time.
@Lumexralph but it is all over the place and most importantly i have made little progress in 2 days :cry:
@Lumexralph i going to go eat dinner now but shout me out if you have any idea
@Lumexralph be back in 5 mins
Connor Yanz
@cmy235
Apr 14 2017 00:32
I'm wondering if someone can help answer my question about the usability of regex -- specifically, can I use as part of a an action on an array, like filtering an array?

I'm trying to filter out everything in an array that isn't alpha-Numeric, so I set newArray = oldArray.filter(function(i) {
return i != /^[a-zA-Z]+$/
})

but it's giving me issues... This might be totally the wrong way to use them, but I was trying to experiment. Can anyone point me in the right direction?

Vicky Lai
@vickylai
Apr 14 2017 00:35
Here's what I'm working on. I'm told I need a callback function - before I delve in to that, can anyone concur?
function placeBackground() {
    // Get background photo from Unsplash
    var photo = new UnsplashPhoto();
    photo.all()
        .of('cityName')
        .fetch();

var bgpic = photo.url;

console.log(bgpic);

console.log(photo);

// If UnsplashPhoto not found, an image with this in the URL is returned: photo-1446704477871-62a4972035cd
// If the returned image has this in the URL, use this URL instead: https://source.unsplash.com/random
var data = JSON.parse(request.response);

        if (data.includes("photo-1446704477871-62a4972035cd")) {
            console.log('Hi here i am');
            document.body.style.background = 'url(https://source.unsplash.com/random) no-repeat center center fixed';
            document.body.style.backgroundSize = 'cover';
        }
        else {
            document.body.style.background = 'url('+bgpic+') no-repeat center center fixed';
            document.body.style.backgroundSize = 'cover';
        }
    // TODO fade in 
} // end placeBackground

placeBackground();
Manish Giri
@Manish-Giri
Apr 14 2017 00:39

@GodKingShogun the first flaw I can think of is this -

 for(var i=0; i<=20; i++) {
sequence.push(Math.ceil(Math.random()*4));
  }

this is in your colorToClick() function, going by the name, this function will be called each time the computer will choose a button to press next?

let me know if that's the case
Jianhao Tan
@jaanhio
Apr 14 2017 00:42
function getIndexToIns(arr, num) {
  arr = arr.push(num);
  var sortedArr = arr.sort(function(a, b){
    return a-b;
  });
may i know why i can’t sort arr ?
Ogundele Olumide
@Lumexralph
Apr 14 2017 00:43
@jaanhio because you have a number stored in arr
@jaanhio arr = arr.push(num); push returns the new length of arr after the push
@jaanhio the side effect created is adding num to arr, best thing to do is arr.push(num);
Jianhao Tan
@jaanhio
Apr 14 2017 00:49
@Lumexralph ok i got that. thank you! :smile:
CamperBot
@camperbot
Apr 14 2017 00:49
jaanhio sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1512 | @lumexralph |http://www.freecodecamp.com/lumexralph
aRtoo
@artoodeeto
Apr 14 2017 00:52
hi guys . i have a quick question. how did i get this right. title of the problem is "Return Early Pattern for Functions" or problem 206

// Setup
function abTest(a, b) {
  // Only change code below this line

  if (a < 0 || b < 0){
   return  c;
  }


  // Only change code above this line

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

// Change values below to test your code
abTest(-2,2);
Upkar Lidder
@lidderupk
Apr 14 2017 00:54
Looking for code review of the Chunky Monkey problem under algorithms. It passes all tests. Looking for feedback on readability and performance. Thank you all.
function chunkArrayInGroups(arr, size) {
  var result = [];
  var count = 0;

  //divide into chunks of size 'size' until no more elements left
  while(count < arr.length){
    result.push(arr.slice(count,count + size));  
    count = count + size;
  }

  //push the remaining elements as it's own array at the end
  if(count < arr.length){
    result.push(arr.slice(count, arr.length));
  }

  return result;
}
Manish Giri
@Manish-Giri
Apr 14 2017 00:59
@artoodeeto what is c?
Roxroy
@roxroy
Apr 14 2017 01:00
@lidderupk , arr.length is calculated each time it loop, You can create a variable, size, outside the look and check if count < size
Eric Long
@ejlong90
Apr 14 2017 01:00

Ok, so I am trying to get through this challenge "Testing Objects for Properties' and it is asking me to -- Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".

this is what i have


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

function checkObj(checkProp) {
  myObj.hasOwnProperty("gift");// Your Code Here
  myObj.hasOwnProperty("pet");
  myObj.hasOwnProperty("house");

  return "Not Found";
}

// Test your code by modifying these values
checkObj("gift");
where have i gone wrong it is returning the Not Found
Manish Giri
@Manish-Giri
Apr 14 2017 01:01
@ejlong90 you need to use checkProp
Aaron Bell
@awb715
Apr 14 2017 01:01
@revisualize are you at the event?
Manish Giri
@Manish-Giri
Apr 14 2017 01:01
instead of each particular property
use an if statement
Gulsvi
@gulsvi
Apr 14 2017 01:01

@lidderupk Your solution works great, but no need for that last part

  //push the remaining elements as it's own array at the end
  if(count < arr.length){
    result.push(arr.slice(count, arr.length));
  }

And, this: count = count + size; can be count += size

Eric Long
@ejlong90
Apr 14 2017 01:03

@Manish-Giri


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

function checkObj(checkProp) {
  myObj.hasOwnProperty(checkProp);// Your Code Here
  myObj.hasOwnProperty(checkProp);
  myObj.hasOwnProperty(checkProp);

  return "Not Found";
}

// Test your code by modifying these values
checkObj("gift");

still confused lol

Manish Giri
@Manish-Giri
Apr 14 2017 01:05
@ejlong90 use an if statement
which checks if the property checkProp exists
how else will you decide what to return?
Eric Long
@ejlong90
Apr 14 2017 01:05
i see @Manish-Giri
Upkar Lidder
@lidderupk
Apr 14 2017 01:09
Thanks @SkyCoder01
CamperBot
@camperbot
Apr 14 2017 01:09
lidderupk sends brownie points to @skycoder01 :sparkles: :thumbsup: :sparkles:
:star2: 1033 | @skycoder01 |http://www.freecodecamp.com/skycoder01
Eric Long
@ejlong90
Apr 14 2017 01:12
@Manish-Giri getting errors for this, somewhere there is an issue

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

function checkObj(checkProp) {
if(myObj.hasOwnProperty("checkProp")
{return myObj[checkProp];}
return "Not Found" ; }

// Test your code by modifying these values
checkObj("gift");
Manish Giri
@Manish-Giri
Apr 14 2017 01:12
@ejlong90 hasOwnProperty("checkProp")
remove quotes
Stephen James
@sjames1958gm
Apr 14 2017 01:17
@GodKingShogun See if this is a little easier to work with.

var sounds = {
  "red" : redSound,
  "blue" : blueSound,
  "yellow" : yellowSound,
  "green" : greenSound,

}

var colors = ["red", "blue", "yellow", "green"]

function play(color) {
  $("#" + color)
    .animate({opacity:".5"},1000)
    .animate({opacity:"1"},1000);
  sounds[color].play();
}

function playSequence(sequence, index) {
  if (index < sequence.length) {
    setTimeout(function(){
        play(colors[sequence[index]]);
        index++;
        playSequence(sequence, index);
      }, 2000);
  }
}

function colorToClick(){
  playSequence(sequence, 0);
}
@artoodeeto that works because an uninitialized variable is undefined, but return undefined; would be more explicit
Eric Long
@ejlong90
Apr 14 2017 01:23
got it @Manish-Giri thank you
CamperBot
@camperbot
Apr 14 2017 01:23
ejlong90 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 5152 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Apr 14 2017 01:25
@ejlong90 :+1:
MR-Em
@MR-Em
Apr 14 2017 01:26
does anyone know why my js is saving in the same file as css when i don't want it to
think i fixed it no worries
Dalton Escoe
@Alenero129
Apr 14 2017 01:29
Hey guys. I need some help with the destroyer algorithm challenge. The argument being passed isn't a multidimensional array. I have no idea how to access the values outside the []. How to access 2 and 3 at the end of this array: destroyer([1, 2, 3, 1, 2, 3], 2, 3);?
Ogundele Olumide
@Lumexralph
Apr 14 2017 01:29
@Manish-Giri phewww!
@Alenero129 use argument array-like object
Dalton Escoe
@Alenero129
Apr 14 2017 01:34
@Lumexralph I still don't understand what to do with it.
David Amanze
@GodKingShogun
Apr 14 2017 01:37
@sjames1958gm i dont fully understand what is going on in the playSequence function
Dalton Escoe
@Alenero129
Apr 14 2017 01:39
@Lumexralph Oh. Much Thanks. That was my bad. I wasn't reading.
CamperBot
@camperbot
Apr 14 2017 01:39
alenero129 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1513 | @lumexralph |http://www.freecodecamp.com/lumexralph
Stephen James
@sjames1958gm
Apr 14 2017 01:40
@GodKingShogun If there are more in the sequence to play (index < sequence.length) then it does a setTimeout for that entry
Then inside the set timeout it moves to the next entry and calls the function to start the next timeout
I did not debug this, tried to take what you and remove some of the redundancy.
I think when index = sequence.length there might be a flag that needs to be set?
@Alenero129 The arguments object is like an array and holds all the parameters (not just the named ones)
arguments[0] === arr while arguments[1] and beyond are the remaining values
anastasiapathos
@anastasiapathos
Apr 14 2017 01:41
can someone help me find the correct way to use the backslashes for escape sequence?
Stephen James
@sjames1958gm
Apr 14 2017 01:42
@anastasiapathos \n is newline \\ is for backslash
anastasiapathos
@anastasiapathos
Apr 14 2017 01:42
var myStr = Firstline \n \ SecondLine \ \r ThirdLine; // Change this line
I have this but I know it's not right.
Stephen James
@sjames1958gm
Apr 14 2017 01:42
@anastasiapathos remove the spaces for one thing - and FirstLine not Firstline
anastasiapathos
@anastasiapathos
Apr 14 2017 01:42
FirstLine
\SecondLine\
ThirdLine
its supposed to come out like that
Stephen James
@sjames1958gm
Apr 14 2017 01:43
@anastasiapathos Yeah that is misleading because you wont see it like that
anastasiapathos
@anastasiapathos
Apr 14 2017 01:43
thank you
Ogundele Olumide
@Lumexralph
Apr 14 2017 01:43
@anastasiapathos \\
David Amanze
@GodKingShogun
Apr 14 2017 01:43
@sjames1958gm what about this section
play(colors[sequence[index]]);
Dalton Escoe
@Alenero129
Apr 14 2017 01:43
@anastasiapathos Just put the backslach after whatever sequence you're trying to escape eg. \=\
anastasiapathos
@anastasiapathos
Apr 14 2017 01:44
so no spaces at all?
Dalton Escoe
@Alenero129
Apr 14 2017 01:44
@anastasiapathos None
\=\
Stephen James
@sjames1958gm
Apr 14 2017 01:44
@GodKingShogun Assuming that sequence is a list of indexes to colors.
colors[sequence[index]] will be one of "red", "blue", etc which is used in the play function above
Dalton Escoe
@Alenero129
Apr 14 2017 01:45
@anastasiapathos \=\\
Stephen James
@sjames1958gm
Apr 14 2017 01:45
@GodKingShogun The array and object at the top allows the code to not directly reference the colors, or audio objects.
anastasiapathos
@anastasiapathos
Apr 14 2017 01:46
var myStr=FirstLine\n\SecondLine\\rThirdLine; so what do I need to change off this? I'm still a little confused
Stephen James
@sjames1958gm
Apr 14 2017 01:46
@anastasiapathos You need " " aaround this to make it a string
anastasiapathos
@anastasiapathos
Apr 14 2017 01:46
thank you!
went through now, thanks
Stephen James
@sjames1958gm
Apr 14 2017 01:47
@GodKingShogun Hmm, I just realized your sequence values are 1 - 4 you may need
var colors = ["", "red", "blue", "yellow", "green"]
@anastasiapathos :checkered_flag:
ROBUSTO8
@ROBUSTO8
Apr 14 2017 01:49

this challenge is driving me insane..."Chunky Monkey" can someone point out to what is wrong here, ive reached my limit...:

function chunkArrayInGroups(arr, size) {
var chunks = [];
var i = 0;
while (i < arr.length) {
chunks.push(arr.slice(0, size));
i+=size;
}
return chunks;
}

Ogundele Olumide
@Lumexralph
Apr 14 2017 01:51
@ROBUSTO8 you should slice starting at i and ending at i + size
ROBUSTO8
@ROBUSTO8
Apr 14 2017 01:51
thanks @Lumexralph
CamperBot
@camperbot
Apr 14 2017 01:51
robusto8 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1514 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Apr 14 2017 01:52
@ROBUSTO8 :smile:
Eric Long
@ejlong90
Apr 14 2017 01:57
ok 20 minutes later i have another issue
Accessing Nested Objects
Instructions
Access the myStorage object and assign the contents of the glove box property to the gloveBoxContents variable. Use bracket notation for properties with a space in their name.

// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

// Only change code below this line

myStorage.car.inside["glove box"];
var gloveBoxContents = "maps";// Change this line
what am i doing wrong, i feel im doing what it asks
David Amanze
@GodKingShogun
Apr 14 2017 01:57
@sjames1958gm on the second iteration i feel like it is only going to play the second iteration instead of playing the first and the second iteration
Ogundele Olumide
@Lumexralph
Apr 14 2017 01:57
@ejlong90 myStorage.car.inside["glove box"]; will give the maps value
@ejlong90 store myStorage.car.inside["glove box"]; in the gloveBoxContents variable
Eric Long
@ejlong90
Apr 14 2017 01:58
so reverse it?
Stephen James
@sjames1958gm
Apr 14 2017 01:58
@GodKingShogun This is supposed to play the full sequence once. the call to playSequence(sequence, 0) plays the current sequence
Eric Long
@ejlong90
Apr 14 2017 01:58
@Lumexralph
Ogundele Olumide
@Lumexralph
Apr 14 2017 01:59
@ejlong90 try it out
Stephen James
@sjames1958gm
Apr 14 2017 01:59
@ejlong90 myStorage.car.inside["glove box"]; what is the value of this?
Eric Long
@ejlong90
Apr 14 2017 02:00
got the same out put @Lumexralph
"maps" @sjames1958gm
Stephen James
@sjames1958gm
Apr 14 2017 02:01
@ejlong90 Exactly - so use that on the right side of the assignment not the string "maps"
@ejlong90 gloveBoxContents is supposed to get the value through the evaluation of the object access not by direct assignment to "maps"
Eric Long
@ejlong90
Apr 14 2017 02:04
ooooooooooohhhhhhhhh LOL thank you @sjames1958gm and @Lumexralph I got it
CamperBot
@camperbot
Apr 14 2017 02:04
ejlong90 sends brownie points to @sjames1958gm and @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 6693 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 1515 | @lumexralph |http://www.freecodecamp.com/lumexralph
alfredim88
@alfredim88
Apr 14 2017 02:04
hey guys
need help here
I think I got it right

function mutation(arr) {
var secondPart = [];
var firstPart = [];

firstPart = arr.slice(0,1).toString().toLowerCase();
secondPart = arr.slice(1).toString().toLowerCase();

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

if (firstPart.indexOf(secondPart.charAt(i)) >= 0){

return true;

} else    

return false;
}
}

mutation(["hello", "hey"]);

this one is the only wrong : mutation(["hello", "hey"]) should return false.
anyone?
stormfighter123
@stormfighter123
Apr 14 2017 02:07
hello
i need help on the make object properties private javascript challenge
Hello
Ogundele Olumide
@Lumexralph
Apr 14 2017 02:08
@alfredim88 why don't you try returning false in the loop if there's no character in firstPart from secondPart ?
@stormfighter123 what have you tried?
alfredim88
@alfredim88
Apr 14 2017 02:09
trying
David Amanze
@GodKingShogun
Apr 14 2017 02:11
@sjames1958gm i just tried your code and this is the result i had two days ago. it is blinking and playing the sound once each but i need it to play the first sequence, increment by one, and then play the sequence from the beginning :cry:
Jianhao Tan
@jaanhio
Apr 14 2017 02:12
is it possible to convert an array of characters e.g [“a”, “b”, “c”,…] into individual char codes?
Stephen James
@sjames1958gm
Apr 14 2017 02:12
@GodKingShogun What does your sequence array contain?
stormfighter123
@stormfighter123
Apr 14 2017 02:12
@Lumexralph nvm i got it
David Amanze
@GodKingShogun
Apr 14 2017 02:12
@sjames1958gm so on first iteration red and second iteration red blue and on third iteration red blue green and on fourth iteration red blue green blue
Stephen James
@sjames1958gm
Apr 14 2017 02:12
@jaanhio You mean into an array of char codes?
David Amanze
@GodKingShogun
Apr 14 2017 02:12
@sjames1958gm 20 random numbers ranging from 1-4
Stephen James
@sjames1958gm
Apr 14 2017 02:13
@GodKingShogun Oh, so the array already is filled in - I thought you were adding to it each time.
Jianhao Tan
@jaanhio
Apr 14 2017 02:13
@sjames1958gm ah yes -> [“65”,”66”,”67”]
daiwik
@daiwik
Apr 14 2017 02:14
why isnt my solution working?
https://www.freecodecamp.com/challenges/profile-lookup#?solution=%0A%2F%2FSetup%0Avar%20contacts%20%3D%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Akira%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Laine%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220543236543%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Pizza%22%2C%20%22Coding%22%2C%20%22Brownie%20Points%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Harry%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Potter%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220994372684%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Hogwarts%22%2C%20%22Magic%22%2C%20%22Hagrid%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Sherlock%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Holmes%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220487345643%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Intriguing%20Cases%22%2C%20%22Violin%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Kristian%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Vos%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%22unknown%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Javascript%22%2C%20%22Gaming%22%2C%20%22Foxes%22%5D%0A%20%20%20%20%7D%0A%5D%3B%0A%0A%0Afunction%20lookUpProfile(firstName%2C%20prop)%7B%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0A%20%20for(var%20i%20%3D%200%3Bi%20%3C%20contacts.length%3Bi%2B%2B)%7B%0A%20%20%20%20if(contacts%5Bi%5D.firstName%20%3D%3D%3D%20firstName)%7B%20%20%20%20%20%20%0A%20%20%20%20%20%20if(contacts%5Bi%5D.hasOwnProperty(prop))%7B%0A%20%20%20%20%20%20%20%20return%20contacts%5Bi%5D%5Bprop%5D%3B%0A%20%20%20%20%20%20%7Delse%7B%0A%20%20%20%20%20%20%20%20return%20%22No%20such%20property%22%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7Delse%7B%0A%20%20%20%20%20%20return%20%22No%20such%20contact%22%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%0A%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%0A%2F%2F%20Change%20these%20values%20to%20test%20your%20function%0AlookUpProfile(%22Sherlock%22%2C%20%22likes%22)%3B%0A
Stephen James
@sjames1958gm
Apr 14 2017 02:14
@jaanhio Best way is to use array.map - arr.map(function(c) { return c.charCodeAt(0); });
this will return an array of char codes
Ogundele Olumide
@Lumexralph
Apr 14 2017 02:14
@alfredim88 if (firstPart.indexOf(secondPart.charAt(i)) === -1) if so return false or return true when the loop is done, outside the loop which means all characters are present
@daiwik can you paste the code here?
Stephen James
@sjames1958gm
Apr 14 2017 02:15
@daiwik Possible because you return no such contact before checking all the contacts?
If you always return when you match a firstName what does it mean to exit the loop
David Amanze
@GodKingShogun
Apr 14 2017 02:15
@sjames1958gm that was how i had my original idea. i would loop through my sequence and during that loop i would concat the current element to a new array which would then be looped through and so forth until i concat the last element in my sequence array
stormfighter123
@stormfighter123
Apr 14 2017 02:15
@Lumexralph can you help me on condense arrays with reduce
Stephen James
@sjames1958gm
Apr 14 2017 02:15
@GodKingShogun You can add another parameter to playSequence which is the end index. Then use that instead of sequence.length in the function
daiwik
@daiwik
Apr 14 2017 02:16
thanks @sjames1958gm
CamperBot
@camperbot
Apr 14 2017 02:16
daiwik sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6694 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Ogundele Olumide
@Lumexralph
Apr 14 2017 02:16
@stormfighter123 okay
Jianhao Tan
@jaanhio
Apr 14 2017 02:16
function rot13(str) { // LBH QVQ VG! var charArr = str.split(""); charArr.map(function(c){ return c.charCodeAt(0); }); return charArr; }
hmmm but charArr still returns the character array
Stephen James
@sjames1958gm
Apr 14 2017 02:16
@daiwik :+1:
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:16
starting to get a little bit frustrated
stormfighter123
@stormfighter123
Apr 14 2017 02:16
@Lumexralph i don't know what to do
Ogundele Olumide
@Lumexralph
Apr 14 2017 02:16
@HeebieGeeBee why?
Stephen James
@sjames1958gm
Apr 14 2017 02:16
@jaanhio map returns a new array
Ogundele Olumide
@Lumexralph
Apr 14 2017 02:17
@stormfighter123 show your code and what you're trying to do
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:17
stuff with my app thing not work proper
with the http post
stormfighter123
@stormfighter123
Apr 14 2017 02:17

Condense arrays with reduce

The array method reduce is used to iterate through an array and condense it into one value.
To use reduce you pass in a callback whose arguments are an accumulator (in this case, previousVal) and the current value (currentVal).
The accumulator is like a total that reduce keeps track of after each operation. The current value is just the next element in the array you're iterating through.
reduce has an optional second argument which can be used to set the initial value of the accumulator. If no initial value is specified it will be the first array element and currentVal will start with the second array element.
Here is an example of reduce being used to subtract all the values of an array:
var singleVal = array.reduce(function(previousVal, currentVal) {
return previousVal - currentVal;
}, 0);
Use the reduce method to sum all the values in array and assign it to singleVal.

my code

var array = [4,5,6,7,8];
var singleVal = 0;

// Only change code below this line.

singleVal = array.reduce(function(previousVal, currentVal) {
return previousVal - currentVal;
}, 0);

Stephen James
@sjames1958gm
Apr 14 2017 02:17
@GodKingShogun
function colorToClick(){
  playSequence(sequence, 0, currentLength); // something like this
}
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:17
anyone happened to use the body parser node package?
Stephen James
@sjames1958gm
Apr 14 2017 02:18
@HeebieGeeBee I did in one of the FCC challenges
Ogundele Olumide
@Lumexralph
Apr 14 2017 02:18
@stormfighter123 you're to sum so do previousVal + currentVal
Jianhao Tan
@jaanhio
Apr 14 2017 02:19
@sjames1958gm how should i do it? my plan was to convert the string given to array, convert the characters array to ascii code, +13 to every sinlge value and convert back to string with string.fromCharCode();
stormfighter123
@stormfighter123
Apr 14 2017 02:20
@Lumexralph thanks
CamperBot
@camperbot
Apr 14 2017 02:20
stormfighter123 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1516 | @lumexralph |http://www.freecodecamp.com/lumexralph
Stephen James
@sjames1958gm
Apr 14 2017 02:20
@jaanhio NOt a bad plan
var codeArray = charArr.map(function(c){ return c.charCodeAt(0); });
But you need to save the response to map as it creates a new array then you can operator on that
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:20
@sjames1958gm my body keeps coming up with an empty object
Bryan Reese
@breese8009
Apr 14 2017 02:20
quick question... why does this return this way with an array of nulls.? its doing what i want to the string but the array of nulls with it i dont get?
function myReplace(str, before, after) {
  var emptyArr=[];
  var me=str.split(' ').map(function(arrWords){
    if(arrWords===before){
      return str.replace(before,after);
    }
  });
return me;
}

myReplace("Let us go to the store", "store", "mall"); //   [null,null,null,null,null,"Let us go to the mall"]
stormfighter123
@stormfighter123
Apr 14 2017 02:20
@Lumexralph nooo
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:20
when ever i make an http post
stormfighter123
@stormfighter123
Apr 14 2017 02:20
@Lumexralph did i lose browni points?
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:21
but the success callback works fine
and the object im sending seems to be fine
Stephen James
@sjames1958gm
Apr 14 2017 02:21
@breese8009 YOu need to return something on the else or it returns undefined
@HeebieGeeBee Which FCC project is this?
Bryan Reese
@breese8009
Apr 14 2017 02:21
@sjames1958gm thats why im gettin an array of nulls?
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:21
@sjames1958gm its not an fcc project
Stephen James
@sjames1958gm
Apr 14 2017 02:22
@breese8009 I think so. Do you have one string in there
Bryan Reese
@breese8009
Apr 14 2017 02:23
@sjames1958gm im not sure i understand ur questions
stormfighter123
@stormfighter123
Apr 14 2017 02:23
excuse me
Bryan Reese
@breese8009
Apr 14 2017 02:23
question*
Stephen James
@sjames1958gm
Apr 14 2017 02:24

@breese8009 Look at your output it is nulls then the whole string.
you need to return arrWords when you are not replacing and after when you are.

if (arrWords === before) return after;
else return arrWords;

Then return me.join(" " )

David Amanze
@GodKingShogun
Apr 14 2017 02:25
@sjames1958gm im not sure i fully understand
aRtoo
@artoodeeto
Apr 14 2017 02:25
need help sir. im on the problem "Counting Card" i think i figured out the solution but theres a specific value that return the wrong ans. need help please.

var count = 0; 
var shit;


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


    switch (card){
      case 2:
      case 3:
      case 4:
      case 5:
      case 6:
        count ++;
        break;

      case 10:
      case 'J':
      case 'Q':
      case 'K':
      case 'A':
        count --;
        break;



    }

  if( count > 1){
   shit = count + " " + "Bet";
  }

  else if (count < 1){
    shit = count + " " + "Hold";
  }



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

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc('J'); cc(9); cc(2); cc(7);  //this is the value that returning the wrong ans. help!!
Joseph
@revisualize
Apr 14 2017 02:26
Anyone want to attend the SeattleJS meetup via Live Stream?
https://www.youtube.com/watch?v=edexCsK7K-c
Stephen James
@sjames1958gm
Apr 14 2017 02:26
@artoodeeto Use count > 0 not count > 1
Ogundele Olumide
@Lumexralph
Apr 14 2017 02:26
@artoodeeto check if count is positive or negative count > 0
Stephen James
@sjames1958gm
Apr 14 2017 02:26
@artoodeeto then you can use else (not else if)
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:27
@revisualize you there?
ive actually seen redneks live
Bryan Reese
@breese8009
Apr 14 2017 02:28
@sjames1958gm ok i see it, ty
CamperBot
@camperbot
Apr 14 2017 02:28
:star2: 6695 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Apr 14 2017 02:28
@GodKingShogun
this assumes that currentCount is the number of turns to play. Somewhere else currentCount is set
function playSequence(sequence, index, count) {
  if (index < count) {
    setTimeout(function(){
        play(colors[sequence[index]]);
        index++;
        playSequence(sequence, index);
      }, 2000);
  }
}

function colorToClick(){
  playSequence(sequence, 0, currentCount);
}
CamperBot
@camperbot
Apr 14 2017 02:28
breese8009 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
Stephen James
@sjames1958gm
Apr 14 2017 02:28
@breese8009 :+1:
Joseph
@revisualize
Apr 14 2017 02:28
@HeebieGeeBee I am.
Bryan Reese
@breese8009
Apr 14 2017 02:28
@sjames1958gm i wanna show u something werid tho
function myReplace(str, before, after) {
  var emptyArr=[];
  var me=str.split(' ').map(function(arrWords){
    if(arrWords===before){
      return str.replace(before,after);
    } 
  });
return me.join(" ");

}

myReplace("Let us go to the store", "store", "mall");
Joseph
@revisualize
Apr 14 2017 02:28
@HeebieGeeBee Are you watching?
Bryan Reese
@breese8009
Apr 14 2017 02:28
that acutally give the right output
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:28
@revisualize yeah
Bryan Reese
@breese8009
Apr 14 2017 02:28
but it doesnt pass
Stephen James
@sjames1958gm
Apr 14 2017 02:29
@revisualize cotton eyed joe?
Joseph
@revisualize
Apr 14 2017 02:29
@HeebieGeeBee I'm wearing a grey beanie hat and grey hoodie. I'm about to walk up and correct my email address for the slack invite.
Stephen James
@sjames1958gm
Apr 14 2017 02:29
You didn't face the camera
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:29
@revisualize i see'd you
Jianhao Tan
@jaanhio
Apr 14 2017 02:30
@sjames1958gm is there a good way to filter away the non alphabetic char?
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:30
you look shifty
Stephen James
@sjames1958gm
Apr 14 2017 02:30
@jaanhio Compare the charCode to A - Z
@jaanhio I did var A = "A".charCodeAt(0); so that A variable was the char code for "A" and I didn't have to rememeber
aRtoo
@artoodeeto
Apr 14 2017 02:31
@sjames1958gm i cant use else alone because theres an argument
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:32
@revisualize you controlling the cam?
Joseph
@revisualize
Apr 14 2017 02:32
no
Stephen James
@sjames1958gm
Apr 14 2017 02:32
@breese8009 That code is going to return undefined for each entry in the array that is not === before
then it is going to return the whole string subsituted.
if you use str.replace you don't need to map
if you use the map then you should just return arrWords or after depending on the if
Jianhao Tan
@jaanhio
Apr 14 2017 02:33
@sjames1958gm
im lost haha. i tried this and realize i need to filter out more than just charCode = 32.
var codeArr13 = codeArr.map(function(x){
    if(x == 32){
      return x;
    }
    else{
      return x+13;
    }
  });
Stephen James
@sjames1958gm
Apr 14 2017 02:33
@artoodeeto Sure you can
if (count > 0) {
/// do Bet
} else {
/// do Hold
}
Bryan Reese
@breese8009
Apr 14 2017 02:33
@sjames1958gm ah ha
i see
thank u again
Stephen James
@sjames1958gm
Apr 14 2017 02:33
@breese8009 yw
@jaanhio INside the map (here is some pseudo code )
if (x >= A and x <= M) return x + 13
else if (x >= N and x <= Z) return x - 13
else return x
juni
@junipberry
Apr 14 2017 02:35
Hello everyone
Jianhao Tan
@jaanhio
Apr 14 2017 02:35
@junipberry hello!
Stephen James
@sjames1958gm
Apr 14 2017 02:35
@revisualize It appears your face does have a left side.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:35
@junipberry :wave:
Jianhao Tan
@jaanhio
Apr 14 2017 02:35
@sjames1958gm ok lemme try it
Stephen James
@sjames1958gm
Apr 14 2017 02:35
@junipberry :wave:
juni
@junipberry
Apr 14 2017 02:35
:D
Joseph
@revisualize
Apr 14 2017 02:35
@sjames1958gm me?
Stephen James
@sjames1958gm
Apr 14 2017 02:35
@jaanhio gl
juni
@junipberry
Apr 14 2017 02:36
How is everyone doing
Stephen James
@sjames1958gm
Apr 14 2017 02:36
@revisualize yes - your avatar photo has you peering in from the right of the picture
@junipberry Good
Joseph
@revisualize
Apr 14 2017 02:36
@sjames1958gm Oh, let me upload a picture from earlier today.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:36
@junipberry slightly frustrated
but fine
aRtoo
@artoodeeto
Apr 14 2017 02:36
@sjames1958gm im getting an error
juni
@junipberry
Apr 14 2017 02:37
lol I know the feeling @HeebieGeeBee .. I'd like to help but I know I prob can't
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:37
@junipberry how are you?
aRtoo
@artoodeeto
Apr 14 2017 02:37
@sjames1958gm ohh yea. right right
juni
@junipberry
Apr 14 2017 02:37
feeling good today~ tomorrow is Friday!
David Amanze
@GodKingShogun
Apr 14 2017 02:37
@sjames1958gm so would i set currentCount to var currentCount=20; since that is the number of turns in the game
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:38
sweet
Joseph
@revisualize
Apr 14 2017 02:38
@sjames1958gm My co-worker took this photo of me earlier today.
20170413_165950_001.jpg
juni
@junipberry
Apr 14 2017 02:39
just had an early dinner and trying to go back to figuring out these algorithms lol
Stephen James
@sjames1958gm
Apr 14 2017 02:39
@GodKingShogun @GodKingShogun currentCount is the number of entries in sequence you want to play
1 then 2 then 3 i guess
@revisualize Are you hiding behind the sofas?
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:39
@junipberry cool, what did you have?
Akshat Bahety
@akshatbahety
Apr 14 2017 02:40
Hey
juni
@junipberry
Apr 14 2017 02:40
chicken!
Akshat Bahety
@akshatbahety
Apr 14 2017 02:40
Can someone help we with madlibs problem
juni
@junipberry
Apr 14 2017 02:41
grilled breasts w some mashed potatoes and veg
nothing exciting
lol
Akshat Bahety
@akshatbahety
Apr 14 2017 02:41
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
  var result = "";
  // Your code below this line
  result = myNoun + myAdjective + myAdverb + myVerb;


  // Your code above this line
  return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly","cat", "little", "hit", "slowly");
wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:42
@junipberry still nice though
Akshat Bahety
@akshatbahety
Apr 14 2017 02:42
these conditions are needed to be met
juni
@junipberry
Apr 14 2017 02:42
but did a double take on that ice cream muhaha
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:42
lol
@akshatbahety you need to add some spaces
Jianhao Tan
@jaanhio
Apr 14 2017 02:43
its Friday morning over here! :satisfied:
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:43
separated by non-word characters <<< @akshatbahety
Akshat Bahety
@akshatbahety
Apr 14 2017 02:43
@HeebieGeeBee ok
Manish Giri
@Manish-Giri
Apr 14 2017 02:43
gosh I'd kill for some fried chicken
Wolfaction
@Wolfaction
Apr 14 2017 02:43
var myStr = "FirstLine\n\SecondLine\\rThirdLine"; // Change this line
Joseph
@revisualize
Apr 14 2017 02:44
@Manish-Giri I haz a taco.
Wolfaction
@Wolfaction
Apr 14 2017 02:44
What is wrong with that code that makes it appear literally as "Firstline\n\Secondline..."
Manish Giri
@Manish-Giri
Apr 14 2017 02:44
@revisualize what's in it :yum:
Akshat Bahety
@akshatbahety
Apr 14 2017 02:44
@HeebieGeeBee spaces between the wordBlank list or the string
juni
@junipberry
Apr 14 2017 02:44
Guys, I have a general question re: 'confirm the ending' do I apply the Polyfill compatibility code to it if I opt to use string.prototype.substring(); ?
Joseph
@revisualize
Apr 14 2017 02:44
@Manish-Giri Amazing.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:45
@akshatbahety between the parameters like myVerb + " " + myAd....
Akshat Bahety
@akshatbahety
Apr 14 2017 02:45
@HeebieGeeBee ok
Stephen James
@sjames1958gm
Apr 14 2017 02:45
@Wolfaction The challenge is misleading you will not get the three lines like they show in the example.
But you do need to have Line not lin
Akshat Bahety
@akshatbahety
Apr 14 2017 02:45
@HeebieGeeBee Thanks
CamperBot
@camperbot
Apr 14 2017 02:45
akshatbahety sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1301 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
juni
@junipberry
Apr 14 2017 02:45
since I would have a negative start
David Amanze
@GodKingShogun
Apr 14 2017 02:46
@sjames1958gm i think i am starting to understand. my final question is how i would then get the user to have to input in the same sequence that just played
Jianhao Tan
@jaanhio
Apr 14 2017 02:46
@sjames1958gm now how do i change the array of ascii codes to string? not sure if i can use the string.fromCharCode() method
Wolfaction
@Wolfaction
Apr 14 2017 02:46
@sjames1958gm ahh okay, thank you :)
CamperBot
@camperbot
Apr 14 2017 02:46
wolfaction sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6696 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Apr 14 2017 02:47
@jaanhio You can use map in reverse with String.fromCharCode() then join
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:47
@junipberry you want to set the length of the substring
Stephen James
@sjames1958gm
Apr 14 2017 02:47
@GodKingShogun You will have to track his clicks and compare to the sequence array
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:47
even with the negative start
Joseph
@revisualize
Apr 14 2017 02:47
@HeebieGeeBee this is crazy. Comcast is using JS to generate UI on set top boxes.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:48
@revisualize ive been hearing loads of things ppl using javscript for
that isnt straight web dev
how many breaks do you need
Manish Giri
@Manish-Giri
Apr 14 2017 02:50
I'll try to use JS to predict when my neighbor's cat is next gonna break-in in my apt
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:50
@Manish-Giri id start with an event listener
Stephen James
@sjames1958gm
Apr 14 2017 02:50
@revisualize Some of that is the stuff I work on - we sold comcast a modified Chrome browser that lets them stream content from the cloud
Jianhao Tan
@jaanhio
Apr 14 2017 02:51
@sjames1958gm i just realized something.
if (x >= A and x <= M) return x + 13
else if (x >= N and x <= Z) return x - 13
Joseph
@revisualize
Apr 14 2017 02:51
@sjames1958gm coo
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:51
@sjames1958gm so they would use that for a client set top box or summin?
Jianhao Tan
@jaanhio
Apr 14 2017 02:51
why return x+13 and return x-13 for another?
Stephen James
@sjames1958gm
Apr 14 2017 02:52
@jaanhio because lower letter are shifted up and upper letters are shifted down
Jason Luboff
@JLuboff
Apr 14 2017 02:52
Isn't Comcast the most hated service provider in the US? Or is that charter?
Stephen James
@sjames1958gm
Apr 14 2017 02:52
@HeebieGeeBee actually the broswer runs in the cloud and we stream the video/audio down to the set top box. Controls are streamed up
@JLuboff Time Warner maybe
Manish Giri
@Manish-Giri
Apr 14 2017 02:53
I think United is the most hated thing in US right now
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:53
@sjames1958gm oh i see
i dont believe how much news that united thing has made
Jianhao Tan
@jaanhio
Apr 14 2017 02:55
@sjames1958gm YES I GOT IT! thank you!
CamperBot
@camperbot
Apr 14 2017 02:55
jaanhio sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6697 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Joseph
@revisualize
Apr 14 2017 02:56
woot.
Awesome talk time!?
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:56
another big news story was a company in england had to stop selling a tshirt with that eeny meeny miney mo slogan on it, beucase ppl complained it was racist
Joseph
@revisualize
Apr 14 2017 02:56
React VR time.
Jason Luboff
@JLuboff
Apr 14 2017 02:57
Too much political correctness now a days. Too many millennials getting bothered by the littlest thing
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:57
yup @JLuboff
Joseph
@revisualize
Apr 14 2017 02:57
@JLuboff Are you watching SeattleJS live?
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:57
@Manish-Giri lol
mstellaluna
@mstellaluna
Apr 14 2017 02:57
@HeebieGeeBee it is because that song is racist.
Thinker2
@Thinker2
Apr 14 2017 02:58

working on "return early pattern for functions", having trouble with the instruction to have the function exit immediately with a value of Undefined. Especially confused about undefined
// Setup
function abTest(a, b) {
// Only change code below this line
if (a<0||b<0) {
}

// Only change code above this line

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

// Change values below to test your code
abTest(-2,2);

Joseph
@revisualize
Apr 14 2017 02:58
@Thinker2 IN your if block you need to return undefined
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:58
@mstellaluna only the racist one, theres loads of versions of it
Jason Luboff
@JLuboff
Apr 14 2017 02:58
@revisualize no, I'm at the gym lol
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:58
and the first versions weren't racist
mstellaluna
@mstellaluna
Apr 14 2017 02:58
Meh what can you do..
Jason Luboff
@JLuboff
Apr 14 2017 02:58
The version I know is catch a tiger by its toe....
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:59
and the slogan was referring to the guy in the walking dead
Joseph
@revisualize
Apr 14 2017 02:59
@HeebieGeeBee This ship is cool.
I'm excited about this stuff.
Ryan
@Ryankennedy77
Apr 14 2017 02:59
can anyone give some insight into the "profile lookup" challenge
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 02:59
@revisualize sweet
Joseph
@revisualize
Apr 14 2017 03:00

@Ryankennedy77 Gist by revisualize / FreeCodeCamp - Profile Lookup.js

We have an array of objects representing different people in our contacts lists.
Example: var contacts = [ { ... } , { ... } , { ... } , { ... } ];

Thinker2
@Thinker2
Apr 14 2017 03:00
@revisualize as in return "undefined";? like so?
function abTest(a, b) {
// Only change code below this line
if (a<0||b<0) {
return "undefined";
}
Usman Akram
@usmanakram1996
Apr 14 2017 03:00
how to check for uppercase letter using regular expression help plz
Joseph
@revisualize
Apr 14 2017 03:00
@usmanakram1996 A-Z
Usman Akram
@usmanakram1996
Apr 14 2017 03:00
thanks :)
@revisualize
Ryan
@Ryankennedy77
Apr 14 2017 03:01
@revisualize thank you!
CamperBot
@camperbot
Apr 14 2017 03:01
ryankennedy77 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3739 | @revisualize |http://www.freecodecamp.com/revisualize
Thinker2
@Thinker2
Apr 14 2017 03:01
JOseph @revisualize - I am confused becauuse the instructions specifically suggest that "undefined" be NOT a string.
Joseph
@revisualize
Apr 14 2017 03:01
@Thinker2 but, undefined isn't a string it is a keyword.
Claudio Restifo
@Marmiz
Apr 14 2017 03:02
@usmanakram1996
This is a pretty cool tool to help you visualize and learn a bit about regex
https://regex101.com/
Usman Akram
@usmanakram1996
Apr 14 2017 03:02
thanks :) @Marmiz
CamperBot
@camperbot
Apr 14 2017 03:02
:cookie: 837 | @marmiz |http://www.freecodecamp.com/marmiz
usmanakram1996 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
Manish Giri
@Manish-Giri
Apr 14 2017 03:05
@Marmiz is in the house, yo
Joseph
@revisualize
Apr 14 2017 03:05
@HeebieGeeBee I'm excited about this VR stuff.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:06
cool i dont really know much about it
never tried vr
Manish Giri
@Manish-Giri
Apr 14 2017 03:06
I hear good things about HD porn in VR
there was a gizmodo article about it, sometime back
Joseph
@revisualize
Apr 14 2017 03:06
SUUUURRRRRREE
Claudio Restifo
@Marmiz
Apr 14 2017 03:06
@Manish-Giri :astonished:
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:06
@Manish-Giri it will probably be the biggest market for vr
Claudio Restifo
@Marmiz
Apr 14 2017 03:07
:wave: campers!
Joseph
@revisualize
Apr 14 2017 03:07
I "heard" things about the adult entertainment industry too.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:07
@Marmiz :wave:
Darth Skywalker
@adityaparab
Apr 14 2017 03:07
Its like you control the scene ;)
Manish Giri
@Manish-Giri
Apr 14 2017 03:07
@HeebieGeeBee
x
-> #UnitedPassenger
Joseph
@revisualize
Apr 14 2017 03:08
OMG!
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:08
@Manish-Giri lol
Joseph
@revisualize
Apr 14 2017 03:08
I see a lot of people blaming United Airlines for this incident. However, it wasn't United Airlines that beat the guy up. It wasn't United Airlines that drug the guy off the plane. It was United Airlines that called the Police Department. The Police Department beat the guy and drug him off the plane. Chicago Department of Aviation Police officers beat the guy up. Just saying.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:08
@revisualize i bet if the sports broadcasters started offering this for live events that could be pretty huge
Thinker2
@Thinker2
Apr 14 2017 03:09
Thank you @revisualize
CamperBot
@camperbot
Apr 14 2017 03:09
thinker2 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3740 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Apr 14 2017 03:09
@HeebieGeeBee Dude. I have 56 photos of an apartment. All 360 photos
@HeebieGeeBee I'm going to take another 50 photos of another apartment soon.
Usman Akram
@usmanakram1996
Apr 14 2017 03:09
for this test case -> spinalCase("thisIsSpinalTap") should return "this-is-spinal-tap".
i tried this piece of code but i am not getting how to place a "-" before the uppercase letter instead this code replaced the UC letters with hyphen :/
```
Joseph
@revisualize
Apr 14 2017 03:10
@HeebieGeeBee 360 full VR apartment walk throughs.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:10
@revisualize it was united who thought they could just tell paying customers to get off the plane jsut becuase they wanted to give their employees seats though
Usman Akram
@usmanakram1996
Apr 14 2017 03:10
:point_up: April 14, 2017 8:09 AM
  var  re = new RegExp("[A-Z]","g"); 
      newstr = str.replace(re,'-');  
  newstr = newstr.toLowerCase();
  return newstr;
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:10
and then called the cops to drag him off the plane just cus he didnt want to
Jianhao Tan
@jaanhio
Apr 14 2017 03:11
for charCodeAt(index) method, what does the index really do? and how does it affect the results? what if index is not 0?
Ray
@RayRay97
Apr 14 2017 03:12

// Setup
function phoneticLookup(val) {
  var result = lookup[value];

  // Only change code below this line

  var value = val;

  var lookup = {

    "alpha": "Adams",

    "bravo": "Boston",

    "charlie": "Chicago",

    "delta": "Denver",

    "echo": "Easy",

    "foxtrot": "Frank",
  };

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

// Change this value to test
phoneticLookup("");

TypeError: Cannot read property 'undefined' of undefined

What am I doing wrong?

Joseph
@revisualize
Apr 14 2017 03:13
@RayRay97 You're trying to use variables before they are defined.
Ray
@RayRay97
Apr 14 2017 03:13
I have tried adding an empty property and set it to undefined but it doesn't work.
Usman Akram
@usmanakram1996
Apr 14 2017 03:13
@jaanhio in any string at an index of the letter i.e name -> m having index 1
for charCodeAt(index) will return a specific number for m
Jianhao Tan
@jaanhio
Apr 14 2017 03:13
@RayRay97 just replace lookup[value] to lookup[val]
Usman Akram
@usmanakram1996
Apr 14 2017 03:13
  • m having index 2
DJToners
@DJToners
Apr 14 2017 03:13

// Declare your variable here

var myGlobal =10 ;
function fun1(oopsGlobal) {
  // Assign 5 to oopsGlobal Here
  oopsGlobal = 5;
}

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
what am i doing wrong?
Joseph
@revisualize
Apr 14 2017 03:13
@jaanhio But, they can't use the variable before it has data.
Tejinder Mann
@TJTheRandomCoder
Apr 14 2017 03:13
Hello!
Can someone help me with the counting cards challenge?
Ray
@RayRay97
Apr 14 2017 03:14
I have tried that, still getting the same error @revisualize
Tejinder Mann
@TJTheRandomCoder
Apr 14 2017 03:14
I am completely lost with it
Joseph
@revisualize
Apr 14 2017 03:14
@RayRay97 Show me.
Usman Akram
@usmanakram1996
Apr 14 2017 03:14
@HeebieGeeBee thanks but i don't know how this link will serve
CamperBot
@camperbot
Apr 14 2017 03:14
:star2: 1302 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
usmanakram1996 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
Joseph
@revisualize
Apr 14 2017 03:14
@TJTheRandomCoder Counting Cards is a challenge where your function will receive a card parameter. You're supposed to increment or decrement the global count variable according to the card's value
If the value of the card parameter is 2, 3, 4, 5 or 6 you need to increment the global variable count.
If the value of the card parameter is 10, 'J', 'Q', 'K' or 'A' you need to decrement the global variable count.
...
Then the function will return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative.
The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
Tejinder Mann
@TJTheRandomCoder
Apr 14 2017 03:14
yes @revisualize
Joseph
@revisualize
Apr 14 2017 03:15
@TJTheRandomCoder There I've rewritten the instructions.
Ray
@RayRay97
Apr 14 2017 03:16
https://gyazo.com/b3956c185fc0a5bca2c901255c5b63f0
Tejinder Mann
@TJTheRandomCoder
Apr 14 2017 03:16
I'm still unaware as to how to tackle it @revisualize
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:16
@usmanakram1996 cus you can find when an upper case letter is sitting next to a lowercase letter and replace it with a dash, all within the replace method
Joseph
@revisualize
Apr 14 2017 03:16
@RayRay97 You're trying to access lookup before it has data.
Jianhao Tan
@jaanhio
Apr 14 2017 03:17
@usmanakram1996 sorry i still dun understand it
Joseph
@revisualize
Apr 14 2017 03:17
@RayRay97 Where you're trying to access lookup by assigning it to result it is undefined
Ray
@RayRay97
Apr 14 2017 03:18
This pisses me off, if you're supposed to change the code above the comment then why the heck do they add "// Only change code below this line"
Anyways thanks @revisualize
CamperBot
@camperbot
Apr 14 2017 03:19
rayray97 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3741 | @revisualize |http://www.freecodecamp.com/revisualize
Usman Akram
@usmanakram1996
Apr 14 2017 03:20
@HeebieGeeBee ri8 let me try
Joseph
@revisualize
Apr 14 2017 03:21
@RayRay97 You aren't supposed to change the var result = ""
@RayRay97 You're supposed to create the lookup object. Then reassign the result variable below the lookup object.
Jianhao Tan
@jaanhio
Apr 14 2017 03:22
var charArr = strArr.map(function(x){
    return x.charCodeAt(1);
  });

returns “null”,”null”,”null” from [“e”,”y”,”e”]

but if i change index to 0, it works fine.

HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:22
str = str.replace(/([A-Z])([a-z])/g, "$1 $2") @usmanakram1996
Joseph
@revisualize
Apr 14 2017 03:22
@RayRay97
  var lookup = {
    "alpha": "Adams",
    "bravo": "Boston",
    "charlie": "Chicago",
    "delta": "Denver",
    "echo": "Easy",
    "foxtrot": "Frank",
  };
   result = lookup[val];
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:23
that would put a space between anywhere there is an Uppercase sitting next to a lower case letter without sapce @usmanakram1996
Usman Akram
@usmanakram1996
Apr 14 2017 03:23
@HeebieGeeBee ahh i see thanks dude
CamperBot
@camperbot
Apr 14 2017 03:23
usmanakram1996 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:warning: usmanakram1996 already gave heebiegeebee points
Usman Akram
@usmanakram1996
Apr 14 2017 03:23
@HeebieGeeBee nice :D
Ray
@RayRay97
Apr 14 2017 03:23
That makes sense.
Joseph
@revisualize
Apr 14 2017 03:23
@RayRay97 If you see.. Nothing above or below the comment line was changed.
Usman Akram
@usmanakram1996
Apr 14 2017 03:23
now i get it :)
Joseph
@revisualize
Apr 14 2017 03:23
Okay. I got to leave this event.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:23
@revisualize yeah she told you all to get the feck out
@usmanakram1996 cant remember what way round and stuff you want it for the challenge and stuff it was just an example
Usman Akram
@usmanakram1996
Apr 14 2017 03:26
@HeebieGeeBee no i really wanted this exactly for this challenge https://www.freecodecamp.com/challenges/spinal-tap-case
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:28
@usmanakram1996 yes but i couldnt remember if you want it uppercase letter next to lowercase letter, or the other way round lowercase letter next to uppercase
@usmanakram1996 you'll need to check the tests cases and see what way it has to be
HN
@haydennorthcott
Apr 14 2017 03:28
how do I get the result of a return to equal my variable?
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:29
@haydennorthcott return the variable
Usman Akram
@usmanakram1996
Apr 14 2017 03:29
@HeebieGeeBee right
@HeebieGeeBee by the way thanks a lot
CamperBot
@camperbot
Apr 14 2017 03:29
usmanakram1996 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:warning: usmanakram1996 already gave heebiegeebee points
HN
@haydennorthcott
Apr 14 2017 03:30
@HeebieGeeBee my return is from an "if" statement and has a value.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:31
@haydennorthcott post the code and say what youre trying to do
HN
@haydennorthcott
Apr 14 2017 03:32

var count = 0;

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

  if(card = 2,3,4,5,6) {
  return 1;
  }else if (card = 7,8,9) {
    return 0;
  }else if (card = 10, 'J',  'Q', 'K', 'A') {
    return -1;
  }



  // 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');
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:32
@haydennorthcott theres lots wrong with that code
first youre meant to analyze the card and the increase/decrease/do nothing to the value of the count variable depending on what the card is
HN
@haydennorthcott
Apr 14 2017 03:34
@HeebieGeeBee great....! I'll take a fresh look at it later. Best that I don't go down the wrong path!
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:34
and then after analyzing the card you have to make a return of the count variable along with a string of either Hold or Bet depending on the value of the count variable at that time
now when you use the = operator this is purely for assigning values
== or === is for making a comparison
and in a conditional you can't just do card === 2, 3, 4,5 .... you have to do card === 2 || card === 3 || card === ......
@haydennorthcott
Michelle Carey
@genovese28
Apr 14 2017 03:40

// Example
var changed = 0;

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

changed = change(10);

// Setup
var processed = 0;

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

Call the processArg function with an argument of 7 and assign its return value to the variable processed.
Can anyone help me with this?
Jianhao Tan
@jaanhio
Apr 14 2017 03:42
function palindrome(str) {
  //convert string to lowercase
  var strLower = str.toLowerCase();
  //convert str to array
  var strArr = strLower.split("");
  //convert alpha to char code array
  var charArr = strArr.map(function(x){
    return x.charCodeAt(0);
  });
  //filter away non-alpha characters array
  var alphaOnly = charArr.filter(function(x){
    if (x>=97 && x<=122){
      return x;
    }
  });
  //initial alpha-only array
  var alphaOnlyArr = alphaOnly.map(function(x){
    return String.fromCharCode(x);
  });

  //initial alpha-only string
  var alphaOnlyStr = alphaOnlyArr.join("");

  //reversed alpha-only array
  var alphaOnlyArrRev = alphaOnlyArr.reverse();

  //reversed alpha-only string
  var alphaOnlyStrRev = alphaOnlyArrRev.join("");

  if(alphaOnlyStrRev == alphaOnlyStr){
    return true;
  }
  else{
    return false;
  }
  //return alphaOnlyStrRev;
}



palindrome("eye");
managed to pass all cases except for palindrome("1 eye for of 1 eye.”)
not sure which part went wrong
zmksky
@zmksky
Apr 14 2017 03:45
i have done it ,thanks
Claudio Restifo
@Marmiz
Apr 14 2017 03:47
@jaanhio alphanumeric means you have to include as valid also number. While in your code you're not
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 03:50
@genovese28 changed = change(10); do you see whats happening in this part of the example?
in this part of the example the variabled changed is being assigned a call of the change() function whilst having 10 passed in as it argument
@genovese28 now try and try and translate that into the instructions for your function
@jaanhio youre massively over complicating the task
Jianhao Tan
@jaanhio
Apr 14 2017 03:54
@HeebieGeeBee yea i realized it :worried:
@Marmiz thank you
CamperBot
@camperbot
Apr 14 2017 03:54
:cookie: 838 | @marmiz |http://www.freecodecamp.com/marmiz
jaanhio sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
Claudio Restifo
@Marmiz
Apr 14 2017 03:55
@jaanhio If I may, to simplify things try implementing a regex to check which char are valid and which not
Manish Giri
@Manish-Giri
Apr 14 2017 03:56
marmiz is the regex king
/marmiz/gi
Claudio Restifo
@Marmiz
Apr 14 2017 03:57
@Manish-Giri until I tried to test an Oauth2 on a server... there I realized my regex game is terrible :D
seanrhee
@seanrhee
Apr 14 2017 03:58
Hey all, I was here yesterday trying to get help but had to leave before I got a response, so I'm asking again. I'm on the Mutations exercise, and I can't seem to get past a few tests...

function mutation(arr) {
  var oStr = arr[0].toLowerCase();
  var checkStr = arr[1].toLowerCase();
  var count = 0;
  for (var i = 0; i < checkStr.length; i++){
    if (oStr.indexOf(checkStr[i])){
      count++;
    }
  }
  if (count < checkStr.length){
    return true;  
  }
  return false;
}
mutation(["hello", "hey"]);
for some reason the test in the code right now, returns false
Manish Giri
@Manish-Giri
Apr 14 2017 04:00
@seanrhee if (oStr.indexOf(checkStr[i]))
you sure this is right?
seanrhee
@seanrhee
Apr 14 2017 04:01
hmmm
any chance you could explain indexOf() to me please? i read the doc and I couldn't quite get it
Claudio Restifo
@Marmiz
Apr 14 2017 04:01
@seanrhee or in other word, are you sure what indexOf does?
Manish Giri
@Manish-Giri
Apr 14 2017 04:02
if(-1) {
    console.log("hi");
}
//hi
if(1) {
    console.log("hi");
}
//hi
@seanrhee
seanrhee
@seanrhee
Apr 14 2017 04:04
so does it have to say (oStr.indexOf(checkStr[i] > 0) ?
cuz it returns -1 when it doesn't find it
?
Manish Giri
@Manish-Giri
Apr 14 2017 04:04
what if the match is at index 0?
Claudio Restifo
@Marmiz
Apr 14 2017 04:04
@seanrhee indexOf returns the index of the value, if present otherwise -1.
hello.indexOf('o')
//4
seanrhee
@seanrhee
Apr 14 2017 04:04
OH
Sam Houlahan
@Sam-Houlahan
Apr 14 2017 04:05

@HeebieGeeBee was looking at the for loop you put in my code and im working at changing it to map(); is this possible cant get it going it prints to results but just says undefined. ```search.map(function(){
$('#results').append('<h3>' + search.title + '</h3><br/>' + '<p>' + search.snippet + '</p><br/><hr>');
$("#results").css('font-family: Rubik, sans-serif');

});```

seanrhee
@seanrhee
Apr 14 2017 04:05
I GOT IT
thank you guys sooooooo much
just couldn't really understand it from the way the doc presented it
Joseph
@revisualize
Apr 14 2017 04:08
Hi.
@HeebieGeeBee Funny thing. That livestream is blocked due to copyright.
Tanushree Samanta
@TSamanta
Apr 14 2017 04:09
hey could please help me in this pen. The searchbox doesn't show full shadow what to do
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:14
@Sam-Houlahan you need to give your map callback a parameter and then use that parameter in the callback function
@revisualize cus of the music right?
Joseph
@revisualize
Apr 14 2017 04:15
@HeebieGeeBee I think so.
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:15
@revisualize yeah youtube are quick with that shit
search.map(function(i){
$('#results').append('<h3>' + i.title + '</h3><br/>' + '<p>' + i.snippet + '</p><br/><hr>');
$("#results").css('font-family: Rubik, sans-serif');
});
@Sam-Houlahan
Ming Zhu
@chocobrownie
Apr 14 2017 04:21
Hi, I am learning basic JavaScript and the "if" statement is different from what I learned from C++:```
 if (wasThatTrue) { 
    return "Yes, that was true";
  }
  return "No, that was false";
By my experience if I give "wasThatTrue" a "true", it will return both
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:22
@TSamanta what ever ham is is getting in the way
Ming Zhu
@chocobrownie
Apr 14 2017 04:22
"Yes, that was true" "No, that was false"
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:22
comment out the overflow hidden in ham and you see all the shadow
@TSamanta
Ming Zhu
@chocobrownie
Apr 14 2017 04:23
In C++ there should be if{}else{} but in JavaScript looks like the other outcome is exposed
Sam Houlahan
@Sam-Houlahan
Apr 14 2017 04:23
@HeebieGeeBee ah i see makes sense. I was trying like this search.x.title . Alot easier that its just simply x.title x.snippet
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:24
@Sam-Houlahan cool
search is the object key containing the array if i remember
@chocobrownie you can use if / else in javascript too
but functions cease execution whenever the reach a return
if the the if condional is dalse it will just move onto code outside of the if statement
Ming Zhu
@chocobrownie
Apr 14 2017 04:27
@HeebieGeeBee So you mean once it hits the first return it stops excecuting everything below and terminate the function with a value?
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:27
@chocobrownie yeah
return terminates a function
Ming Zhu
@chocobrownie
Apr 14 2017 04:27
Ohhh, I'm really rusty
Rusty brownie
Thx @HeebieGeeBee
CamperBot
@camperbot
Apr 14 2017 04:28
chocobrownie sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1303 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
shruti
@shrutisolanki205
Apr 14 2017 04:30

// Declarations
var StUdLyCapVaR;
var properCamelCase;
var TitleCaseOver;

// Assignments
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;

studlyCapVar is defined and has a value of 10
properCamelCase is defined and has a value of "A String"
titleCaseOver is defined and has a value of 9000
studlyCapVar should use camelCase in both declaration and assignment sections.
properCamelCase should use camelCase in both declaration and assignment sections.
titleCaseOver should use camelCase in both declaration and assignment sections.
help we with the code please
Tanushree Samanta
@TSamanta
Apr 14 2017 04:31
@HeebieGeeBee okay I will try that
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:31
@shrutisolanki205 you need to write the variables in camelcase
Ba Ba K
@cyclops24
Apr 14 2017 04:32
I want contribute to a npm package, can anyone guide me?
Guderian Raborg
@hypercuber
Apr 14 2017 04:32
How can I add [1,2,1] to var arr = [[1],[1,1]]; ?
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:32
@shrutisolanki205 so var StUdLyCapVaR; needs to be var studlyCapVar;
and so on
shruti
@shrutisolanki205
Apr 14 2017 04:32
@HeebieGeeBee i tried it... can you please write the code and help please
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:34
@hypercuber using push of unshift or splice, depends where you wanna put it
@shrutisolanki205 did you see my example?
Ba Ba K
@cyclops24
Apr 14 2017 04:34
I want contribute to a npm package, can anyone guide me?
Guderian Raborg
@hypercuber
Apr 14 2017 04:35
@HeebieGeeBee I am getting [[1],[1,1],1,2,1] not [[1][1,1][1,2,1]]
shruti
@shrutisolanki205
Apr 14 2017 04:35
@HeebieGeeBee yes done thanks !!!
CamperBot
@camperbot
Apr 14 2017 04:35
shrutisolanki205 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1304 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Manish Giri
@Manish-Giri
Apr 14 2017 04:35
@shrutisolanki205 shrutiSolanki is camel case
shruti
@shrutisolanki205
Apr 14 2017 04:35
@Manish-Giri got it thanks !!!
CamperBot
@camperbot
Apr 14 2017 04:35
:star2: 5153 | @manish-giri |http://www.freecodecamp.com/manish-giri
shrutisolanki205 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:35
@cyclops24 dunno how to do that sorry maybe the website will have details
Tanushree Samanta
@TSamanta
Apr 14 2017 04:35
@HeebieGeeBee thank you!
CamperBot
@camperbot
Apr 14 2017 04:35
tsamanta sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1305 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:36
@hypercuber what code are you using?
Guderian Raborg
@hypercuber
Apr 14 2017 04:36
function pascal(num) {
  var arr = [[1],[1,1]];
  arr.push(1,2,1);
  return arr;
}
document.write(JSON.stringify(pascal(5)));
//[[1],[1,1],1,2,1] 
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:36
@hypercuber push it as an array
Guderian Raborg
@hypercuber
Apr 14 2017 04:37
@HeebieGeeBee Ah, thanks!
CamperBot
@camperbot
Apr 14 2017 04:37
hypercuber sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1306 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Guderian Raborg
@hypercuber
Apr 14 2017 04:37
arr.push([1,2,1]);
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:37
arr.push([1,2,1])
Guderian Raborg
@hypercuber
Apr 14 2017 04:37
:)
shruti
@shrutisolanki205
Apr 14 2017 04:37
heyy how to bring the black box across the code??
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:39
type three backticks then shift and enter to get a new line and post your code between the backticks
Darth Skywalker
@adityaparab
Apr 14 2017 04:39

@shrutisolanki205

if you type

```js
console.log('Such code! Much formatting! Wowe!');
```

you will see

console.log('Such code! Much formatting! Wowe!');
shruti
@shrutisolanki205
Apr 14 2017 04:40
hello
Darth Skywalker
@adityaparab
Apr 14 2017 04:40
There you go!
shruti
@shrutisolanki205
Apr 14 2017 04:41
ohh ok thanks !! @adityaparab
CamperBot
@camperbot
Apr 14 2017 04:41
shrutisolanki205 sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 999 | @adityaparab |http://www.freecodecamp.com/adityaparab
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:41
@adityaparab ty
@adityaparab thank you
CamperBot
@camperbot
Apr 14 2017 04:41
heebiegeebee sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:star2: 1000 | @adityaparab |http://www.freecodecamp.com/adityaparab
Darth Skywalker
@adityaparab
Apr 14 2017 04:41
@shrutisolanki205 @HeebieGeeBee :+1:
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:41
congrats on the 1k
Darth Skywalker
@adityaparab
Apr 14 2017 04:42
@HeebieGeeBee You helped me cross the 1000 brownie barrier.. your assistance will not go unnoticed..
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 04:42
lol sweet
shruti
@shrutisolanki205
Apr 14 2017 04:50
myVar = myVar ++;
myVar should equal 88
myVar = myVar should be changed
whats the mistake??
done !!!
Jose Hinojo
@tovouk
Apr 14 2017 04:52
why doesn't this work?

function largestOfFour(arr) {
// You can do this!
var arrl = [0,0,0,0];

for(var i = 0; i < arr.length; i++){
for(var j = 0; j < arr[i].length; i++){
if( arr[i][j] > arrl[i]){
arrl[i] = arr[i][j];
}
}
}
return arrl;

}

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

nvm
had to look at it closer
Moisés Man
@moigithub
Apr 14 2017 04:54
j++
@shrutisolanki205 u not following the example pattern
example say... if u have i=i+1 to increase i by1
another way to increase by 1 would be use i++
shruti
@shrutisolanki205
Apr 14 2017 04:58
@moigithub yup done thanks !!!
CamperBot
@camperbot
Apr 14 2017 04:58
shrutisolanki205 sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 3083 | @moigithub |http://www.freecodecamp.com/moigithub
Darth Skywalker
@adityaparab
Apr 14 2017 04:58
@shrutisolanki205 all you need to do is myVar++
susaint
@susaint
Apr 14 2017 04:58
can somebody explain me : Escape Sequences in Strings challenge ........i am unable to complete
shruti
@shrutisolanki205
Apr 14 2017 05:04
@adityaparab yes done thanks !!
CamperBot
@camperbot
Apr 14 2017 05:04
shrutisolanki205 sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:warning: shrutisolanki205 already gave adityaparab points
Ryan Cook
@xYuGx
Apr 14 2017 05:09
can anyone tell me why this isnt working?

var myVar = 87;

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

myVar should be equal to 88 myVar = myVar should be changed
shruti
@shrutisolanki205
Apr 14 2017 05:11
@xYuGx change myVar = myVar++; to myVar++;
Ryan Cook
@xYuGx
Apr 14 2017 05:12
@shrutisolanki205 gotcha! thanks
CamperBot
@camperbot
Apr 14 2017 05:12
xyugx sends brownie points to @shrutisolanki205 :sparkles: :thumbsup: :sparkles:
:cookie: 97 | @shrutisolanki205 |http://www.freecodecamp.com/shrutisolanki205
Darth Skywalker
@adityaparab
Apr 14 2017 05:20
@shrutisolanki205 you started helping people already! :D :+1:
devpaaji
@devpaaji
Apr 14 2017 05:30
@HeebieGeeBee gm friend
how are you
@adityaparab gm
HeebieGeeBee
@HeebieGeeBee
Apr 14 2017 05:32
@devpaaji mornin
im tired
hows you?
Eric Long
@ejlong90
Apr 14 2017 05:40

Hey guys!, So i am working on "Iterate with JavaScript For Loops" and it is asking me to
Instructions
Use a for loop to work to push the values 1 through 5 onto myArray.
this is my code that i believe is correct.


// Example
var ourArray = [];

for (var i = 0; i < 5; i++) {
  ourArray.push(i);
}

// Setup
var myArray = [];

// Only change code below this line.
for (var i = 1; i < 6, i++) {
  myarray.push(i);
}

what is wrong?

shruti
@shrutisolanki205
Apr 14 2017 05:40
@adityaparab yes tried a bit :smile:
Moisés Man
@moigithub
Apr 14 2017 05:41
@ejlong90 JS is case sensitive
aaaa is not the same as AAAA or aAaA
check ur variable names
Bryanmarc Ray
@CubicB
Apr 14 2017 05:43
myArray in your for Statement is misspelled
Eric Long
@ejlong90
Apr 14 2017 05:45
i changed that but i am getting this error:
SyntaxError: Unexpected token )
Moisés Man
@moigithub
Apr 14 2017 05:45
HOW u did ?
Eric Long
@ejlong90
Apr 14 2017 05:46

// Example
var ourArray = [];

for (var i = 0; i < 5; i++) {
  ourArray.push(i);
}

// Setup
var myArray = [];

// Only change code below this line.
for (var i = 1; i < 6, i++) {
  myArray.push(i);
}
Moisés Man
@moigithub
Apr 14 2017 05:47
comma vs semicolon.. compare with the code Example above...
Manish Giri
@Manish-Giri
Apr 14 2017 05:49
i < 6, i++)
Makrand R
@makrandr
Apr 14 2017 05:54
Different versions of bootstrap got different features? like I'm not able to use glyphicons with the one provided by codepen
Eric Long
@ejlong90
Apr 14 2017 05:54
omg idk if i am tired or blind i fixed the semi colon issue between the 1 and i but still an issue

// Example
var ourArray = [];

for (var i = 0; i < 5; i++) {
  ourArray.push(i);
}

// Setup
var myArray = [];

// Only change code below this line.
for (var i = 1, i < 6, i++) {
  myArray.push(i);
}
Makrand R
@makrandr
Apr 14 2017 05:55
http://codepen.io/makrandr/full/qrzMxJ
but while using it from an external source, by adding stuff into the head , other features get screwed up
@ejlong90 for(var i=1;i<6;i++)
Eric Long
@ejlong90
Apr 14 2017 05:57
nevermind i saw the issue lol thank you @moigithub @Manish-Giri @CubicB
CamperBot
@camperbot
Apr 14 2017 05:57
ejlong90 sends brownie points to @moigithub and @manish-giri and @cubicb :sparkles: :thumbsup: :sparkles:
:cookie: 187 | @cubicb |http://www.freecodecamp.com/cubicb
:star2: 3084 | @moigithub |http://www.freecodecamp.com/moigithub
:star2: 5155 | @manish-giri |http://www.freecodecamp.com/manish-giri
Mark Mascarenhas
@Freedom41
Apr 14 2017 05:59
hello everyone can someone help me im stuck on this problem
Factorialize a Number
source code

function factorialize(num) {
var i = 0;

if (i <= 10) {
i = num ( num-1) (num-2)(num-3)(num-4)(num-5)(num-6)(num-7)(num-8)(num-9)(num-10);
}

else {
i =1;
}

return i;
}

factorialize(10);

Eric Long
@ejlong90
Apr 14 2017 06:01
put an "```" before and after your code
Mark Mascarenhas
@Freedom41
Apr 14 2017 06:02

'''function factorialize(num) {
var i = 0;

if (i <= 10) {
i = num ( num-1) (num-2)(num-3)(num-4)(num-5)(num-6)(num-7)(num-8)(num-9)(num-10);
}

else {
i =1;
}

return i;
}

factorialize(10);

CamperBot
@camperbot
Apr 14 2017 06:02
:bulb: to format code use backticks! ``` more info
Mark Mascarenhas
@Freedom41
Apr 14 2017 06:03

```function factorialize(num) {
var i = 0;

if (i <= 10) {
i = num ( num-1) (num-2)(num-3)(num-4)(num-5)(num-6)(num-7)(num-8)(num-9)(num-10);
}

else {
i =1;
}

return i;
}

factorialize(10);

'''function factorialize(num) {
var i = 0;

if (i <= 10) {
i = num ( num-1) (num-2)(num-3)(num-4)(num-5)(num-6)(num-7)(num-8)(num-9)(num-10);
}

else {
i =1;
}

return i;
}

factorialize(10);
'''

CamperBot
@camperbot
Apr 14 2017 06:04
:bulb: to format code use backticks! ``` more info
Mark Mascarenhas
@Freedom41
Apr 14 2017 06:04
i think ill come back on pc sorry
Bijay Panthi
@Bijay-Panthi
Apr 14 2017 06:06
@Freedom41 it seems you are assigning I to i at else statement, try t o compare it like this i ==1 or i===1
Roshni Subudhi
@roshnisubudhi
Apr 14 2017 06:09
FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine
What to do in this?
c0d0er
@c0d0er
Apr 14 2017 06:10
anybody knows what is the problem of the following code (RangeError: Maximum call stack size exceeded)? from http://beta.freecodecamp.com/en/challenges/es6/use-getters-and-setters-to-control-access-to-an-object

/* Alter code below this line */
const Thermostat = class Thermostat {
  constructor (temperature) {
    this.temperature = temperature;
  }

  get temperature () {
    return (this.temperature-32)*5/9;
  }

  set temperature (x) {
    this.temperature=x;
  }

};
/* Alter code above this line */
const thermos = new Thermostat(76); // setting in Farenheit scale
let temp = thermos.temperature; // 24.44 in C
thermos.temperature = 26;
temp = thermos.temperature; // 26 in C
Roshni Subudhi
@roshnisubudhi
Apr 14 2017 06:15
@roshnisubudhi
FirstLinenewlinebackslashSecondLinebackslashcarriage-returnThirdLine
What to be done in this?
Daniel López
@whatsupbro
Apr 14 2017 06:18
hello everyone
I have a dumb question I am learning javascript, but a doubt stick on my mind, the DOM what it corresponds to, for example this types of code document.getElementById()
and all of that that surrounds it
Darth Skywalker
@adityaparab
Apr 14 2017 06:20
@roshnisubudhi : You need to construct a string in such a way that when logged, it looks like this
FirstLine
\SecondLine\
ThirdLine

@whatsupbro : DOM = Document Object Model

Which is just a fancy way of saying "tree of tags"

If you hit F12, what you see as HTML content is your DOM.
Daniel López
@whatsupbro
Apr 14 2017 06:24
ohhh, but for example in the courses I am learning at differents sites like udemy, etc, it doesnt show that type of syntax for example document.getElementById()
in specific in order to learn all of that where do I need to get first?
i dont know if you understand me! :worried:
Roshni Subudhi
@roshnisubudhi
Apr 14 2017 06:32
@adityaparab var myStr = 'FirstLine\n \ "SecondLine" \ \rThirdLine'
whats wrong in my line? :(
Johnny
@jtan3
Apr 14 2017 06:37
@roshnisubudhi try without the quotes and how do you escape backslash?
Alexander Køpke
@alexanderkopke
Apr 14 2017 06:38
@whatsupbro http://domenlightenment.com/ read this
Tanisha Garg
@TanishaGarg
Apr 14 2017 06:49
Can anyone please do me the favor of knowing what am i doing wrong in this code? https://www.freecodecamp.com/challenges/profile-lookup#?solution=%0A%2F%2FSetup%0Avar%20contacts%20%3D%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Akira%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Laine%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220543236543%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Pizza%22%2C%20%22Coding%22%2C%20%22Brownie%20Points%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Harry%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Potter%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220994372684%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Hogwarts%22%2C%20%22Magic%22%2C%20%22Hagrid%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Sherlock%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Holmes%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%220487345643%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Intriguing%20Cases%22%2C%20%22Violin%22%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22firstName%22%3A%20%22Kristian%22%2C%0A%20%20%20%20%20%20%20%20%22lastName%22%3A%20%22Vos%22%2C%0A%20%20%20%20%20%20%20%20%22number%22%3A%20%22unknown%22%2C%0A%20%20%20%20%20%20%20%20%22likes%22%3A%20%5B%22Javascript%22%2C%20%22Gaming%22%2C%20%22Foxes%22%5D%0A%20%20%20%20%7D%0A%5D%3B%0A%0A%0Afunction%20lookUpProfile(firstName%2C%20prop)%7B%0A%2F%2F%20Only%20change%20code%20below%20this%20line%0Aif%20(contacts.hasOwnProperty.firstName%20%3D%3D%3D%20true%20%26%26%20contacts.hasOwnProperty(prop)%20%3D%3D%3D%20true)%20%7B%0A%20%20return%20contacts.firstname%20%2B%20contacts(prop)%20%3B%0A%7D%0A%20else%20if%20(contacts.hasOwnProperty.firstName%20!%3D%3D%20true%20%7C%7C%20contacts.hasOwnPorperty(prop)%20!%3D%3D%20true%20)%20%7B%0A%20%20%20if%20(contacts.hasOwnProperty.firstName%20!%3D%3D%20true)%20%7B%0A%20%20%20%20%20return%20%22No%20such%20Contact%22%3B%0A%20%20%20%7D%0A%20%20%20else%20%7B%0A%20%20%20%20%20return%20%22No%20such%20Property%22%3B%0A%20%20%20%7D%0A%20%7D%0A%20%20else%20%7B%0A%20%20%20%20return%20%22No%20such%20Contact%22%20%2B%20%22No%20such%20Property%22%3B%0A%20%20%7D%0A%2F%2F%20Only%20change%20code%20above%20this%20line%0A%7D%0A%0A%2F%2F%20Change%20these%20values%20to%20test%20your%20function%0AlookUpProfile(%22Akira%22%2C%20%22likes%22)%3B%0A
wxlbobo
@wxlbobo
Apr 14 2017 06:59
Check for Palindromes 这个怎么写呢
Bgene
@Bgene
Apr 14 2017 07:05
can someone look at my codes?

function palindrome(str) {
// Good luck!

str.replace(/[&\/\#,+()$~%.'":*?<>{}]/g, '');

var array1= str.split("");

var array2 = array1.reverse().join("");

array1=array1.join("");

return array1==array2;

}

palindrome("eye");

i think think the .reverse command is not working
Daniel López
@whatsupbro
Apr 14 2017 07:06
Thanks Darth Skywalker
And Thanks Alexander Køpke
future-style
@future-style
Apr 14 2017 07:10
@TanishaGarg contacts.hanOwnProperty is wrong ,always
Johnny
@jtan3
Apr 14 2017 07:11
@Bgene did you add _ in your replace?
future-style
@future-style
Apr 14 2017 07:12
@TanishaGarg you must loop the contacts at first
@TanishaGarg like this
Johnny
@jtan3
Apr 14 2017 07:13
@Bgene you might want to make everything lowerCase too
future-style
@future-style
Apr 14 2017 07:13
         var len = contacts.length;
    for(var i=0;i<len;i++){
        if(contacts[i].firstName === firstName){
            return contacts[i].firstName;
        }else{
            return 'No such Contact';
            }
        }
Johnny
@jtan3
Apr 14 2017 07:18
@Bgene http://regexr.com/ you should check out regex. Here's a video on regex https://www.youtube.com/watch?v=YTocEnDsMNw
Tanisha Garg
@TanishaGarg
Apr 14 2017 07:22
@future-style how is hasOwnProperty wrong?
Shayan
@ShayanS
Apr 14 2017 07:28

function nextInLine(arr, item) {
var nextInLine = testArr;
return nextInLine.push(item) + nextInLine.shift(); // Change this line
}

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

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

can someone help me with this exercise??
future-style
@future-style
Apr 14 2017 07:28
@TanishaGarg contacts is array object , array is not firstName property
Shayan
@ShayanS
Apr 14 2017 07:29
I have to add a number to the end of the array and remove the first element
the nextInLine fn should return the removed element

function nextInLine(arr, item) {
var nextInLine = testArr;
return nextInLine.push(item) + nextInLine.shift(); // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
can someone help me with this exercise??

Dmytro Holysh
@dmk1111
Apr 14 2017 07:34
@ShayanS you don't have to use testArr inside of the function. Use just arr, as it is listed in arguments so you have to do something with this argument
Travis Bryant
@t-bryant
Apr 14 2017 07:34
need help to find out whats wrong with my code
function multiplyAll(arr) {
  var product = 1; 
 // Only change code below this line

for (var i = 0; i < arr.length; i++) {
  for (var j = 0; j < arr[i].length; j++) {
    for (var k = 0; k < arr[j].length; k++)
       console.log(arr[i][j][k]);
  }
}

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Dmytro Holysh
@dmk1111
Apr 14 2017 07:37
@t-bryant because of many loops you got confused. third loop (with [k]) is not needed here
Travis Bryant
@t-bryant
Apr 14 2017 07:38
ok, I removed the third loop, and it still didn't work...its always returning as 1 because the var product = 1 and return product...but i'm not supposed to change those
Dmytro Holysh
@dmk1111
Apr 14 2017 07:39
inside of the loop you need to multiply product and loop result
because right now you only console.log it but not multiplying it
I would advice you to use arr.forEach() instead of for loop in the future, if you need to loop through array
it is more functional approach
@t-bryant any luck with that yet?
Travis Bryant
@t-bryant
Apr 14 2017 07:43
no because then the arr.length comes back as error(not a function)
Dmytro Holysh
@dmk1111
Apr 14 2017 07:43
can you show me your code now?
Travis Bryant
@t-bryant
Apr 14 2017 07:44
function multiplyAll(arr) {
  var product = 1; 
 // Only change code below this line

arr.forEach(var i = 0; i < arr.length; i++) {
  arr.forEach(var j = 0; j < arr[i].length; j++) {

       console.log(arr[i][j]);
  }
}

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
how do you multiply with product, because I am getting the product not a function too
Baderfahad
@Baderfahad
Apr 14 2017 07:44
hey all :) !
Travis Bryant
@t-bryant
Apr 14 2017 07:45
hey @Baderfahad
HansGrubername
@HansGrubername
Apr 14 2017 07:45
hey could anyone explain the regex in this to me
function titleCase(str) {
  return (str.toLowerCase().replace(/(^|\s)[a-z]/g,function(f){
    return f.toUpperCase();
    }
  ));
}

titleCase("I'm a little tea pot");
Dmytro Holysh
@dmk1111
Apr 14 2017 07:45
oh, try to solve the problem with for loop first, forEach has a bit different approach
Baderfahad
@Baderfahad
Apr 14 2017 07:46
I got stuck on convert from celsius to fehrainheit I could not figure out how put another input (only one number appeare )
Travis Bryant
@t-bryant
Apr 14 2017 07:47
still returning just one beacuse of the product...how do I multiply the product without it coming up as error...do I use the actual number 1 or product?
Dmytro Holysh
@dmk1111
Apr 14 2017 07:49
@t-bryant here is how to do that with forEach loop
function multiplyAll(arr) { 
   var product = 1;

  arr.forEach(function(item) {
    item.forEach(function(innerItem) {
        product *= innerItem;
    })
})
    return product;
}


multiplyAll([[1,2],[3,4],[5,6,7]]);
@t-bryant try to solve it with for loop now, it almost the same & you were very close to that
Claudio Restifo
@Marmiz
Apr 14 2017 07:50
@HansGrubername that regex is looking for any space followed by a lowercase letter.
Or in other word will match any lower case letter preceded by a space
Travis Bryant
@t-bryant
Apr 14 2017 07:51
ok...so what I was doing wrong the entire time was I was doing product innerItem, not product = innerItem
thanks @dmk1111
CamperBot
@camperbot
Apr 14 2017 07:51
t-bryant sends brownie points to @dmk1111 :sparkles: :thumbsup: :sparkles:
:cookie: 283 | @dmk1111 |http://www.freecodecamp.com/dmk1111
Samir Jain.
@SamirJain
Apr 14 2017 07:51
what am I doing wrong here
Linus
@nusli
Apr 14 2017 07:51

can any1 tell me what's wrong with this code?

 $.getJSON(url,  function(data){
     var string = JSON.stringify(data);
     $("#json").html(string);
});

the "url" variable is correct

Samir Jain.
@SamirJain
Apr 14 2017 07:51
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
  for (i=0; i<arr.length; i++){
    for (j=0; j<arr[i]; j++){

      product *= [i][j];
    }
  }
  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Baderfahad
@Baderfahad
Apr 14 2017 07:52
So any help how to make another number appeare on converting C to F !
Travis Bryant
@t-bryant
Apr 14 2017 07:53
@SamirJain as a matter of fact we just went over that...look at your product *= [i][j]...you need to have arr go with it...so (arr[i][j])
try that and it should work
HansGrubername
@HansGrubername
Apr 14 2017 07:54
thanks @Marmiz
CamperBot
@camperbot
Apr 14 2017 07:54
hansgrubername sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:cookie: 839 | @marmiz |http://www.freecodecamp.com/marmiz
Claudio Restifo
@Marmiz
Apr 14 2017 07:54
@nusli are you receiving any data back?
console.log(data) or inspecting the network activities
@Baderfahad follow the formula suggested on the lesson
Dmytro Holysh
@dmk1111
Apr 14 2017 07:55
@Baderfahad 1 degree Celsius = 33.8 degrees Fahrenheit
have you tried to multiply C converting it to F?
Samir Jain.
@SamirJain
Apr 14 2017 07:55
@t-bryant still not working.
Travis Bryant
@t-bryant
Apr 14 2017 07:55
what does your code look like now
mixa1901
@mixa1901
Apr 14 2017 07:55
Hey, guys!! I cant get it: why in first code we must add 1 to length and in second we mustnt do it ??
var myArr = [ 2, 3, 4, 5, 6];
var total = 0;

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
Baderfahad
@Baderfahad
Apr 14 2017 07:55
I converted already but only one number appear !
Linus
@nusli
Apr 14 2017 07:56
@Marmiz no i dont get any data back
Baderfahad
@Baderfahad
Apr 14 2017 07:56
@Marmiz I will check !
Travis Bryant
@t-bryant
Apr 14 2017 07:57
@SamirJain in your second for, after arr{i],try adding .length
Claudio Restifo
@Marmiz
Apr 14 2017 07:58
@nusli what error does the network reported back?
Samir Jain.
@SamirJain
Apr 14 2017 07:58
@t-bryant yes, I fixed it, that was the cause. thanks
CamperBot
@camperbot
Apr 14 2017 07:58
samirjain sends brownie points to @t-bryant :sparkles: :thumbsup: :sparkles:
:cookie: 218 | @t-bryant |http://www.freecodecamp.com/t-bryant
Travis Bryant
@t-bryant
Apr 14 2017 08:00
//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUpProfile(firstName, prop){
// Only change code below this line
contacts.hasOwnProperty(firstName);
  contacts.hasOwnProperty(prop);
  if (contacts.hasOwnProperty(firstName)) {
    return contacts.hasOwnProperty(prop);
  }
  {return "No such property";}
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
ok, guys...so what am I doing wrong here?
Baderfahad
@Baderfahad
Apr 14 2017 08:00
from -22 to 14 it just have one input
so only 2 check
Travis Bryant
@t-bryant
Apr 14 2017 08:00
the no such property is working fine
Baderfahad
@Baderfahad
Apr 14 2017 08:00
how I add another input ?
Claudio Restifo
@Marmiz
Apr 14 2017 08:01
@mixa1901 the first example you showed is an addiction, you're adding values, in the second you are doing a multiplication. They are two totally different operation :)
so I'm not sure what you're asking here
Dmytro Holysh
@dmk1111
Apr 14 2017 08:02
@t-bryant you need to loop through array & compare each result with incoming arguments
Linus
@nusli
Apr 14 2017 08:03
@Marmiz i dont get an error
Travis Bryant
@t-bryant
Apr 14 2017 08:03
so somewhat like i was doing with my last problem with the for loops, but using the arguments as well
Dmytro Holysh
@dmk1111
Apr 14 2017 08:03
@t-bryant plus you need to use nested loops together with if-else
Claudio Restifo
@Marmiz
Apr 14 2017 08:04
@t-bryant moreover you need to return No such contact if the contact does not exist
Dmytro Holysh
@dmk1111
Apr 14 2017 08:04
you need to check something like contacts[i].firstName === firstName
mixa1901
@mixa1901
Apr 14 2017 08:05
@Marmiz if length doesnt have +1 does it include last element of the array?
Travis Bryant
@t-bryant
Apr 14 2017 08:05
ok... i will work on that and give it a shot
Claudio Restifo
@Marmiz
Apr 14 2017 08:08

@mixa1901 the second portion is a variable to set how many times you need to loop.
So it's a totally arbitrary value that depends on your need.
You want to loop for as long as an array is long:

i < arr.length

You want to loop for twice the length of the array?

i < (arr.length * 2)

Makes sense?

mixa1901
@mixa1901
Apr 14 2017 08:13
@Marmiz The quote from task: "Remember that Arrays have zero-based numbering, which means the last index of the array is length - 1. Our condition for this loop is i < arr.length, which stops when i is at length - 1. " Then why in next code it doesnt matter?
for ( var i = 0; i < arr.length; i++) {
    for (var j = 0; j < arr[i].length; j++) {
         product *= arr[i][j];
         }
  }
  // Only change code above this line
  return product;
}
HansGrubername
@HansGrubername
Apr 14 2017 08:18
can anyone tell me why my loop is cancelling early and returning the array [5,0,0,0]

function largestOfFour(arr) {
  // You can do this!

  var biggest = [0,0,0,0];
  for (var i = 0; i < arr.length; i++) {
    for (var j = 0; j < arr[i].length; j++) {
     if (arr[i][j] > biggest[i]) {
       biggest[i] = arr[i][j];
    }
  }


  return biggest;
}
Linus
@nusli
Apr 14 2017 08:32
@HansGrubername you must add one more "}"
HansGrubername
@HansGrubername
Apr 14 2017 08:37
@nusli thanks that was driving me up the wall
CamperBot
@camperbot
Apr 14 2017 08:37
hansgrubername sends brownie points to @nusli :sparkles: :thumbsup: :sparkles:
:cookie: 268 | @nusli |http://www.freecodecamp.com/nusli
Claudio Restifo
@Marmiz
Apr 14 2017 08:37

@mixa1901 what do you mean by "does not matter"?
In the example you've provided you're looping for the whole length of the array.

The for loop will execute the function inside if the condition is met.
So imagine I have an arr.length = 3.
If I write my statement as:

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

The above loop will iterate for:

for ( var i = 0; i < arr.length; i++) {
 //i =0;
//i=1;
//i=2;
}

When i=3 the condition <arr.length is false so the code inside won't execute, and that's why the iteration is made exactly 3 times
(which is the lenght of my array)

Alexander Effanga
@AstringentBeet
Apr 14 2017 08:41

Hey everyone! I’m super new to JavaScript, and I need help with this small “game” that I made. The goal of it is to correctly guess a color that is listed in the array.

var Correcto = false;
var color = ['red', 'magenta', 'pink', 'blue', 'yellow', 'green', 'brown', 'cafe au lait', 'black', 'baby blue', 'beige', 'cyan', 'violet', 'silver', 'gold', 'garnet', 'orange', 'gray', 'neon pink', 'neon green', 'neon'];
var question = prompt("What is a color I know of?");

function dog(answer) {
    var i,
    randomNumber = Math.floor(Math.random () * 21);
    for ( i = 0 ; i < color.length ; i++ ) {         
        if (question === color[randomNumber]) {
            Correcto = true;
                      //this is may be where the problem lies
        }
    }
}

if (dog) {
    alert('You guessed right! Stellar job :)');
} else {
    alert('Wow, guess you learn something new everyday...’);
         //Yet to be used.
}

The problem I’m having is that even if I guess a number wrong, it’ll still assume my answer is correct. Any suggestions?

Carl Tamayo
@tanotamayo
Apr 14 2017 08:42
what should i do here to get different values?
convertToF(-30);

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

// Only change code above this line
return fahrenheit;
}
fahrenheit = 9/5 + 32;

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

Claudio Restifo
@Marmiz
Apr 14 2017 08:43
@AstringentBeet instead of looking if a function exists ( if(dog)) why you don't simply look if correcto=ture?
amogh
@amogh006
Apr 14 2017 08:45
guys how to check if a given propery is present in a object
Claudio Restifo
@Marmiz
Apr 14 2017 08:45
the flaw in this logic however is that after the first time I guess right, that value will always be ture.
So either you insert a "reset" functionality or simply let that function return the alert:
 if (question === color[randomNumber]) {
           alert("You won!")
        }
Sanket Cha