These are chat archives for FreeCodeCamp/HelpJavaScript

19th
Nov 2016
Ryan McMahon
@Radio-Mac
Nov 19 2016 00:00
Yep.

Welp, it's official. This thing has broken me.


function rot13(str) { // LBH QVQ VG!
  var temp = 0;
  var fullStr = "";
  for (var i = 0; i < str.length; i++){
     if(65 <= str.charCodeAt(i)<= 78){
       temp = str.charCodeAt(i) + 13;
     }     
       else{
       temp = str.charCodeAt(i) - 13;
       }
   if (temp >= 90){
         temp = (((temp - 65 + 13) % 26) + 65);
       }
        fullStr += String.fromCharCode(temp);
  }

  return fullStr;
}

// Change the inputs below to test
rot13("SERR PBQR PNZC");

At this point I just want someone to say what I'm doing that's just mind blindingly dumb that you want to take this code to the back porch and give it the "Old Yeller" treatment.

darkflikk
@darkflikk
Nov 19 2016 00:03
@Radio-Mac you sure?
JackVizl
@JackVizl
Nov 19 2016 00:03
@Radio-Mac nice
darkflikk
@darkflikk
Nov 19 2016 00:03
why you say that's nice?
JackVizl
@JackVizl
Nov 19 2016 00:03
the joke
A+ on the joke
@Radio-Mac whats your output?
darkflikk
@darkflikk
Nov 19 2016 00:05
@Radio-Mac let's start from the beginning
Ryan McMahon
@Radio-Mac
Nov 19 2016 00:05
SRRR-POQR-PNZP. So part of it works I just haven't worked with ASCII alphabet before in my life so I'm not sure what approach to take or how to fix it. I also don't want to look up the answer, as tempting as it is right now.
darkflikk
@darkflikk
Nov 19 2016 00:05
@Radio-Mac do you know the ascii value of A?
Ryan McMahon
@Radio-Mac
Nov 19 2016 00:06
  1. I only know that because I have the table in another tab.
JackVizl
@JackVizl
Nov 19 2016 00:06
bruh you need from a
lower case a
Ryan McMahon
@Radio-Mac
Nov 19 2016 00:06
**65
darkflikk
@darkflikk
Nov 19 2016 00:06
@JackVizl it's uppercase
JackVizl
@JackVizl
Nov 19 2016 00:06
61
oh is iut?
my mistake
^^
JackVizl
@JackVizl
Nov 19 2016 00:07
change it from <= to <
Stephen James
@sjames1958gm
Nov 19 2016 00:07
@Radio-Mac 65 <= str.charCodeAt(i)<= 78 this is still wrong.
If you want to avoid the numbers:
var A = "A".charCodeAt(0);
var M = "M".charCodeAt(0);
var Z = "Z".charCodeAt(0);
darkflikk
@darkflikk
Nov 19 2016 00:07
@Radio-Mac want a hint how you can start?
Ryan McMahon
@Radio-Mac
Nov 19 2016 00:07
Well all I wanted to know whas the alphabet.
Stephen James
@sjames1958gm
Nov 19 2016 00:08
If you use those lines the you can compare to A instead of 65
And M instead of 78
Ryan McMahon
@Radio-Mac
Nov 19 2016 00:09
I know I have to use charCodeAt to break it apart into ASCII and then .fromCharCode to bring it back into letters in a string. After that I suppose I need help.
darkflikk
@darkflikk
Nov 19 2016 00:09
@Radio-Mac i recommend to start from 0
Stephen James
@sjames1958gm
Nov 19 2016 00:10
@Radio-Mac
get char code
if (A to M) add 13
else if (N to Z) subtract 13
+= fromCharCode onto output string
darkflikk
@darkflikk
Nov 19 2016 00:10
that's too easy :P
Ryan McMahon
@Radio-Mac
Nov 19 2016 00:11
@sjames1958gm @darkflikk Let me try that..
darkflikk
@darkflikk
Nov 19 2016 00:11

@Radio-Mac i recommend to start by 0

var base = str.charCodeAt(i) - "A".charCodeAt(0);

this way you work with 0 - 25

Ryan McMahon
@Radio-Mac
Nov 19 2016 00:14
Let me try that, see if I can't turn this trainwreck around.
JackVizl
@JackVizl
Nov 19 2016 00:15
@Radio-Mac ur code is pretty much on point tho
Ryan McMahon
@Radio-Mac
Nov 19 2016 00:22
Well that just brings me back to my first problem. My if statements stink. I'm just not sure what to declare there. In my head to check for (A-M) involves checking that it falls into that framework or else checking if it's in the (N-Z) amount. I'm not sure how to properly do that with ASCII.
darkflikk
@darkflikk
Nov 19 2016 00:24
you're so close
Margaret
@Margaret2
Nov 19 2016 00:26

@Radio-Mac
in the first line of your for loop, set temp=str.charCodeAt(i);
then you only need one if statement

if ((temp >= 65) && (temp<= 90)){
            temp = (((temp - 65 + 13) % 26) + 65);
        }

then you can add temp to fullStr

Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 00:28

function lookUpProfile(firstName, prop) {
for (var i = 0; i < contacts.length; i++) {

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

if (firstName !== contacts[i].firstName) {
  return "No such contact";
}

if (contacts[i].hasOwnProperty(prop) === false) {
  return "No such property";    
}

}

}

anyone knows what am i missing here?

Margaret
@Margaret2
Nov 19 2016 00:29
@Radio-Mac the deal is you only need to be changing the actual letters (between 65 and 90), the spaces and punctuation will stay the same
so that's why you only need that one if statement
darkflikk
@darkflikk
Nov 19 2016 00:29
@Radio-Mac do you want a hint which might make it easier for you?
Ryan Williams
@RyWilliams
Nov 19 2016 00:30
@rikilamadrid have to use bracket notation when accessing the firstName argument on the array
Ryan McMahon
@Radio-Mac
Nov 19 2016 00:30
@Margaret2 @darkflikk @sjames1958gm Thank god it worked! That beautiful thing worked!
CamperBot
@camperbot
Nov 19 2016 00:30
radio-mac sends brownie points to @margaret2 and @darkflikk and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 480 | @margaret2 |http://www.freecodecamp.com/margaret2
:cookie: 142 | @darkflikk |http://www.freecodecamp.com/darkflikk
:star2: 4421 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Aaron Bell
@awb715
Nov 19 2016 00:31
anyone up to advanced javascript?
Margaret
@Margaret2
Nov 19 2016 00:31
@Radio-Mac :joy: :smile:
darkflikk
@darkflikk
Nov 19 2016 00:31
@Radio-Mac
function rot13(str) {
    return str.replace(/[A-Z]/g, function(c) {
      return String.fromCharCode(c.charCodeAt(0) + (c <= "M" ? 13 : -13));
  });
}
@Radio-Mac there, a solution ;)
Margaret
@Margaret2
Nov 19 2016 00:31
@darkflikk ooh, that is a cool idea
Ryan McMahon
@Radio-Mac
Nov 19 2016 00:32
@darkflikk Huh, I'll have to run that through Python. I'd be curious to see why that works.
Ryan Williams
@RyWilliams
Nov 19 2016 00:32
gotta love ternaries
darkflikk
@darkflikk
Nov 19 2016 00:32
callbacks <3
ware way better then ternaries
are*
Ryan Williams
@RyWilliams
Nov 19 2016 00:33
:clap: :fire:
darkflikk
@darkflikk
Nov 19 2016 00:33
@RyWilliams but i used ternaries to solve one of the easy switch statement challenges
Margaret
@Margaret2
Nov 19 2016 00:34
@Radio-Mac darkflikk's code finds all the capital letters with a regex /[A-Z]/, then if it is <="M" it adds 13, and if it's >M, it subtracts 13
darkflikk
@darkflikk
Nov 19 2016 00:34
@RyWilliams it said not to use if statements. and one of the tests prevented you to use them. So i used ternary
Ryan Williams
@RyWilliams
Nov 19 2016 00:34
@darkflikk yeah they can really condense the code, smart to do it that way
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 00:34
@RyWilliams am i not using it by writing contacts[i].firstName ?
Margaret
@Margaret2
Nov 19 2016 00:34
@darkflikk i love ternaries, so concise :sparkles:
Ryan Williams
@RyWilliams
Nov 19 2016 00:34
@rikilamadrid contacts[i][firstName]
darkflikk
@darkflikk
Nov 19 2016 00:34
But only when they're small
Ryan Williams
@RyWilliams
Nov 19 2016 00:34
you're using dot notation
Margaret
@Margaret2
Nov 19 2016 00:35
true
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 00:35
@RyWilliams i see. how come using dot notation stops the loop?
darkflikk
@darkflikk
Nov 19 2016 00:36
And for the chiphre challenge i wouldnt use the ternary operation since i'd want it to be expandable. like adding an argument for the shifting
Margaret
@Margaret2
Nov 19 2016 00:37
hey guys have you seen this, a tiny JS program that produces a spinning map
http://aem1k.com/world/
good luck figuring out how it works :joy:
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 00:37
@RyWilliams is not working with brakes notation. using it prints undefined and using dot notation spits out the value
Ryan Williams
@RyWilliams
Nov 19 2016 00:38
@rikilamadrid what's the challenge name?
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 00:38
@RyWilliams profile lookup
Aaron Bell
@awb715
Nov 19 2016 00:40
anyone up to two diff arrays?
REAPERkato
@REAPERkato
Nov 19 2016 00:43

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

// Assignments
STUDLYCAPVAR = 10;
PRoperCAmelCAse = "A String";
tITLEcASEoVER = 9000;
what do i do here..................... it says i have top use camelcase

to*
Margaret
@Margaret2
Nov 19 2016 00:44
@awb715
according to this: https://forum.freecodecamp.com/t/algorithm-diff-two-arrays/16008
you need to concat the arrays, then filter them using the includes() function
Aaron Bell
@awb715
Nov 19 2016 00:44
i dont like looking up answers but im so stuck its dissapointing
Margaret
@Margaret2
Nov 19 2016 00:45
i would have tried to help you more, but i just looked at my own solution and it was so awfully complicated, i'm ashamed of myself :joy:
Moisés Man
@moigithub
Nov 19 2016 00:45
thats hows u write the variable name... ie
lowercase <---
UPPERCASE <---
camelCase <-- each first letter of each word are uppercased except first one @REAPERkato
Margaret
@Margaret2
Nov 19 2016 00:46
@awb715 but you could at least try to do the concat, filter, includes steps without looking at the answer
REAPERkato
@REAPERkato
Nov 19 2016 00:46
ohh thank you
Ryan Williams
@RyWilliams
Nov 19 2016 00:46
@rikilamadrid looking into this now, but you're right you should use dot notation there
Aaron Bell
@awb715
Nov 19 2016 00:46
yea im not gonnalook at the answer and see if i can do it
Ryan Williams
@RyWilliams
Nov 19 2016 00:46
thought the argument was used to access a value rather than be checked against it
Aaron Bell
@awb715
Nov 19 2016 00:47
@Margaret2 see tests make you realize how basic the wikipedia and twitch projects were
Margaret
@Margaret2
Nov 19 2016 00:48
i thought the algorithms were kind of fun actually
even though they can be hard
Aaron Bell
@awb715
Nov 19 2016 00:48
i dont like when i cant figure it out tho haha
Margaret
@Margaret2
Nov 19 2016 00:48
true :joy:
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 00:49
@RyWilliams what do you mean?
@rikilamadrid never mind. got what you meant :D
Ryan Williams
@RyWilliams
Nov 19 2016 00:50
@rikilamadrid :smile:
Aaron Bell
@awb715
Nov 19 2016 00:51
for anyone looking to get a job from learning on fcc its all about networking
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 00:51
@RyWilliams thanks for taking time to help me out. i still can't figure out why the loop stops. shouldn't the arguments passed trough the if statements and if nothing gets hit then go on to the second object and then so on ?
CamperBot
@camperbot
Nov 19 2016 00:51
rikilamadrid sends brownie points to @rywilliams :sparkles: :thumbsup: :sparkles:
:cookie: 321 | @rywilliams |http://www.freecodecamp.com/rywilliams
Aaron Bell
@awb715
Nov 19 2016 00:51
i jus finished my twitch project, networked, and tomorrow i have a skype call about potentially doing some work
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 00:52
@awb715 thats great man. hope you get it. i want to work for a team as a FED so bad ><
Aaron Bell
@awb715
Nov 19 2016 00:53
FED?
i said lets see if i can do it before we agree on terms haah
Emily Christensen
@emmalee113
Nov 19 2016 00:54
please can someone help me with challenge Make Object Properties Private
i've been stuck forever ;(
Margaret
@Margaret2
Nov 19 2016 00:54
@awb715 i am terrible at networking, i have finished the whole front-end certificate, and I know React as well as some Ruby and R, and I still am really overwhelmed about the idea of looking for a job
FED = front end dev
and i would be happy if i could just be a junior dev
Aaron Bell
@awb715
Nov 19 2016 00:55
you should be able to get something then @Margaret2 especially in NY too
networking is as simple as sending an email to someone
i wanna be able to code from anywhre so i can travel
Margaret
@Margaret2
Nov 19 2016 00:56
me too, i would like to work remote
@emmalee113 i will look at it wait a sec
Aaron Bell
@awb715
Nov 19 2016 00:56
if i had the skills you had i would be networking like crazy
not as hard as you think
Margaret
@Margaret2
Nov 19 2016 00:56
@awb715 TERRIFYING
Aaron Bell
@awb715
Nov 19 2016 00:57
can i see your portofolio
Emily Christensen
@emmalee113
Nov 19 2016 00:57
@Margaret2 thanks. let me know if you want to see what i've tried so far but i've tried tons of stuff and nothing is working
CamperBot
@camperbot
Nov 19 2016 00:57
emmalee113 sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
:cookie: 481 | @margaret2 |http://www.freecodecamp.com/margaret2
Margaret
@Margaret2
Nov 19 2016 00:57
@emmalee113 yeah, paste in what you've tried so far
Anders
@Skretch
Nov 19 2016 00:58

Hello I am working on the "Exact Change" challenge and some how my code gets 96.74 - 60 to become 36.739999999999995 O.o
https://jsbin.com/vidaga/edit?js,console

Anyone have any clue how that happens ?

Emily Christensen
@emmalee113
Nov 19 2016 00:58

var Car = function() {
// this is a private variable
var speed = 10;

// these are public methods
this.accelerate = function(change) {
speed += change;
};

this.decelerate = function() {
speed -= 5;
};

this.getSpeed = function() {
return speed;
};
};

var Bike = function() {

// Only change code below this line.

var gear = ();

this.getGear = function();

//unsure what needs to go here

this.setGear = function() {
return gear;
}

};

var myCar = new Car();

var myBike = new Bike();

Ryan Williams
@RyWilliams
Nov 19 2016 00:59
@rikilamadrid yep in theory, I think there's something weird going on with the logic - the first if never evaluates to true
Emily Christensen
@emmalee113
Nov 19 2016 00:59
i guess i understand why accelerate and deccelerate have a function that changes but i dont understand what they're looking for for gear,
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 00:59
@RyWilliams hmm . let me see
Margaret
@Margaret2
Nov 19 2016 01:00
@emmalee113 return gear needs to go inside getGear
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 01:00
@RyWilliams it doesn't if you pass a first name that is not the [0] on the array
@RyWilliams wich is what i find odd since its a loop. it doesn't find it then go on to the second and the third till it hits
Margaret
@Margaret2
Nov 19 2016 01:01
@emmalee113 and setGear needs to have a parameter, so like setGear(value) and then inside you will just set gear = value
Ryan Williams
@RyWilliams
Nov 19 2016 01:02
@rikilamadrid ah because return statements break the loop
Margaret
@Margaret2
Nov 19 2016 01:02
@awb715 i messaged you
Emily Christensen
@emmalee113
Nov 19 2016 01:04
@Margaret2 i'm still so lost...i think i just made it worse lol. would getGear be like...
this.getGear = function(return gear);
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 01:05
@RyWilliams so how can i return something and then work around to keep the loop going?
Margaret
@Margaret2
Nov 19 2016 01:05
this.getGear = function(){
    return gear;
}
@emmalee113
Ryan Williams
@RyWilliams
Nov 19 2016 01:05
@rikilamadrid have to use a nested if statement to check against the second condition
   if (contacts[i].firstName === firstName) {
      if(contacts[i].hasOwnProperty(prop)) {
. . .
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 01:07
@RyWilliams like this:
if (firstName === contacts[i].firstName) { 
  if (contacts[i].hasOwnProperty(prop)) {
  return contacts[i][prop];
  }
}
@RyWilliams still not working
Ryan Williams
@RyWilliams
Nov 19 2016 01:08
yep and after the nested if, you need to return no such property
and then after the loop return no contact found
Emily Christensen
@emmalee113
Nov 19 2016 01:11

@Margaret2 so what is incorrect with this i'm just not getting it..

var Bike = function() {

// Only change code below this line.

var gear = ();
this.getGear = function() {
return gear;
};
this.setGear(value);
gear = value;

};

var myCar = new Car();

var myBike = new Bike();

Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 01:11

@RyWilliams
function lookUpProfile(firstName, prop) {
for (var i = 0; i < contacts.length; i++) {

if (firstName === contacts[i].firstName) { 
  if (contacts[i].hasOwnProperty(prop)) {
    return contacts[i][prop];
  }
  return "No such contact";
}

}

return "No such property";

}

Margaret
@Margaret2
Nov 19 2016 01:12
@emmalee113 this.setGear = function(value)
Bled A
@TUcode
Nov 19 2016 01:12

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

return arr; // Change this line
}

Ryan Williams
@RyWilliams
Nov 19 2016 01:13
@rikilamadrid flip contact and property and you should be golden
Bled A
@TUcode
Nov 19 2016 01:13
var code = function nextInLine(arr, item) {
// Your code here
arr.push();
arr.shift();
return arr; // Change this line
}
Margaret
@Margaret2
Nov 19 2016 01:13
@emmalee113 and i would set var gear equal to a number or something just to be safe
Bled A
@TUcode
Nov 19 2016 01:13
how can i post my code as formatted code ?
Emily Christensen
@emmalee113
Nov 19 2016 01:14
@Margaret2 ugh of course as soon as i just set var gear equal to a number it instantly worked.... thank you for all your help. i was going around in circles all for that
CamperBot
@camperbot
Nov 19 2016 01:14
emmalee113 sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
:warning: emmalee113 already gave margaret2 points
Margaret
@Margaret2
Nov 19 2016 01:14
@TUcode three backticks on separate lines before and after your code
@emmalee113 :D great job!
Bled A
@TUcode
Nov 19 2016 01:14
test
Ricardo Lamadrid
@rikilamadrid
Nov 19 2016 01:15
@RyWilliams that did the work. thank you for your help. any advices to wrap my head around why i needed to nest their statement and take out the return ?
CamperBot
@camperbot
Nov 19 2016 01:15
rikilamadrid sends brownie points to @rywilliams :sparkles: :thumbsup: :sparkles:
:warning: rikilamadrid already gave rywilliams points
Bled A
@TUcode
Nov 19 2016 01:16

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

```// Test Setup

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

Margaret
@Margaret2
Nov 19 2016 01:18
@TUcode hit ctrl+shift+m or click the button with the M on it in the chat box, it will show you how to format the code
OlivierC.
@OlivierCoq
Nov 19 2016 01:20
Hello all. I'm stuck on the palindrome challenge. Can anyone tell me what I'm doing wrong?
function palindrome(str) {
  // Good luck!

//1. Turn str into lower case, no matter what it is. (a man, a plan a canal. panama)  

  str.toLowerCase();

//2. Remove all non-alphanumeric characters (such as commas, spaces, punctuation, etc)
  var newSqze = str.replace(/[^a-z0-9]/gmi,"");

//3. Push all together into an array
  // ["amanaplanacanal.panama"]
  var strToArray = [];

  strToArray = newSqze.split("");
  // ["a,m,a,n,a,p,l,a,n,a,c,a,n,a,l,.,p,a,n,a,m,a"]

//4. create new array with first array reversed. Then turn back into a string

  var flipArray = strToArray.reverse();
  // ["a,m,a,n,a,p,.,l,a,n,a,c,a,n,a,l,p,a,n,a,m,a"]
  var backToStr = flipArray.join("");
  // "amanamp.lanacanalplanama"
//5. If new array and old array reversed are equall, return true. if not, return false. 

  if (backToStr === newSqze) {
    return true;
  }
  else {
    return false;
  }

}

palindrome("A man, a plan, a canal. Panama");
Jan
@burning-monk
Nov 19 2016 01:22
@OlivierCoq for what's the m in the regex
OlivierC.
@OlivierCoq
Nov 19 2016 01:22
multi-line. I should take that out
Took it out; no difference.
Bled A
@TUcode
Nov 19 2016 01:23
function nextInLine(arr, item) {
  // Your code here
  arr.push();
  arr.shift();

  return arr;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 10)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
@Margaret2 WooW finaly
Jan
@burning-monk
Nov 19 2016 01:24
@OlivierCoq and the i?
Ryan Williams
@RyWilliams
Nov 19 2016 01:24
@OlivierCoq need to assign str.toLowerCase(); to str
OlivierC.
@OlivierCoq
Nov 19 2016 01:24
I usually automatically put it whenever I write a regex, for "ignore case"
@RyWilliams I did already, at the beginning of the function
Ryan Williams
@RyWilliams
Nov 19 2016 01:25
@OlivierCoq no you have str.toLowerCase();
it should be str = str.toLowerCase();
Bled A
@TUcode
Nov 19 2016 01:25
ok I need to : Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed. i cant find my "mistakes" can anybody help ?
Ryan Williams
@RyWilliams
Nov 19 2016 01:25
you're not storing the mutation
OlivierC.
@OlivierCoq
Nov 19 2016 01:25
@RyWilliams facepalm. How did i overlook that?????
Thank you, @RyWilliams !!!
CamperBot
@camperbot
Nov 19 2016 01:26
oliviercoq sends brownie points to @rywilliams :sparkles: :thumbsup: :sparkles:
:cookie: 322 | @rywilliams |http://www.freecodecamp.com/rywilliams
OlivierC.
@OlivierCoq
Nov 19 2016 01:26
I thought I was going insane.
Ryan Williams
@RyWilliams
Nov 19 2016 01:26
Trust me I've done that so many time
s
No problem! :+1:
OlivierC.
@OlivierCoq
Nov 19 2016 01:26
You have literally saved me from insanity, my friend.
Stephen James
@sjames1958gm
Nov 19 2016 01:27
@TUcode You need to return the result of the .shift() - either in a variable or directly
Jan
@burning-monk
Nov 19 2016 01:27

  if (backToStr === newSqze) {
    return true;
  }
  else {
    return false;
  }
// is the same as
return (backToStr === newSqze);
@OlivierCoq
OlivierC.
@OlivierCoq
Nov 19 2016 01:28
@burning-monk No, that wasn't the problem. The problem was that I didn't store str when I lowered it to lower case.
Jan
@burning-monk
Nov 19 2016 01:28
@OlivierCoq I know I am just telling you
OlivierC.
@OlivierCoq
Nov 19 2016 01:29
@burning-monk Oh, ok thank you. I will keep that in mind
CamperBot
@camperbot
Nov 19 2016 01:29
oliviercoq sends brownie points to @burning-monk :sparkles: :thumbsup: :sparkles:
:cookie: 486 | @burning-monk |http://www.freecodecamp.com/burning-monk
belacthegreat
@belacthegreat
Nov 19 2016 01:32
I'm new to this IRC as well as JavaScript and i was wondering if anyone could look over my code and see what I'm doing wrong. :)
Jan
@burning-monk
Nov 19 2016 01:33
@OlivierCoq you can do this without arrays
OlivierC.
@OlivierCoq
Nov 19 2016 01:33
How?
Jan
@burning-monk
Nov 19 2016 01:33
@belacthegreat IRC?
belacthegreat
@belacthegreat
Nov 19 2016 01:33
in room chat i'm pretty sure is what it stands for. this chat room basically
Jan
@burning-monk
Nov 19 2016 01:33
@OlivierCoq str.revers()
OlivierC.
@OlivierCoq
Nov 19 2016 01:34
@burning-monk just reverse string?
Bled A
@TUcode
Nov 19 2016 01:34
@sjames1958gm it is returning wrong results ?? I'v change the arr with item again wrong result
OlivierC.
@OlivierCoq
Nov 19 2016 01:34
Ok, yeah. I was wondering about that
Jan
@burning-monk
Nov 19 2016 01:34
@belacthegreat no IRC is something else this is called Gitter
Stephen James
@sjames1958gm
Nov 19 2016 01:34
@TUcode The result of calling arr.shift() you can do return arr.shift() to return what shift returns
belacthegreat
@belacthegreat
Nov 19 2016 01:34
ah well i'm new to Gitter and was wondering if i could send my code and see what's wrong with it lol. It's probably pretty simple considering I just started yesterday
Stephen James
@sjames1958gm
Nov 19 2016 01:35
'''
CamperBot
@camperbot
Nov 19 2016 01:35
:bulb: to format code use backticks! ``` more info
Stephen James
@sjames1958gm
Nov 19 2016 01:35
@belacthegreat click that more info link to see how to format code for this chat (it is pasted code surrounded by ```)
OlivierC.
@OlivierCoq
Nov 19 2016 01:35
CamperBot doesn't play around
Jan
@burning-monk
Nov 19 2016 01:36
@OlivierCoq no sorry that wasn't right
OlivierC.
@OlivierCoq
Nov 19 2016 01:36
Did you try it quickly?
belacthegreat
@belacthegreat
Nov 19 2016 01:36
console.log ("Guess my age!");
var myAge = (Math.floor(Math.random()*100));

switch (myAge) {
  case (myAge === 19) :
    console.log ("Correct! 19 years old!!");
    break;

  case (myAge < 19):
    console.log ("Little too low!!");
    break;

  case (myAge > 19):
    console.log ("Little too high!!");
    break;

  default:
    console.log ("Invalid number.");
    break;

             }
Displays the default no matter what o.o
OlivierC.
@OlivierCoq
Nov 19 2016 01:37
@burning-monk , yeah, the first challenge was to reverse a string. str.reverse() wouldn't work
REAPERkato
@REAPERkato
Nov 19 2016 01:38
how am i suppoed to set the equal remainder of 11 divided by 3 using remainder(%) operator?... this is frustrating
Stephen James
@sjames1958gm
Nov 19 2016 01:38
@belacthegreat Because switch in js just does myAge === with the case value and those are comparisons which are either true or false.
you should use if / else if / else for this type of comparison
@REAPERkato var quotient = 11 / 3; this is how you set quotient equal to 11 divided by 3
Your challenge is almost the same with a couple of substituions
belacthegreat
@belacthegreat
Nov 19 2016 01:39
wouldn't the case value be the random number it generates?
or is case value a set variable only?
Aaron Bell
@awb715
Nov 19 2016 01:39

function diffArray(arr1, arr2) {
  var newArr = [];
  // Same, same; but different.

var con=arr1.concat(arr2);

 con.filter(function(word){

  if(arr1.includes(word) || !arr2.includes(word) ){
    newArr.push(word);
  } else if(!arr1.includes(word) || arr2.inclues(word)){
    newArr.push(word);

  }

 });
whats wrong here
Stephen James
@sjames1958gm
Nov 19 2016 01:39
js will do myAge === (myAge === 19) for the first case.
belacthegreat
@belacthegreat
Nov 19 2016 01:40
oh i see
that makes a lot more sense now.
Stephen James
@sjames1958gm
Nov 19 2016 01:40
@belacthegreat :+1:
Aaron Bell
@awb715
Nov 19 2016 01:40
got it!
wooo
Stephen James
@sjames1958gm
Nov 19 2016 01:40
@TUcode arr.shift() should only be called once
@awb715 :+1:
REAPERkato
@REAPERkato
Nov 19 2016 01:40
im supposed to do var quotient = 11 / 3;
?
it just didnt explain it like that
Stephen James
@sjames1958gm
Nov 19 2016 01:41
This message was deleted
@REAPERkato No that was showing you the structure of your answer
Aaron Bell
@awb715
Nov 19 2016 01:41
somuch more simple than i originally thought @sjames1958gm
REAPERkato
@REAPERkato
Nov 19 2016 01:41
it said in the example math.floor(5 / 2) = 2 (quotient) thats why i am confused lol
Stephen James
@sjames1958gm
Nov 19 2016 01:41
@REAPERkato YEah it is showing you equality not assignment
REAPERkato
@REAPERkato
Nov 19 2016 01:42
@REAPERkato substitute for the / as well
my bad
Aaron Bell
@awb715
Nov 19 2016 01:42
could i have done it like a .map or for loop @sjames1958gm
REAPERkato
@REAPERkato
Nov 19 2016 01:42
i meant thank you
Stephen James
@sjames1958gm
Nov 19 2016 01:42
@REAPERkato var remainder = this is assignement
Bled A
@TUcode
Nov 19 2016 01:42

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

  return arr.shift();  // Change this line
}

// Test Setup
var testArr = [5,6,7,8,9];

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 1)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
REAPERkato
@REAPERkato
Nov 19 2016 01:42
thank you
Bled A
@TUcode
Nov 19 2016 01:42
Write a function nextInLine which takes an array (arr) and a number (item) as arguments. Add the number to the end of the array, then remove the first element of array. The nextInLine function should then return the element that was removed.
Stephen James
@sjames1958gm
Nov 19 2016 01:42
@TUcode arr.shift() remove the first one - arr.shift() mutates the array
@REAPERkato :+1:
Bled A
@TUcode
Nov 19 2016 01:42
first shift is used to remove the first element
Stephen James
@sjames1958gm
Nov 19 2016 01:42
@awb715 forEach would be my choice
@TUcode But the second one also removes the new first element.
Aaron Bell
@awb715
Nov 19 2016 01:43
so for each word, and the the same if else if @sjames1958gm
the filter makes it more confusing
everything is so logical after the fact
Stephen James
@sjames1958gm
Nov 19 2016 01:43
@awb715 Yes. you are using filter for only the looping which is confusing.
Bled A
@TUcode
Nov 19 2016 01:44
correct i have changed that to return arr; but nothing
Stephen James
@sjames1958gm
Nov 19 2016 01:44

@TUcode

arr.push(item)
var x = arr.shift();
return x;

or

arr.push(item);
return arr.shift()
Rodney Guillen
@infrony
Nov 19 2016 01:44
hello
Bled A
@TUcode
Nov 19 2016 01:45
let me try @sjames1958gm
Aaron Bell
@awb715
Nov 19 2016 01:45
so does combinedArray.each(function(word){) @sjames1958gm
something like that?
Stephen James
@sjames1958gm
Nov 19 2016 01:45
@awb715 combinedArr.forEach(function(word) {})
Jan
@burning-monk
Nov 19 2016 01:46
@OlivierCoq solved it?
Aaron Bell
@awb715
Nov 19 2016 01:46
yep
just fixed it
REAPERkato
@REAPERkato
Nov 19 2016 01:47
@sjames1958gm its saying i should use the % operator?

var remainder;

var quotient = 11 % 3;
var remainder = 2;

Bled A
@TUcode
Nov 19 2016 01:48
@sjames1958gm Thanks you that worked but im not able to clarify it i'll try to figure it out.
CamperBot
@camperbot
Nov 19 2016 01:48
tucode sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4422 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Bled A
@TUcode
Nov 19 2016 01:48
Thank you
REAPERkato
@REAPERkato
Nov 19 2016 01:51
??
Aaron Bell
@awb715
Nov 19 2016 01:51
anyone up 2 roman numerals
Margaret
@Margaret2
Nov 19 2016 01:53
nope, that one is awful :P
Aaron Bell
@awb715
Nov 19 2016 01:53
uh ohhhh
Margaret
@Margaret2
Nov 19 2016 01:53
:joy:
Aaron Bell
@awb715
Nov 19 2016 01:53
im guessing it has 2 do with remainder
REAPERkato
@REAPERkato
Nov 19 2016 01:54
marg

@REAPERkato
its saying i should use the % operator?
var remainder;

var quotient = 11 % 3;
var remainder = 2;

Margaret
@Margaret2
Nov 19 2016 01:54
@awb715 i still don't even get how it works
Aaron Bell
@awb715
Nov 19 2016 01:54
lol
jeez haha
Margaret
@Margaret2
Nov 19 2016 01:54
@REAPERkato % returns the remainder that is left after division
Aaron Bell
@awb715
Nov 19 2016 01:55
i need a better console to test out my logic
REAPERkato
@REAPERkato
Nov 19 2016 01:55
how do i go about it though..
i have it typed like that and its saying use % operator
Moisés Man
@moigithub
Nov 19 2016 01:55
u no need quotient variable ..
also var keyword is used to declare/create the variable 1 time
once its created u no need var anymore
javascript do the calc for u.. so u no need set the variable to 2.... just set to the formula
Mohamed Osama Khan
@Assaonator
Nov 19 2016 01:57
ah man this Understand String Immutability is confusing
REAPERkato
@REAPERkato
Nov 19 2016 01:58
@moigithub ok so now how would i set the variable of remainder to 2 and use the % operator?...
Chaitya Shah
@Chaitya62
Nov 19 2016 01:59
Do var remainder = x%y
Stephen James
@sjames1958gm
Nov 19 2016 01:59
@REAPERkato the quotient code was just an example of the format
Moisés Man
@moigithub
Nov 19 2016 01:59
var myvariable = 123 % 22
Stephen James
@sjames1958gm
Nov 19 2016 02:00
@awb715 Roman numerals was a fun one.
Chaitya Shah
@Chaitya62
Nov 19 2016 02:00
And for quotient do var q= x/y
Stephen James
@sjames1958gm
Nov 19 2016 02:00
@Assaonator Make sure you remove the bad code or it wont pass
@awb715 Before writing any code for that one, do some conversion on paper to see how you would do it
It make converting to code easier IMO
Aaron Bell
@awb715
Nov 19 2016 02:02
ok @sjames1958gm so far im at this although i know it would be wrong if the 10ths digit is <5

function convertToRoman(num) {
var x="x";
  if(num/10>1){
  var tens= Math.round(num/10)-1;

}
}

convertToRoman(36);
is roman numerals considered a really ahrd one haah
Mohamed Osama Khan
@Assaonator
Nov 19 2016 02:05
@sjames1958gm what bad code ?
Aaron Bell
@awb715
Nov 19 2016 02:05
@sjames1958gm i need a better console to test code. what do you use
Stephen James
@sjames1958gm
Nov 19 2016 02:06
@awb715 jsbin.com
@Assaonator The code that sets str[0]
Mohamed Osama Khan
@Assaonator
Nov 19 2016 02:06
thanks @sjames1958gm
CamperBot
@camperbot
Nov 19 2016 02:06
assaonator sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4423 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 19 2016 02:07
@Assaonator :+1: That code throws an error which stops the test even with the correct code in there
Aaron Bell
@awb715
Nov 19 2016 02:17
@sjames1958gm

function convertToRoman(num) {
var x="X";
  if(num/10>1){
  var tens= Math.round(num/10)-1;
var remain=num-(10*tens)
var xnum=x.repeat(tens) 
   console.log(remain);

    if(remain/1>1){
      var I="I"
      var ones= remain/1;
      var Inum=I.repeat(ones);

      var finalNum=xnum.concat(Inum);
      console.log(finalNum);
    }
}
}
i have it working ona small scale
the test doesnt confirm for small samples in fcc ho
chunnali
@chunnali
Nov 19 2016 02:25
ive tried hours trying to figure out how to hide api results if user tries to click the search button again with blank text :( can anyone guide me in the right direction? http://codepen.io/chunnali/pen/RoaLmZ?editors=1011
Stephen James
@sjames1958gm
Nov 19 2016 02:26
@awb715 Don't nest your ifs
Aaron Bell
@awb715
Nov 19 2016 02:27
this one is gonna take a while lol
Stephen James
@sjames1958gm
Nov 19 2016 02:28
@chunnali put this at the top of your function
document.getElementById("test").innerHTML = "";
@awb715 tedious :)
chunnali
@chunnali
Nov 19 2016 02:29
@sjames1958gm thank you so much! all this type I’ve been trying to put document.getElementById("test").innerHTML = “"; in a if function =_=;
CamperBot
@camperbot
Nov 19 2016 02:29
chunnali sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4424 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
chunnali
@chunnali
Nov 19 2016 02:29
time*
Aaron Bell
@awb715
Nov 19 2016 02:29
but i need to have global objects
so im confused
Stephen James
@sjames1958gm
Nov 19 2016 02:30
@awb715 You want to process the letter values from largest to smallest top to bottom in your function.
Aaron Bell
@awb715
Nov 19 2016 02:30
yes
in JS bin it works did you see what i did
Barbara
@barb1643
Nov 19 2016 02:43
Help! Can someone explain "WordBlanks in javascript? I don't understand what to do.
CamperBot
@camperbot
Nov 19 2016 02:43
no wiki entry for: can someone explain wordblanks in javascript i dont understand what to do
Barbara
@barb1643
Nov 19 2016 02:44
What?
Stephen James
@sjames1958gm
Nov 19 2016 02:46
@barb1643 The four parameters/variables myNoun, etc will contain words that you combine with other strings
to create a sentence and assign to the result variable.
Walid Ashri
@walidashri
Nov 19 2016 02:46
@barb1643 make a sentence from the function paramters
Stephen James
@sjames1958gm
Nov 19 2016 02:46
@sjames1958gm Using what you learned in this challenge. https://www.freecodecamp.com/challenges/concatenating-strings-with-plus-operator
@walidashri Yo Walid
Walid Ashri
@walidashri
Nov 19 2016 02:47
@sjames1958gm I saw your but I won't let it go after all that typing :)
Stephen James
@sjames1958gm
Nov 19 2016 02:47
lol
Walid Ashri
@walidashri
Nov 19 2016 02:47
@sjames1958gm how you doing
Barbara
@barb1643
Nov 19 2016 02:48
@sjames1958gm I think I did that but it didn't work, I will try again
Stephen James
@sjames1958gm
Nov 19 2016 02:48
@walidashri Good!
Walid Ashri
@walidashri
Nov 19 2016 02:48
@barb1643 watch for spaces
Stephen James
@sjames1958gm
Nov 19 2016 02:48
@barb1643 Make sure there are spaces adjacent to the strings inserted by the variables
Walid Ashri
@walidashri
Nov 19 2016 02:48
@sjames1958gm got you
Walid Ashri
@walidashri
Nov 19 2016 02:49
@sjames1958gm which course you do in codeschool free weekend?
lalith77
@lalith77
Nov 19 2016 02:49
anyone know what im doing wrong here? im trying to print the result of the api call to console
Stephen James
@sjames1958gm
Nov 19 2016 02:51
@walidashri I don't know maybe angular2
Marc M
@Marc-Moeller
Nov 19 2016 02:51
Hola, how do I access the first numer of the second sub array ?
largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
amgad2016
@amgad2016
Nov 19 2016 02:52
hi
i want help

var a = 7;
var b = 7;
var a = b;
var b = a;

// Setup
var a;
var b = 2;

// Only change code below this line

Stephen James
@sjames1958gm
Nov 19 2016 02:52
@flyyyperth How to access the second element of an array?
Aaron Bell
@awb715
Nov 19 2016 02:52
@sjames1958gm hardest part about this is goingto be when you have a number like 34 or 39
Marc M
@Marc-Moeller
Nov 19 2016 02:52
@sjames1958gm yes, how to only select number 13
so second array, first number
Aaron Bell
@awb715
Nov 19 2016 02:53
@flyyyperth do you know how to access the 1 in [0,1,2]
Joseph
@revisualize
Nov 19 2016 02:53
@amgad2016 You're changing code above the line.
Marc M
@Marc-Moeller
Nov 19 2016 02:53
arr[0]
Stephen James
@sjames1958gm
Nov 19 2016 02:53
@walidashri maybe svg stuff
@lalith77 any errors in the console?
Marc M
@Marc-Moeller
Nov 19 2016 02:54
@awb715
Aaron Bell
@awb715
Nov 19 2016 02:54
why 0?
Marc M
@Marc-Moeller
Nov 19 2016 02:54
okay 1
:D
Aaron Bell
@awb715
Nov 19 2016 02:54
okay
so now
[0,1,2],[0,1,2]
how do you access the 2nd array
not any specific number, just the array first
lalith77
@lalith77
Nov 19 2016 02:55
@sjames1958gm nope. just doesnt print anything
Marc M
@Marc-Moeller
Nov 19 2016 02:55
arr[1]
Aaron Bell
@awb715
Nov 19 2016 02:55
right
Marc M
@Marc-Moeller
Nov 19 2016 02:56
top
Aaron Bell
@awb715
Nov 19 2016 02:56
now how did you access the 2nd number in the array before i added the 2nd array
Walid Ashri
@walidashri
Nov 19 2016 02:56
@lalith77 the api link is not right
this works
REAPERkato
@REAPERkato
Nov 19 2016 02:58

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

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

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

Stephen James
@sjames1958gm
Nov 19 2016 02:58
@lalith77 so nothing in the console? Is there more code? Are you sure it is getting to this $.getJSON? do you have jQuery loaded?
Marc M
@Marc-Moeller
Nov 19 2016 02:59
@awb715 arr1
REAPERkato
@REAPERkato
Nov 19 2016 02:59
im confused... its telling me to var fahrenheit and apply the algorithm to assign it?
Aaron Bell
@awb715
Nov 19 2016 03:00
ok
so
...
you accessed the 2nd array
by doing arr1
lalith77
@lalith77
Nov 19 2016 03:00
@sjames1958gm i am sure its getting to the $.getJSON part because i have another log statement right before it ( and it works)
Aaron Bell
@awb715
Nov 19 2016 03:00
then you access the 2nd number by doing arr1
Stephen James
@sjames1958gm
Nov 19 2016 03:00
@lalith77 The console from codepen only shows you the output from console.log - you need to open your devtools to see more
Aaron Bell
@awb715
Nov 19 2016 03:01
arr 1 1
Walid Ashri
@walidashri
Nov 19 2016 03:01
@REAPERkato how to convert Fahrenheit to Celsius
Stephen James
@sjames1958gm
Nov 19 2016 03:01
@REAPERkato So the parameter celsius will contain the value to convert use the formula C * 9/5 + 32 to convert celsius and assign to the fahrenheit variable
REAPERkato
@REAPERkato
Nov 19 2016 03:02
convertToF(celsius)
but where did you get 9/5 + 32 from
lalith77
@lalith77
Nov 19 2016 03:03
@sjames1958gm but im printing the json using console.log. would i still need developer tools?
@REAPERkato thats the formula
Stephen James
@sjames1958gm
Nov 19 2016 03:04
@lalith77 In order to see the error that you are getting, yes.
@REAPERkato The formula is in the instructions
Manish Giri
@Manish-Giri
Nov 19 2016 03:05
@sjames1958gm I have a question about closures, if you have a minute
lalith77
@lalith77
Nov 19 2016 03:05
@sjames1958gm thanks. i see the error
CamperBot
@camperbot
Nov 19 2016 03:05
lalith77 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4425 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Nov 19 2016 03:06
@lalith77 the wiki api allows you to include the origin=* query parameter to get around this error
@Manish-Giri go ahead
Aaron Bell
@awb715
Nov 19 2016 03:06
wow roman numbers is crazy
REAPERkato
@REAPERkato
Nov 19 2016 03:07
this is so confusing
Yusuf Adeyemo
@Yusadolat
Nov 19 2016 03:07
Hello there!!
REAPERkato
@REAPERkato
Nov 19 2016 03:07
omfg
Stephen James
@sjames1958gm
Nov 19 2016 03:07
@Yusadolat Hello
@REAPERkato So the formula is F = C * 9/5 + 32
In the function you can replace the F with fahrenheit and C with celsius - only one line of code
Yusuf Adeyemo
@Yusadolat
Nov 19 2016 03:08
Can someone just tell me where an wrong, I can't access Multidimentional array with indexes
lalith77
@lalith77
Nov 19 2016 03:09
@sjames1958gm thank you
CamperBot
@camperbot
Nov 19 2016 03:09
lalith77 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: lalith77 already gave sjames1958gm points
REAPERkato
@REAPERkato
Nov 19 2016 03:09
convertToF(0) should return a number
convertToF(-30) should return a value of -22
convertToF(-10) should return a value of 14
convertToF(0) should return a value of 32
convertToF(20) should return a value of 68
convertToF(30) should return a value of 86
im done
Stephen James
@sjames1958gm
Nov 19 2016 03:09
@lalith77 :+1:
REAPERkato
@REAPERkato
Nov 19 2016 03:09
idk
im stuck
Manish Giri
@Manish-Giri
Nov 19 2016 03:09
@sjames1958gm
function generator(input) {
  var number = input;
  return function() {
    return number * 2;
  }
}
lalith77
@lalith77
Nov 19 2016 03:10
@REAPERkato what are you stuck on?
REAPERkato
@REAPERkato
Nov 19 2016 03:10
this whole damn problem
Stephen James
@sjames1958gm
Nov 19 2016 03:10
@Manish-Giri ok
REAPERkato
@REAPERkato
Nov 19 2016 03:11

function convertToF(celsius) {
var fahrenheit;

return fahrenheit;
}

convertToF(30);

than i get this
convertToF(0) should return a number
convertToF(-30) should return a value of -22
convertToF(-10) should return a value of 14
convertToF(0) should return a value of 32
convertToF(20) should return a value of 68
convertToF(30) should return a value of 86
thats hwy
Manish Giri
@Manish-Giri
Nov 19 2016 03:11

@sjames1958gm so I get that the nested anon function has access to the number variable, and if you do

var calc = generator(500);
var secondCalc = generator(1000);
console.log(calc());
console.log(secondCalc());

then calc has the value of number as 500 and secondCalc has number as 1000

REAPERkato
@REAPERkato
Nov 19 2016 03:11
why
Manish Giri
@Manish-Giri
Nov 19 2016 03:12
@sjames1958gm meaning, the variable number is sort of "closed" within the inner function, is that what closure is
kinda sketchy on the definition
I mean because you call generator a second time with the value of 1000, it does not override the first value of 500 that remains stored in calc, so- closure?
@sjames1958gm
Stephen James
@sjames1958gm
Nov 19 2016 03:13
@Manish-Giri Yes, that is basically it.
lalith77
@lalith77
Nov 19 2016 03:13
@REAPERkato fahrenheit= (celsius *9/5) +32;
Stephen James
@sjames1958gm
Nov 19 2016 03:13
@Manish-Giri Each call creates a different context so a different number. You don't even need number because it closes over input as well
lalith77
@lalith77
Nov 19 2016 03:14
@REAPERkato you didnt change the value of fahrenheit
Yusuf Adeyemo
@Yusadolat
Nov 19 2016 03:14

@sjames1958gm I'm getting undefined here is the code" var myArray = [[1,2,3], [4,5,6], [7,8,9], [[10,11,12], 13, 14]];

// Only change code below this line.
var myData = myArray[0][0];
myData = [1][8];"

Stephen James
@sjames1958gm
Nov 19 2016 03:15
@Yusadolat you need to change the two 0's to indexes to access I think 8 is it?
Manish Giri
@Manish-Giri
Nov 19 2016 03:15
@sjames1958gm it's the "closes over" thing I don't get. What closes over what again?
Aaron Bell
@awb715
Nov 19 2016 03:16
roman numeral has got to be insane
haha
REAPERkato
@REAPERkato
Nov 19 2016 03:16
@lalith77 lalith, that worked, thank you. but where is the value of fahrenheit lol...
CamperBot
@camperbot
Nov 19 2016 03:16
reaperkato sends brownie points to @lalith77 :sparkles: :thumbsup: :sparkles:
:cookie: 251 | @lalith77 |http://www.freecodecamp.com/lalith77
Stephen James
@sjames1958gm
Nov 19 2016 03:16
@Manish-Giri Yeah, think grabs the context of the function and saves it with the function.
Think of a hand closing over the context, grabbing it to save. Not a great metaphor
Aaron Bell
@awb715
Nov 19 2016 03:16
im just realizing the scope of it all
REAPERkato
@REAPERkato
Nov 19 2016 03:16
they do not explain it clear enough
You are given a variable celsius representing a temperature in Celsius. Use the variable fahrenheit already defined and apply the algorithm to assign it the corresponding temperature in Fahrenheit.
dumb explanation lol
Barbara
@barb1643
Nov 19 2016 03:16
@walidashri @sjames1958gm like this?
Stephen James
@sjames1958gm
Nov 19 2016 03:16
@REAPERkato A common complaint is that they don't explain functions well enough.
REAPERkato
@REAPERkato
Nov 19 2016 03:17
for a beginner, this is killing me...
lalith77
@lalith77
Nov 19 2016 03:17
The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.
Barbara
@barb1643
Nov 19 2016 03:17

@walidashri @sjames1958gm
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line

result = "My + (myNoun) + is (myAdjective) + and (myVerb) + (myAdverb)";

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");

Manish Giri
@Manish-Giri
Nov 19 2016 03:17
@sjames1958gm okay, I'll mull it over. Thanks for the explanation!
CamperBot
@camperbot
Nov 19 2016 03:17
manish-giri sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 4426 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
peith
@peith
Nov 19 2016 03:17

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


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

// Change the inputs below to test your code
convertToF(30);
I can't figure this out
Stephen James
@sjames1958gm
Nov 19 2016 03:18
@barb1643 The variables need to be outside of the string. more like "My " + myNoun + " is " + ...
lalith77
@lalith77
Nov 19 2016 03:18
@peith scroll up. :P
REAPERkato
@REAPERkato
Nov 19 2016 03:18
they explained it above for me
Walid Ashri
@walidashri
Nov 19 2016 03:18
please @sjames1958gm
:point_up: November 19, 2016 7:07 AM @peith
peith
@peith
Nov 19 2016 03:19
hahaha
wow, I only didn't add parentheses
Barbara
@barb1643
Nov 19 2016 03:19
@sjames1958gm I did that and I got a lot of red x
Stephen James
@sjames1958gm
Nov 19 2016 03:20
@barb1643 You took that as a pattern, not as the absolute code?
@barb1643 let's see what you did
Barbara
@barb1643
Nov 19 2016 03:22

ok @sjames1958gm function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line

result = "My" + myNoun + "is" myAdjective + "and" myVerb + myAdverb"";

// Your code above this line
return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");

Tyler Langan
@TylerL-uxai
Nov 19 2016 03:22
Hey :)
Yusuf Adeyemo
@Yusadolat
Nov 19 2016 03:22
@barb1643 This is how i solves mine and it works fine function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result = "myNoun + " "+ myAdjective+ " "+myVerb + " " + myAdverb;
// Your code above this line
return result;
}
// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:22
How many documents from mongodb should I limit to a page?
Barbara
@barb1643
Nov 19 2016 03:22
How do I get it to copy in black? like others do on here?
Joseph
@revisualize
Nov 19 2016 03:23
@barb1643 dopeoplewritelikethis?
Stephen James
@sjames1958gm
Nov 19 2016 03:23
@barb1643 make sure there are spaces in the extra strings so there spaces adjacent to the variables.
Also you have to have + between all the parts
@revisualize dope ople?
Joseph
@revisualize
Nov 19 2016 03:23
@sjames1958gm meh.
Stephen James
@sjames1958gm
Nov 19 2016 03:23
@revisualize that's what I saw earlier when you typed that :)
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:24
@barb1643 it should say "My " + myNoun + " is " (with spaces before and after the words)
@barb1643 type ``` before and after your code. The key next to 1234 on your keyboard
Barbara
@barb1643
Nov 19 2016 03:25
@revisualize I guess i do hahah i see my mistake.. its confusing cuz you don't know what you are doing ! At least I'm on the right track.. right?
Joseph
@revisualize
Nov 19 2016 03:25
@sjames1958gm So, I just ordered this: https://www.amazon.com/Logitech-Wireless-Mouse-Large-Computer/dp/B003NR57BY/ I hope it doesn't suck.
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:25
like this
Is anyone here good at mongodb?
Yusuf Adeyemo
@Yusadolat
Nov 19 2016 03:25
@barb1643 This is how i solves mine and it works fine function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result = "myNoun + " "+ myAdjective+ " "+myVerb + " " + myAdverb;
// Your code above this line
return result;
}
// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");
Joseph
@revisualize
Nov 19 2016 03:25

How to do code block format:
```js [SHIFT+ENTER]
// your code here
``` [CTRL+ENTER or CMD+ENTER to send]
Please do not confuse `s with 's.
Also note that the ```s need to each be on their own lines
The ` key can usually be found on most keyboards up next to the 1 key.
If you hit SHIFT+` it will give you the ~.
Example:
```
code
```
...
Output:

var code = undefined;

...
You can also do inline code formatting:
A string of text with a `variable` or `other bit of code`.
Output:
A string of text with a variable or other bit of code.

Stephen James
@sjames1958gm
Nov 19 2016 03:26
@revisualize Good for non-president elect size hands :)
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:26
thanks @revisualize !
CamperBot
@camperbot
Nov 19 2016 03:26
tylerl-uxai sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2351 | @revisualize |http://www.freecodecamp.com/revisualize
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:27
My question is as follows: When I load documents from mongodb, should there be a limit?
Allisha
@lazershark4PrimeMinister
Nov 19 2016 03:27

Hey folks, I'm almost finished 'Make Object Properties Private', the only part of the challenge I can't figure out is how to have multiple returns. I can return 4; but I also need to return 3; and return 1;

I tried to make an array but I guess returns don't work like that, eh::

var Bike = function() {
var gear = 10; //private

//these are both public
this.getGear = function (change) {
return 4;
};

this.setGear = function() {

};

};

var myCar = new Car();

var myBike = new Bike(4, 3, 1);

Tyler Langan
@TylerL-uxai
Nov 19 2016 03:28
inside setGear, do another return
I'm guessing
Allisha
@lazershark4PrimeMinister
Nov 19 2016 03:29
The return has to be specific to myBike.getGear()
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:29
I'll check out the challenge. Give me a chance to read it first
Allisha
@lazershark4PrimeMinister
Nov 19 2016 03:29
I appreciate it
Joseph
@revisualize
Nov 19 2016 03:29
@TylerL-uxai Anything else? I don't really know MongoDB though.
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:30
Sarah, can you please tell me the title again? I'm not finding "Make Object Properties Private"
Yusuf Adeyemo
@Yusadolat
Nov 19 2016 03:30
@TylerL-uxai what the problem i have onced work with mongodd
Walid Ashri
@walidashri
Nov 19 2016 03:30
@lazersharkPM getGear to grt gear value , setGear to change gear value
黄心雨
@wongxinyu
Nov 19 2016 03:30
// Example
function ourTrueOrFalse(isItTrue) {
  if (isItTrue) { 
    return "Yes, it's true";
  }
  return "No, it's false";
}

// Setup
function trueOrFalse(wasThatTrue) {

  if(wasThatTrue){
    return "Yes,that was true";
  }
  return "No,that was false";

}

// Change this value to test
trueOrFalse(true);
trueOrFalse(false);
it can't pass
what's wrong,
help~
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:31
thanks @Yusadolat ! :) My question is how many documents I can load maximum from mongodb
so it won't slow down the user experience
Allisha
@lazershark4PrimeMinister
Nov 19 2016 03:31
@TylerL-uxai it's under object oriented functional programing: Make Object Properties Private
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:31
doh
omg so much distraction from this woman talking next to me. Can't concentrate >_<
ok she won't stop talking
Walid Ashri
@walidashri
Nov 19 2016 03:34
@wongxinyu you just need space after ,
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:35
sorry @lazersharkPM
Yusuf Adeyemo
@Yusadolat
Nov 19 2016 03:35
@TylerL-uxai As far as I can tell, the upper limit is constrained by how much RAM you have available on the server, as long as it's a 64-bit build of Mongo. The 32-bit build is limited to 2gb size per process.
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:35
okay so this.word is the object property. You can also create those whasdfafsd omg
Allisha
@lazershark4PrimeMinister
Nov 19 2016 03:35
No worries. I just don't get why return (4, 3, 1); I guess I could set up conditions?
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:36
I hate my roommates so much
Yusuf Adeyemo
@Yusadolat
Nov 19 2016 03:36
@TylerL-uxai A mentor of mine load 1 billion document with mongoDB
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:37
@lazersharkPM a method is used to construct objects
anything is an object
in javascript
so the word method is always used when making new objects
you're adding properties to your object inside the Bike method
because you are making a function, right? But it's a function for creating this new variable... so it's called a method
new variable object
oh nice @Yusadolat . No lag on older computers though?
ok
so you go like this
myBike.setGear(4)

var Bike = function(parameter) {

// Only change code below this line.
return parameter;
};

//returns 4
uh
or not
Joseph
@revisualize
Nov 19 2016 03:40
@TylerL-uxai Not everything in JS is an object. That's a bit of BS.
黄心雨
@wongxinyu
Nov 19 2016 03:40
omg!thank you very much! @walidashri ,excellent observer!
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:40
oh really?
yeah idk man
what isn't an object in js?
Joseph
@revisualize
Nov 19 2016 03:41
Everything can be accessed like an object.
Prototype Inheritance.
Jan
@burning-monk
Nov 19 2016 03:41
is undefined an object?
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:42
that's the one thing I never figured out in js
I think sarah's gone
Allisha
@lazershark4PrimeMinister
Nov 19 2016 03:42
ok, so I've created a bike constructor. The point is to have public and private properties that are set to specific values. The this.getGear = function () {
needs to return 3 results
Allisha
@lazershark4PrimeMinister
Nov 19 2016 03:43
return 4, return 3, return 1. That's why I figured an array would work
Jan
@burning-monk
Nov 19 2016 03:43
yah
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:43
do you know what a parameter is yet, sarah?
Joseph
@revisualize
Nov 19 2016 03:43
Where did I put my.. ... hmmm.. brb.
OH!
here

Parameters are variables that represent the values that get passed into your function from the function call.
https://cs.wellesley.edu/~cs110/lectures/L16/images/function-anatomy.png
Notice how the variables level and score in the function definition addScore are called parameters.
However, when we invoke the function like in:
addScore(3, 10) or addScore(6, 20)
the values are called arguments. Here is an important lesson:
You define a function with parameters, you call a function with arguments.

Another example of this:

function hello(fName, uName) {
     return "Hello " + fName + " " + uName + ", How is your day?";
}
hello("Joseph", "@revisualize"); // "Hello Joseph @revisualize, How is your day?"
hello("Bella", "@bellaknoti"); // "Hello Bella @bellaknoti, How is your day?"
hello("Andy", "@dirn"); // "Hello Andy @dirn, How is your day?"

You can use the fName and uName parameters just like a variable inside of your function.

Other important things to remember:
* A function can have zero parameters. You still have to use the parentheses to define it.
* A function might have no return statements. In this case we say that the function returns undefined.

@lazersharkPM -^^
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:44
setGear is the property of Bike. So this.setGear should return the parameter, I assume
Jan
@burning-monk
Nov 19 2016 03:44
whats that with this numbers like this CS110?
are the courses standardized?
Stephen
@iStephenXX
Nov 19 2016 03:45
Need help! I'm currently doing the "Find the Length of a String" challenge, where I set lastNameLength = 8, and lastNameLength = lastName.length; But it wont let me move on, it keeps saying "You should be getting the length of lastName by using .length, which I have :\
Tyler Langan
@TylerL-uxai
Nov 19 2016 03:45
good luck sarah, I'm out
I completed the challenge but it was like 4 months ago and they erased all the work I had saved
Jan
@burning-monk
Nov 19 2016 03:46
@revisualize I've seen that in people's vita earlier have courses just numbers?
Joseph
@revisualize
Nov 19 2016 03:47
@burning-monk Did you just say words?
What?
Jan
@burning-monk
Nov 19 2016 03:47
what?
Joseph
@revisualize
Nov 19 2016 03:48
What a Vita?
Is that some type of coffee size?
Jan
@burning-monk
Nov 19 2016 03:48
resume?
Allisha
@lazershark4PrimeMinister
Nov 19 2016 03:48
Ok, this is terrible but I understand what you're saying completely. Within the function ( parameter 4, para3, p1), can I then have individual returns for them? I think I may be too lazy for coding
Jan
@burning-monk
Nov 19 2016 03:48
curriculum vitae?
Allisha
@lazershark4PrimeMinister
Nov 19 2016 03:48
That image is worth like 10 FCC challenges btw
Joseph
@revisualize
Nov 19 2016 03:48
OH! Vitae.
Stephen
@iStephenXX
Nov 19 2016 03:49
Nevermind, I figured it out :] It wanted me to add the lastName.length to the lastNameLength, so I += it on there and it worked!!
Joseph
@revisualize
Nov 19 2016 03:49
@burning-monk Yes.. College classes have numbers associated with them and they are kind of standardized.
Question.. Does this AK47 make me look stupid?
Jan
@burning-monk
Nov 19 2016 03:50
so like course 110 is on all schools the same?
are you asking me?
Joseph
@revisualize
Nov 19 2016 03:50
No.
Yes Vlad. I was cracking a joke.
Jan
@burning-monk
Nov 19 2016 03:51
so wellesley is a college is it a real coole or online one?
Joseph
@revisualize
Nov 19 2016 03:52
@burning-monk It's a real school.
Jan
@burning-monk
Nov 19 2016 03:52
and you can study there computer science?
Jan
@burning-monk
Nov 19 2016 03:53
yeah or on any other college
Joseph
@revisualize
Nov 19 2016 03:53
@burning-monk Wellesley College
It's a real college.
Jan
@burning-monk
Nov 19 2016 03:54
look we only have universities where you can study
Jan
@burning-monk
Nov 19 2016 03:54
we have school and then university
so you can only study computer science at university
Joseph
@revisualize
Nov 19 2016 03:55
No.
Where do you live?
Vlad?
Jan
@burning-monk
Nov 19 2016 03:55
germany
Joseph
@revisualize
Nov 19 2016 03:55
OH! Where?
I used to live in Mannheim.
Jan
@burning-monk
Nov 19 2016 03:56
augsburg
it's close to munich
what did you do in Mannheim?
Joseph
@revisualize
Nov 19 2016 03:56
@burning-monk My mom married an asshole that was in the Army and he got stationed over there.
Jan
@burning-monk
Nov 19 2016 03:57
ok so it is quite a bit ago
Joseph
@revisualize
Nov 19 2016 03:57
@burning-monk Yeah. During the fall of the wall.
Jan
@burning-monk
Nov 19 2016 03:57
and how long did you stay?
Joseph
@revisualize
Nov 19 2016 03:57
I've been to Munich.
2years.
Jan
@burning-monk
Nov 19 2016 03:57
yeah I lived in Munich
@revisualize and how good are your german skills?
Joseph
@revisualize
Nov 19 2016 03:58
So, here in the US. You can take CS classes in 2 year college or 4 year Uni.
@burning-monk I can count. and say a few bad words.
Jan
@burning-monk
Nov 19 2016 03:58
lol
Joseph
@revisualize
Nov 19 2016 03:58
I can't count that high. To like 29.
cthuluspoke
@cthuluspoke
Nov 19 2016 03:59
howdy, anyone awake and wants to look at some code that isn't working? :)
Joseph
@revisualize
Nov 19 2016 03:59
Guten Tag, Guten Morgen and just a few other words.
Jan
@burning-monk
Nov 19 2016 03:59
dreißig not anymore?
Joseph
@revisualize
Nov 19 2016 03:59
@burning-monk Shizercof and a few otheres.
Jan
@burning-monk
Nov 19 2016 04:00
what's shizercof?
Joseph
@revisualize
Nov 19 2016 04:00
@burning-monk Aren't you German?
it's :shit: + head
Jan
@burning-monk
Nov 19 2016 04:00
yes but that's not german
cthuluspoke
@cthuluspoke
Nov 19 2016 04:00
function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
  switch(val){
      case val === 1:
        answer= "alpha";
      break;
    case val === 2:
        answer= "beta";
      break;
    case val === 3:
        answer="gamma";
      break;
    case val === 4:
        answer= "delta";
  }



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

// Change this value to test
caseInSwitch(1);
Jan
@burning-monk
Nov 19 2016 04:01
ah scheißkopf lol
Joseph
@revisualize
Nov 19 2016 04:01
whatever.
Jan
@burning-monk
Nov 19 2016 04:01
can anyone go to college?
cthuluspoke
@cthuluspoke
Nov 19 2016 04:01
can someone help me with why this one is not returning properly?
Joseph
@revisualize
Nov 19 2016 04:01
@burning-monk $$$
@cthuluspoke you need to change your case.
case 1:
case 2:
cthuluspoke
@cthuluspoke
Nov 19 2016 04:02
i see
Jan
@burning-monk
Nov 19 2016 04:02
you have to pay fo every college?
Joseph
@revisualize
Nov 19 2016 04:02
case's aren't if's
@burning-monk I think so. Or you can apply for a grant.
cthuluspoke
@cthuluspoke
Nov 19 2016 04:02
i thought i was supposed to use "===" ! it seemed to imply that in the instructions.
Joseph
@revisualize
Nov 19 2016 04:02
There are Federal grants.
cthuluspoke
@cthuluspoke
Nov 19 2016 04:02
thanks @revisualize
CamperBot
@camperbot
Nov 19 2016 04:02
cthuluspoke sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
Jan
@burning-monk
Nov 19 2016 04:02
and community colleges?
CamperBot
@camperbot
Nov 19 2016 04:02
:star2: 2352 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 19 2016 04:03
@burning-monk Yeah. There are grants and scholarships and stuff.
@burning-monk But, now with how much knowledge is available online for free to anyone. It seems kind of silly to me.
Barbara
@barb1643
Nov 19 2016 04:03
Thank you @revisualize @sjames1958gm and @Yusadolat
CamperBot
@camperbot
Nov 19 2016 04:04
barb1643 sends brownie points to @revisualize and @sjames1958gm and @yusadolat :sparkles: :thumbsup: :sparkles:
:cookie: 66 | @yusadolat |http://www.freecodecamp.com/yusadolat
:star2: 2353 | @revisualize |http://www.freecodecamp.com/revisualize
:star2: 4427 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Joseph
@revisualize
Nov 19 2016 04:05
@cthuluspoke You can do evaluations in switch cases but, if you're doing that .. You should really be writing an if / else if / else
James Moore
@James-N-M
Nov 19 2016 04:11
use backticks, they are next to the 1 and above the tab key on your keyboard
3 backticks, shift+enter, paste code, shift+enter, 3 backticks
`````
cthuluspoke
@cthuluspoke
Nov 19 2016 04:12
case values are tested with strict equality (===). The break tells JavaScript to stop executing statements. If the break is omitted, the next statement will be executed.
James Moore
@James-N-M
Nov 19 2016 04:12

function mutation(arr) {
  arr[0].toLowerCase(); 
  arr[1].toLowerCase();

  var slut = arr[1].split("");


  for(var i = 0 ; i < slut.length; i++)
  {
    if(arr[1].indexOf(slut[i]) == -1)
    {
      return false; 
    }
  }

  return true; 
}

mutation(["hello", "neo"]);
cthuluspoke
@cthuluspoke
Nov 19 2016 04:12
made me think i needed to use === in the case statement
James Moore
@James-N-M
Nov 19 2016 04:13
Anyone know whats wrong with my code for the mutation problem ?
i dont pass three of the cases
Hiyabeto
@Hiyabeto
Nov 19 2016 04:13
Any one help me whit this?

<style>
.red-text {
color: red;
}
.font-size {
font-size: 16px;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>

<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

<p>purr jump eat the grass rup the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

Im new to coding
cthuluspoke
@cthuluspoke
Nov 19 2016 04:13
@hyabeto , what's the prob?
Hiyabeto
@Hiyabeto
Nov 19 2016 04:14
It wont execute the font size of paragraph number 2
or p element 2
cthuluspoke
@cthuluspoke
Nov 19 2016 04:14
you have to put <p class="font-size"> bla bla</p>
Hiyabeto
@Hiyabeto
Nov 19 2016 04:15
it says you cant Between the style tags, give the p elements font-size of 16px. Browser and Text zoom should be at 100%.
Do not add a class attribute to the second p element.
cthuluspoke
@cthuluspoke
Nov 19 2016 04:16
i'm not grokking, if you are not supposed to add a class attribute to the second p element then why are you trying to do so?
oh ok
Hiyabeto
@Hiyabeto
Nov 19 2016 04:17
because it says give the p elements (both) font sizes of 16px
cthuluspoke
@cthuluspoke
Nov 19 2016 04:17

p {
font-size:16px
}
that's what you do
in between the <style> </style> tags
dont' forget the ";" like i just did :P
Hiyabeto
@Hiyabeto
Nov 19 2016 04:18
THANKS! :)
it passed it:)
cthuluspoke
@cthuluspoke
Nov 19 2016 04:19
cool beans
yw
Hiyabeto
@Hiyabeto
Nov 19 2016 04:19
mind if i add you if i ever need any more help?
Vishal-von-Neumann
@Vishal-von-Neumann
Nov 19 2016 04:20

I am stuck in "word blanks" -:
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
result= "My" + myNoun + "is" + myAdjective + "and" + myVerb + myAdverb;

return result;
}

// Change the words here to test your function
wordBlanks("dog", "big", "ran", "quickly");

This is not working ??

Joseph
@revisualize
Nov 19 2016 04:21
@Vishal-von-Neumann Dopeoplewritelikethis?
Maybe add spaces?
cthuluspoke
@cthuluspoke
Nov 19 2016 04:22
@Hiyabeto sure, add me if you like :)
@Vishal-von-Neumann yeah , there are spaces missing, read what they want as output carefully
@Vishal-von-Neumann i was having problems wit h that one also
@Vishal-von-Neumann http://www.pythontutor.com/javascript.html <-- it's convenient to test your code here also
Vishal-von-Neumann
@Vishal-von-Neumann
Nov 19 2016 04:25
ok.. understood .. Thanks..
Joseph
@revisualize
Nov 19 2016 04:34
Okay. I just ordered a new wireless mouse. This one sucks.
cthuluspoke
@cthuluspoke
Nov 19 2016 04:39
@revisualize , which model did you get?
Joseph
@revisualize
Nov 19 2016 04:40
@cthuluspoke Logitech M510 Wireless Mouse
cthuluspoke
@cthuluspoke
Nov 19 2016 04:41
i've got the m185
came w/ a keyboard
had problems with it getting interference from wifi. fixed that by changing the channel the wifi was on.
it would stutter and the keyboard would get sticky whenever i was downloading anything.
hopefully you wont run into such a problem. but if you do , now you know what is causing it.
Joseph
@revisualize
Nov 19 2016 04:43
@cthuluspoke Does it scroll up when you try to scroll down?
cthuluspoke
@cthuluspoke
Nov 19 2016 04:43
@revisualize it did when i was using it on a Mac. this is remedied in settings.
Joseph
@revisualize
Nov 19 2016 04:43
@cthuluspoke I got this.. https://www.amazon.com/gp/product/B01AWGCPIG/ and it SUCKS
cthuluspoke
@cthuluspoke
Nov 19 2016 04:44
lol @revisualize BUT IT LOOKS TOO RAD TO SUCK! ;P
Joseph
@revisualize
Nov 19 2016 04:44
:|
I just want it to do what a mouse does.
cthuluspoke
@cthuluspoke
Nov 19 2016 04:44
are you on a Mac?
if so , the scrolling can be remedied in mouse settings
either way , Mac or whatever else , seems like a settings issue
Joseph
@revisualize
Nov 19 2016 04:45
@cthuluspoke Ubuntu 16.04
viviz
@zhiwuwu
Nov 19 2016 04:45
I am stuck in "Stand in Line" -: function queue(arr, item) {
// Your code here
var a = arr.shift();
arr.push(item);
item = a;
return item; // Change this line
}
Joseph
@revisualize
Nov 19 2016 04:46
@zhiwuwu You're shifting too early.
cthuluspoke
@cthuluspoke
Nov 19 2016 04:47
so i guess you have checked mouse settings in ubuntu?
i think the whole opposite-scrolling thing is initiated when "natural scrolling" is checked
Joseph
@revisualize
Nov 19 2016 04:47
@cthuluspoke I don't like the damn thing.
cthuluspoke
@cthuluspoke
Nov 19 2016 04:47
understood
Joseph
@revisualize
Nov 19 2016 04:47
It works sometimes.
cthuluspoke
@cthuluspoke
Nov 19 2016 04:47
it's ... very pointy.
Joseph
@revisualize
Nov 19 2016 04:47
Then others it doesn't.
cthuluspoke
@cthuluspoke
Nov 19 2016 04:48
you never know, it could be your WiFi interfering . that is a thing
Joseph
@revisualize
Nov 19 2016 04:48
Could be. My router does sit on my desk.
REAPERkato
@REAPERkato
Nov 19 2016 04:49
var myStr = "I am a\"double quoted" String inside "double quotes\".";

SyntaxError: missing ; before statement

You should use two double quotes (") and four escaped double quotes (\").
Variable myStr should contain the string: I am a "double quoted" string inside "double quotes".

idk why this is confusing right now
cthuluspoke
@cthuluspoke
Nov 19 2016 04:49
@REAPERkato myStr should start and end with a single quote
aka '
at least that's how i remember the problem
Joseph
@revisualize
Nov 19 2016 04:50
@REAPERkato e "do
You're missing two of them.
cthuluspoke
@cthuluspoke
Nov 19 2016 04:51
sorry i was thinking of the next excercize
REAPERkato
@REAPERkato
Nov 19 2016 04:51
lol where
this is irritating for some reason right now
cause it shouldnt be this hard
cthuluspoke
@cthuluspoke
Nov 19 2016 04:51
afterr quoted and double
the 2nd double
REAPERkato
@REAPERkato
Nov 19 2016 04:52
var myStr = "I am a\"double quoted""String inside""double quotes\".";
still wrong
cthuluspoke
@cthuluspoke
Nov 19 2016 04:52
no , you're missing a \
Joseph
@revisualize
Nov 19 2016 04:52
@REAPERkato Yes.
cthuluspoke
@cthuluspoke
Nov 19 2016 04:52
two of them
Joseph
@revisualize
Nov 19 2016 04:52
You're not escaping two of your quotes.
REAPERkato
@REAPERkato
Nov 19 2016 04:53
quoted and insde?
inside
*
cthuluspoke
@cthuluspoke
Nov 19 2016 04:53
after the d in quoted
and before the " for the next instance of the word double
Joseph
@revisualize
Nov 19 2016 04:53
@REAPERkato Look at your code from left to right.
You use \" to escape a quote.
You're doing "" to try and escape two quotes but, you're using \" to escape two quotes.
Why are you doing two of them correctly and two of them incorrectly?
REAPERkato
@REAPERkato
Nov 19 2016 04:55
var myStr = "I am a\"double quoted\"\"String inside""double quotes\".";
idk.. im new to coding
idk what im doing wrong
cthuluspoke
@cthuluspoke
Nov 19 2016 04:56
var myStr = "I am a\"double quoted\" String inside \"double quotes\".";
Coy Sanders
@coymeetsworld
Nov 19 2016 04:56
you didn't escape all the quotes @REAPERkato
REAPERkato
@REAPERkato
Nov 19 2016 04:59
i had to add a few spaces but i got it. thank you guys
cthuluspoke
@cthuluspoke
Nov 19 2016 04:59
np
HappyMeerkat
@HappyMeerkat
Nov 19 2016 05:02
can anyone explain nesting for loops to me, i'm literally dumbfounded
Joseph
@revisualize
Nov 19 2016 05:03
@HappyMeerkat I have a document.
HappyMeerkat
@HappyMeerkat
Nov 19 2016 05:04
thanks, ill have a read!
thanks @revisualize
CamperBot
@camperbot
Nov 19 2016 05:08
happymeerkat sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2354 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Nov 19 2016 05:08
@HappyMeerkat Does it make sense? Do I need to modify anything?
REAPERkato
@REAPERkato
Nov 19 2016 05:12
lmao im such a noob
var myStr = '<a href=''http://www.example.com' 'target=''_blank''>Link</a>';
with single quotes
'
var myStr = "<a href=\"http://www.example.com\" target=\"_blank\">Link</a>";
thats it reset
Aarya Bhorra
@aarya1302
Nov 19 2016 05:17
hey guys how do i access and argument outside the function parameter
it kinda looks like this function()()
How do I access both brackets when calling the function
heroiczero
@heroiczero
Nov 19 2016 05:20
@aarya1302 return a function within a function thats how i did it
Aarya Bhorra
@aarya1302
Nov 19 2016 05:21
@heroiczero can you give me an example please
?
heroiczero
@heroiczero
Nov 19 2016 05:22
function A(){
return function B(){
}
}
@aarya1302 u could do it that way or u could try recursive
Joseph
@revisualize
Nov 19 2016 05:25
@aarya1302 closure.
Aarya Bhorra
@aarya1302
Nov 19 2016 05:25
@revisualize thanks
CamperBot
@camperbot
Nov 19 2016 05:25
aarya1302 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2355 | @revisualize |http://www.freecodecamp.com/revisualize
Aarya Bhorra
@aarya1302
Nov 19 2016 05:25
@heroiczero thanks
CamperBot
@camperbot
Nov 19 2016 05:25
aarya1302 sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:cookie: 405 | @heroiczero |http://www.freecodecamp.com/heroiczero
Joseph
@revisualize
Nov 19 2016 05:26
Look at the makeAdder function on that page.
Aarya Bhorra
@aarya1302
Nov 19 2016 05:29
Thanks again guys that was really helpful
anyone tell me why the quoteButton on this piece of shite isnt being disabled
silver537
@silver537
Nov 19 2016 05:41
return ({hi: 'people'}.hi.toUpperCase())
lalith77
@lalith77
Nov 19 2016 05:46
Anyone know if i can modify the value of a variable declared in an outer function from the inner function ? and make the change persist?
Darth Skywalker
@adityaparab
Nov 19 2016 05:47
@lalith77 :
var x = 10;
function changeX(){
  x=15;
}

console.log(x); // 10
changeX();
console.log(x); //15
silver537
@silver537
Nov 19 2016 05:47
^
lalith77
@lalith77
Nov 19 2016 05:48
@adityaparab i tried doing that, but apparently this creates asynch events? and causes some errors
Darth Skywalker
@adityaparab
Nov 19 2016 05:49
@lalith77 : Async events? I don't see any async in the example above.
may be you're referring to your code.
can you share?
Joseph
@revisualize
Nov 19 2016 05:49
@silver537 Interesting. I haven't seen that before.
lalith77
@lalith77
Nov 19 2016 05:49
yes. my code kindof followed the same pattern
Joseph
@revisualize
Nov 19 2016 05:49
But, it makes sense.
lalith77
@lalith77
Nov 19 2016 05:49
1 min
Darth Skywalker
@adityaparab
Nov 19 2016 05:50
I'm assuming something like
var data;

$,getJSON('some/url', (response) => {
  data=response;
});

console.log(data);
and you're expecting the console.log to output the response but what you get is undefined.
not undefined but the value is the one that was initialized
Sergey Lukin
@not-a-cylon
Nov 19 2016 05:54

@JackVizl try this:

$(".quoteButton").attr("disabled","true");

Darth Skywalker
@adityaparab
Nov 19 2016 05:54
yeah.. that is correct @lalith77
lalith77
@lalith77
Nov 19 2016 05:54
@adityaparab were you talking to me?
Darth Skywalker
@adityaparab
Nov 19 2016 05:54
yes
lalith77
@lalith77
Nov 19 2016 05:54
oh
Darth Skywalker
@adityaparab
Nov 19 2016 05:54
@lalith77
because your $.getJSON is async
lalith77
@lalith77
Nov 19 2016 05:55
is that not a normal function?
Darth Skywalker
@adityaparab
Nov 19 2016 05:55
so by the time you change value of arr and len, your console.log of outer function has already been executed
lalith77
@lalith77
Nov 19 2016 05:56
ok. so should i just pass the variables that i want as arguments to a function?
Darth Skywalker
@adityaparab
Nov 19 2016 05:56
It is normal from the Javascript point of view.
But if you have some background in functional/sync programming languages (C/C++/Java/PHP etc). then you'd find it abnormal
Mohamed Osama Khan
@Assaonator
Nov 19 2016 05:56
function myReusableFunction() {
  console.log("Hi World");
}

myReusableFunction("Hi World");
some please explain what I"m doing wrong?
Darth Skywalker
@adityaparab
Nov 19 2016 05:56

@lalith77

ok. so should i just pass the variables that i want as arguments to a function?

Depends, what you're trying to achieve?

JackVizl
@JackVizl
Nov 19 2016 05:57
@not-a-cylon worked like a charm, thankyou
CamperBot
@camperbot
Nov 19 2016 05:57
jackvizl sends brownie points to @not-a-cylon :sparkles: :thumbsup: :sparkles:
:cookie: 300 | @not-a-cylon |http://www.freecodecamp.com/not-a-cylon
Mohamed Osama Khan
@Assaonator
Nov 19 2016 05:57
I'm*
body*
lalith77
@lalith77
Nov 19 2016 05:57
@adityaparab i need those variables to run the loop each time 'enter' is pressed
@Assaonator what are you trying to do?
Mohamed Osama Khan
@Assaonator
Nov 19 2016 05:58
Write Reusable JavaScript with Functions
lalith77
@lalith77
Nov 19 2016 05:58
your function doesnt take any arguments.
Darth Skywalker
@adityaparab
Nov 19 2016 05:59
@lalith77 : Yes, I believe that is what is happenning currently with your code
JackVizl
@JackVizl
Nov 19 2016 05:59
@not-a-cylon how come i cant use #quoteButton though?
Darth Skywalker
@adityaparab
Nov 19 2016 05:59
@Assaonator
function myReusableFunction(msg) {
  console.log(msg);
}

myReusableFunction("Hi World"); // Hi World
lalith77
@lalith77
Nov 19 2016 05:59
@adityaparab thank you
CamperBot
@camperbot
Nov 19 2016 05:59
lalith77 sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 707 | @adityaparab |http://www.freecodecamp.com/adityaparab
Darth Skywalker
@adityaparab
Nov 19 2016 06:00
@lalith77 you might as well wanna run a $(".links").empty() before you start the loop
so that the links from previous query get wiped out.
currently they're getting added at the bottom.
Mohamed Osama Khan
@Assaonator
Nov 19 2016 06:01
@adityaparab still nothing...
Darth Skywalker
@adityaparab
Nov 19 2016 06:02
@Assaonator : What's the error?
Sergey Lukin
@not-a-cylon
Nov 19 2016 06:02
@JackVizl because your button only has a class quoteButton
#quoteButtonactually points to the div that wraps around it.
Mohamed Osama Khan
@Assaonator
Nov 19 2016 06:02

function myReusableFunction(msg) {
console.log(msg);
}

myReusableFunction("Hi World"); // Hi World

JackVizl
@JackVizl
Nov 19 2016 06:03
i see
Mohamed Osama Khan
@Assaonator
Nov 19 2016 06:03
reusableFunction is not defined
JackVizl
@JackVizl
Nov 19 2016 06:03
@not-a-cylon how would i re enable it?
lalith77
@lalith77
Nov 19 2016 06:03
@adityaparab ok. thanks
CamperBot
@camperbot
Nov 19 2016 06:03
:warning: lalith77 already gave adityaparab points
lalith77 sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
Darth Skywalker
@adityaparab
Nov 19 2016 06:05

@lalith77 : Now try to level up your UI usability game a bit

Currently I'm improving these two

This one is to be handled from the keyboard as well :P
shoot me some suggestions if you have any
Sergey Lukin
@not-a-cylon
Nov 19 2016 06:07
@JackVizl $(".quoteButton").attr("disabled",false); to re-enable it seems to work, though I'm not sure why you'd want to disable it in the first place.
JackVizl
@JackVizl
Nov 19 2016 06:07
how do i make it so you cant get a new quote until everything is loaded
@not-a-cylon so you cant spam the quote button
Sergey Lukin
@not-a-cylon
Nov 19 2016 06:08
ah
@JackVizl take a look at the "The jqXHR Object" section at http://api.jquery.com/jquery.getjson/
It allows you to hook up a handler that fires off once the object is completely loaded.
JackVizl
@JackVizl
Nov 19 2016 06:11
@not-a-cylon try the link yourself, its easy to screw the whole thing up by samming thebutton
Sergey Lukin
@not-a-cylon
Nov 19 2016 06:11
.complete
JackVizl
@JackVizl
Nov 19 2016 06:11
@not-a-cylon exactly what i needded, thank you
CamperBot
@camperbot
Nov 19 2016 06:11
jackvizl sends brownie points to @not-a-cylon :sparkles: :thumbsup: :sparkles:
:warning: jackvizl already gave not-a-cylon points
lalith77
@lalith77
Nov 19 2016 06:13
@adityaparab they look good. I see you have the guessing part as well!
the yellow one seems to be running a little faster somehow
Mohamed Osama Khan
@Assaonator
Nov 19 2016 06:15
?
I'm having difficulties with Write Reusable JavaScript with Functions
lalith77
@lalith77
Nov 19 2016 06:16
@Assaonator could you share the pen?
Mohamed Osama Khan
@Assaonator
Nov 19 2016 06:16

// Example
function ourReusableFunction() {
console.log("Heyya, World");
}

ourReusableFunction();

// Only change code below this line
function myReusableFunction(msg) {
console.log(msg);
}

myReusableFunction("Hi World"); // Hi World

I'm getting an error message that says reusableFunction is not defined
lalith77
@lalith77
Nov 19 2016 06:19
delete the ourReusableFunction()
@not-a-cylon
why dis not work
Janarthan
@janarthanmano
Nov 19 2016 06:20
shift() I am using this array function in JS, but getting error shift is not a function. Can anyon help me whats wrong here?
lalith77
@lalith77
Nov 19 2016 06:22
@janarthanmano share your code
Ryan Ledford
@rledford
Nov 19 2016 06:23
@janarthanmano seems like youre calling shift on an uninitialized array object.
__mifflin__
@cdrainxv
Nov 19 2016 06:27

@Assaonator:

I'm getting an error message that says reusableFunction is not defined

Your function should be called reusuableFunction

Janarthan
@janarthanmano
Nov 19 2016 06:29
Thanks Ryan ledford, I fixed it. You are right.
Ryan Ledford
@rledford
Nov 19 2016 06:31
@janarthanmano yw
Sergey Lukin
@not-a-cylon
Nov 19 2016 06:35
@JackVizl not sure why .complete() doesn't work, but .done() does. Try that.
Mohamed Osama Khan
@Assaonator
Nov 19 2016 06:36
@cdrainxv I'm still confused
JackVizl
@JackVizl
Nov 19 2016 06:36
@not-a-cylon i must be doing something wrong
its still not working
Mohamed Osama Khan
@Assaonator
Nov 19 2016 06:36

// Example
function ourReusableFunction() {
  console.log("Heyya, World");
}

ourReusableFunction();

// Only change code below this line


reusuableFunction("Hi World");
JackVizl
@JackVizl
Nov 19 2016 06:36
$.ajaxSetup({
  cache: false
});

/*function pickFont() {

  fontList = ["", "'Ranga', cursive","'Shrikhand', cursive", "'Indie Flower', cursive","'Arvo', serif", "'Lobster', cursive", "'Cormorant Garamond', serif", "'Gloria Hallelujah', cursive", "'Pacifico', cursive","'Dancing Script', cursive"]; //0 fonts

  randFont = fontList[Math.ceil(Math.random() * 10)];
  curFont=$("body").css("font-family");
  alert(  randFont.replace(/'/g, "")+curFont  );
  //alert(curFont.replace(/'/g, "")+" "+randFont);
  if(randFont.replace(/'/g, "")== curFont) {
 //alert(curFont+ randFont);
    pickFont();
  }

  $("body").css("font-family", randFont);
}*/

function getQuote() {

  $.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1", function(json) {
    var res='N/A';
    $("#quote").html(json[0].content);
    $("#author").html(json[0].title);
   // .done(){callback(res);}
  });
}

function changeColour() {

  colrList = ["#000000", "rgb(128, 0, 32)", "rgb(120,165,163)", "rgb(34,49,92)", "rgb(251,101,66)", "rgb(162, 57, 202)", "rgb(89,130,52)", "rgb(81, 82, 97)", "rgb(80,81,96)", "rgb(255,187,0)", "rgb(55,55,55)"];
  //blue, bright red, green, shadow, yellow, aqua, purple

  randNum = Math.ceil(10 * Math.random());
  curCol = $("body").css("background-color");
  randCol = colrList[randNum];

  if (randCol == curCol) {
    changeColour();
  }
 // lastCol = randCol;

  $("body").animate({
    backgroundColor: randCol
  });

  $(".quote, #author").animate({
    color: randCol
  });
  $(".quote, #author").animate({
    color: randCol
  });

}

$(document).ready(function() {

  //pickFont();
  changeColour();
  getQuote();

  $("#quoteButton").on("click", function() {



    $("#quoteButton").effect("bounce", "slow");

 $(".quoteButton").attr("disabled","true");

    //pickFont();
    getQuote();
    changeColour();



    ajax().done(function(){
   $(".quoteButton").removeAttr("disabled")});



  });

});
@not-a-cylon oh im an idiot forgot the $.
Sergey Lukin
@not-a-cylon
Nov 19 2016 06:38
lulz
If you're running chrome, you can pull open the console, and it will troubleshoot some of this stuff for you.
It should be able to catch missing $, parentheses, etc.
__mifflin__
@cdrainxv
Nov 19 2016 06:41
@Assaonator: Your function should be called reusableFunction instead of myReusableFunction… anywhere you all myReusableFunction with reusableFunction.
Mohamed Osama Khan
@Assaonator
Nov 19 2016 06:47
@cdrainxv
function reusableFunction() {
  console.log("Heyya, World");
}

reusuableFunction("Hi World");
Ryan Ledford
@rledford
Nov 19 2016 06:50
@Assaonator your function declaration does not take or use any arts so passing Hi World to it does nothing with that arg
Just something to note.
Mohamed Osama Khan
@Assaonator
Nov 19 2016 06:50
how do I Call reusableFunction after you define it
how do I call a reusableFuction after defining it*
Sergey Lukin
@not-a-cylon
Nov 19 2016 06:51
@Assaonator you've got a typo in there.
Ryan Ledford
@rledford
Nov 19 2016 06:51
You're not calling the right function though. The name differs from declaration when you're trying to call it
reusuableFunction should be reusableFunction. You have an extra u in there.
WKhaw
@vickyhaw94
Nov 19 2016 06:54
function nextInLine (arr, item){
arr = arr .push(item);
var returnValue = arr.shift();
return returnValue;
}
What I want to do is add the item to the end of the array then remove the first item from array and return the "remove item" ?
I wondering what wrong with the code i do?
Any help will be appreciate!
Mohamed Osama Khan
@Assaonator
Nov 19 2016 06:54
function functionName() {
  console.log();
}

reusableFunction("Hi World");
__mifflin__
@cdrainxv
Nov 19 2016 06:54
@Assaonator: Look at the example provided…
  • your function shouldn’ take any arguments at all:
    reusuableFunction();
  • also make sure both of your spelling are correct both here:
    function reusableFunction() {
    And here:
    reusuableFunction();
  • console.log("Heyya, World");
    is wrong… look at instruction number 1
@vickyhaw94: The space b/t arr and .push(item);
WKhaw
@vickyhaw94
Nov 19 2016 06:56
@cdrainxv sry that is my typo but the actual code is ```
chunnali
@chunnali
Nov 19 2016 06:57
hey yall, if anyone is awake, check out my wiki viewer! I just finished it ^^ http://codepen.io/chunnali/full/RoaLmZ/
WKhaw
@vickyhaw94
Nov 19 2016 06:57
arr = arr.push(item)
Mohamed Osama Khan
@Assaonator
Nov 19 2016 06:58
:S
Markus Kiili
@Masd925
Nov 19 2016 07:01
@vickyhaw94 Check what is the return value of push method.
__mifflin__
@cdrainxv
Nov 19 2016 07:02

@Assaonator: reset the challenge and follow the example. Write your code below the example:

  • create a function called reusableFunction
  • in the function `console.log("Hi World");
  • call the function to run it

This is almost exactly like the example, the only differences being the name of the function and the text you want to log.

Markus Kiili
@Masd925
Nov 19 2016 07:03
@vickyhaw94 Array mutator methods that change the array in place usually return something else than the mutated array.
WKhaw
@vickyhaw94
Nov 19 2016 07:09
@Masd925 Thanks for helping!!
CamperBot
@camperbot
Nov 19 2016 07:09
vickyhaw94 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 2956 | @masd925 |http://www.freecodecamp.com/masd925
Mohamed Osama Khan
@Assaonator
Nov 19 2016 07:10
function functionName() {
  console.log("Hi World");
}
functionName();
Ive been looking at the screen for some time now trying to figure out what I did wrong
WKhaw
@vickyhaw94
Nov 19 2016 07:12

Method 1

function returnArr (arr, item){
arr = arr.push(item);
return arr;
}

Method 2

function returnArr(arr, item){
arr.push(item);
return arr;
}

Can anyone explain to me what is the difference between method 1 and method 2?
How come method 2 is correct and method 1 is false?
Thanks!

LydaTech
@lydatech
Nov 19 2016 07:13
@Assaonator there isnt anything wrong with the code if all you want to do is output Hi World
bensch5000
@bensch5000
Nov 19 2016 07:15
hey guys. just finished the wiki viewer task. would love to get some feedback from you: https://s.codepen.io/sebastian-bensch/debug/amgOEr
Diane
@106Ch213
Nov 19 2016 07:16
hello guys, I've been stuck on the bouncer challenge for a little while. I can't seem to get rid of the "" and null values in the filtered array. I also feel like I'm doing this in a "barbaric way" so if you guys have any idea what's the "cleanest" code in this situation let me know please :D. Here is my code :
function bouncer(arr) {
  // Don't show a false ID to this bouncer.

  function filterFalsyValue(arr) {

    if (typeof(arr) === "string" || typeof(arr) === "number" && arr !=="" && arr !==null)  {
    //if (arr !== undefined && typeof(arr) !== 'boolean' && !isNaN(arr) && arr!== null) {            
      return true;

    } else {
    return false;
    }
  }

var bouncer = arr.filter(filterFalsyValue);

  return bouncer;
}

bouncer([1, null, NaN, 2, undefined]);
Mohamed Osama Khan
@Assaonator
Nov 19 2016 07:16
How do I Call a reusableFunction after defining it
__mifflin__
@cdrainxv
Nov 19 2016 07:17
@Assaonator: replace functionName with reusableFunction as per instructions.
Mohamed Osama Khan
@Assaonator
Nov 19 2016 07:17
@cdrainxv thanks!
CamperBot
@camperbot
Nov 19 2016 07:17
assaonator sends brownie points to @cdrainxv :sparkles: :thumbsup: :sparkles:
:star2: 1018 | @cdrainxv |http://www.freecodecamp.com/cdrainxv
Ryan Ledford
@rledford
Nov 19 2016 07:25
I see you're using filter but you should declare a filter outside the scope of the bouncer function if you want to call it from outside the scope of the bouncer function.
Diane
@106Ch213
Nov 19 2016 07:31
hmm I'll try different configurations thanks
Markus Kiili
@Masd925
Nov 19 2016 07:31
@106Ch213 NaN is the problem. FCC console just shows it as null.
Remove the typeof checks and figure out checks for the falsies.
@106Ch213 You can declare the callback function inside or outside the bouncer function.
Ogundele Olumide
@Lumexralph
Nov 19 2016 07:34
@vickyhaw94 the first method works only that push() method returns the lenght value of the arr, so that means arr = arr.push(item), item will be added to arr but since you're assigning the return value of push method which is the length of arr after the item is added, arr = arr.length
@Masd925 hey bro! good morning
Markus Kiili
@Masd925
Nov 19 2016 07:35
@Lumexralph Hi.
Jeff Greenlee
@JeffGreenlee42
Nov 19 2016 07:39
hello world
CamperBot
@camperbot
Nov 19 2016 07:39

welcome to FreeCodeCamp @JeffGreenlee42!

Vittoria Towery
@VittoriaTowery
Nov 19 2016 07:39
can I ask for help?
Markus Kiili
@Masd925