These are chat archives for FreeCodeCamp/HelpJavaScript

12th
Jan 2017
Jason Luboff
@JLuboff
Jan 12 2017 00:00
@apalm1341 For it to be an internet webpage as opposed to an intranet webpage, you would need to either host it on a internet accessable webserver or create whats known as portforwarding on your router to allow outside access.
@apalm1341 Yes, that would be your internal network
Also known as a LAN
SparkZer0
@SparkZer0
Jan 12 2017 00:01
I just stumbled on a :bug: but wanted to ask if this happened to some of you doing the jquery tasks. Sometimes the output of the code is in the tasks
TypeError: "#target3".addClass is not a function
Aaron
@apalm1341
Jan 12 2017 00:01
Ok
Angel G.
@angel2318
Jan 12 2017 00:01
'''js
CamperBot
@camperbot
Jan 12 2017 00:01
:bulb: to format code use backticks! ``` more info
Aaron
@apalm1341
Jan 12 2017 00:01
Technically it could be either LAN and/or WLAN???
Jason Luboff
@JLuboff
Jan 12 2017 00:01
@SparkZer0 It should be $("#target3").addClass("class name");
@apalm1341 Yes, WLAN would also apply
Aaron
@apalm1341
Jan 12 2017 00:02
Ok cool
SparkZer0
@SparkZer0
Jan 12 2017 00:02
@JLuboff Yeah that is what I did and it sent me through BUT for some odd reason it switched after completing the addClass it changed to this error.
Aaron
@apalm1341
Jan 12 2017 00:02
So how would I know if I am not hosting it??
SparkZer0
@SparkZer0
Jan 12 2017 00:02
This happenend in one of the tasks for some odd reason
Angel G.
@angel2318
Jan 12 2017 00:02

'''js
function nextInLine(arr, item) {
// Your code here

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

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

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

CamperBot
@camperbot
Jan 12 2017 00:02
:bulb: to format code use backticks! ``` more info
Jason Luboff
@JLuboff
Jan 12 2017 00:02
@SparkZer0 Eh, not sure then lol
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:02
@angel2318 backticks ``
SparkZer0
@SparkZer0
Jan 12 2017 00:02
why doesnt the backtick for js work ?
Jason Luboff
@JLuboff
Jan 12 2017 00:03
@apalm1341 You would have to setup rules on your router to allow it
Aaron
@apalm1341
Jan 12 2017 00:03
And how would I know if I am not portforwarding like u mentioned???
Manish Giri
@Manish-Giri
Jan 12 2017 00:03
@angel2318 .shift() doesn't take any arguments..
Angel G.
@angel2318
Jan 12 2017 00:03

function nextInLine(arr, item) {
  // Your code here

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

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
Jason Luboff
@JLuboff
Jan 12 2017 00:03
@apalm1341 You would have to specifically go into your router and set it up. It would not be setup by default. It requires IP address and port information
Angel G.
@angel2318
Jan 12 2017 00:03
yei
SparkZer0
@SparkZer0
Jan 12 2017 00:04
You do not need to put in item. shift() itself removes the very first item of the array so there is no need to say item.
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:04
@angel2318 return the element you removed from arr using shift(), the argument is ignored. don't put an argument
@angel2318 cool, progress, now make the adjustments
mitron6
@mitron6
Jan 12 2017 00:05
@angel2318 return arr.shift();
johnboland91
@johnboland91
Jan 12 2017 00:06
I am working on palindrome function.
What's wrong?
function palindrome(str) {
str.toLowerCase().replace(/[\W_]+/g, "");
return str == str.split("").reverse().join("");
}
Angel G.
@angel2318
Jan 12 2017 00:06
function nextInLine(arr, item) {
  // Your code here

  arr.push();
  return arr.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, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
like that?
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:06
@angel2318 push item to arr
mitron6
@mitron6
Jan 12 2017 00:06
@angel2318 But you need to arr.push(item)
Angel G.
@angel2318
Jan 12 2017 00:07
YEIIII
mitron6
@mitron6
Jan 12 2017 00:07
@mitron6 Even if you get this to work, play with it a little more until you are sure you understand it.
Angel G.
@angel2318
Jan 12 2017 00:07
i still don't get it :smile:
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:07
@johnboland91 str.toLowerCase().replace(/[\W_]+/g, ""); a new string is returned here, you need to store it, strings are immutable
mitron6
@mitron6
Jan 12 2017 00:08
@angel2318 arr.push(item) adds item to the end of the array. Does that make sense to you?
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:08
@angel2318 get what?
Thomas Adams
@thomasfadams
Jan 12 2017 00:08
need help
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.
Angel G.
@angel2318
Jan 12 2017 00:08
how does it work? @Lumexralph
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:08
@angel2318 you're not pushing anything to the array arr
Thomas Adams
@thomasfadams
Jan 12 2017 00:09
heres the code provided:

function nextInLine(arr, item) {
// Your code here

return item; // Change this line
}

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

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

Ogundele Olumide
@Lumexralph
Jan 12 2017 00:09
@thomasfadams that's what am doing with @angel2318
Thomas Adams
@thomasfadams
Jan 12 2017 00:09
must be a difficult one then lol
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:09
@angel2318 push works by taking arguments that it puts to the end of the array...like you previously did
mitron6
@mitron6
Jan 12 2017 00:10

@angel2318

> arr = [1,2,3]  
[1, 2, 3]
> arr.push(4)
4
> arr
[1, 2, 3, 4]

Does this help explain push?

Ogundele Olumide
@Lumexralph
Jan 12 2017 00:10
@thomasfadams it's not, just semantics
Angel G.
@angel2318
Jan 12 2017 00:10
and what does that have to do with queue?
mitron6
@mitron6
Jan 12 2017 00:11

@angel2318

> arr
[1, 2, 3, 4]
> arr.shift()
1
> arr
[2, 3, 4]

Does this help explain shift?

Joseph
@revisualize
Jan 12 2017 00:11
@thomasfadams Add the number (item) to the end of the array (arr). How do you add a number (item) to the end of an array (arr)?
johnboland91
@johnboland91
Jan 12 2017 00:11
@Lumexralph THANKS!
CamperBot
@camperbot
Jan 12 2017 00:11
johnboland91 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 714 | @lumexralph |http://www.freecodecamp.com/lumexralph
Thomas Adams
@thomasfadams
Jan 12 2017 00:11
@revisualize using push
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:11
@angel2318 because in a queue , you join the end of the line
Joseph
@revisualize
Jan 12 2017 00:12
@thomasfadams then remove the first element of array (arr) ... How do you remove the first element from an array (arr)? What does this method return?
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:12
@angel2318 push does samething too
mitron6
@mitron6
Jan 12 2017 00:12
@angel2318 I'm out of ideas to help explain but these other guys here are good explainers. Hope they can help you.
Angel G.
@angel2318
Jan 12 2017 00:12
@Lumexralph :/
mitron6
@mitron6
Jan 12 2017 00:13
@angel2318 Unless you have a specific questions..
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:13
@angel2318 have you made the adjustments?
Thomas Adams
@thomasfadams
Jan 12 2017 00:13
still dont get it lol
Angel G.
@angel2318
Jan 12 2017 00:13
yeah, I already completed the challenge @Lumexralph
Thomas Adams
@thomasfadams
Jan 12 2017 00:14
do i put arr.push() and item.shift() in the function?
Angel G.
@angel2318
Jan 12 2017 00:14
but a I want to understand it better
Joseph
@revisualize
Jan 12 2017 00:14
@thomasfadams First off. You aren't pushing correctly.
@thomasfadams Second item is not an array.
@thomasfadams Add the number (item) to the end of the array (arr). How do you add a number (item) to the end of an array (arr)?
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:14
@angel2318 no appreciation to us for the sweat? huh
N4yNay
@N4yNay
Jan 12 2017 00:15
I'm on JavaScript and I was told to change the variables and assignments to camelcase. I did but I'm still getting an error.
Pieter Stokkink
@forkerino
Jan 12 2017 00:15
@N4yNay Show us your camels!
Thomas Adams
@thomasfadams
Jan 12 2017 00:15
@revisualize arr.push(item);?
mitron6
@mitron6
Jan 12 2017 00:15
@N4yNay You should change them to camelCase instead. :)
Joseph
@revisualize
Jan 12 2017 00:15
@thomasfadams Yes.
@thomasfadams What is the answer to the other question?
@thomasfadams then remove the first element of array (arr) ... How do you remove the first element from an array (arr)? What does this method return?
rossi1
@rossi1
Jan 12 2017 00:16
please guys im still stuck here

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

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

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

Angel G.
@angel2318
Jan 12 2017 00:16
jjajaja, sorry man I'm really thankful that your helping me with this. @Lumexralph
N4yNay
@N4yNay
Jan 12 2017 00:16

// Declarations
var studlyCAPVAR;
var properCAMELCASE;
var titleCASEOVER;

// Assignments
studlyCAPVAR = 10;
properCAMELCASE = "A String";
titleCASEOVER = 9000;

Thomas Adams
@thomasfadams
Jan 12 2017 00:16
arr.shift()?
mitron6
@mitron6
Jan 12 2017 00:16
@N4yNay Not camelCase.
Thomas Adams
@thomasfadams
Jan 12 2017 00:17
@revisualize arr.shift()?
Joseph
@revisualize
Jan 12 2017 00:17
@rossi1 You're declaring fahrenheit ... You're doing nothing with it. You're creating some convertToF variable and giving it a bunch of math operations. ... But then you return celsius ? Which you haven't modified.
@thomasfadams And the answer to the other question?
Pieter Stokkink
@forkerino
Jan 12 2017 00:17
@N4yNay you want to start every word after the first with a capital, but the rest of the letters should just be lowercase. thisIsCamelCase
Thomas Adams
@thomasfadams
Jan 12 2017 00:17
whats the other question?
i thought i just answered it
N4yNay
@N4yNay
Jan 12 2017 00:18
Isn't it supposed to be first word lowercase and following words capitalized... because that's what is has shown here...
Joseph
@revisualize
Jan 12 2017 00:18
@thomasfadams then remove the first element of array (arr) ... How do you remove the first element from an array (arr)? What does this method return?
Pieter Stokkink
@forkerino
Jan 12 2017 00:18
@N4yNay nope
@N4yNay otherwise this code would've passed.
Joseph
@revisualize
Jan 12 2017 00:18
@thomasfadams You only answered half of that set of questions.
Martine Ross
@moi238
Jan 12 2017 00:18
@rossi1 basically you've just got to swap the equation around so it equals Celsius. e.g Celsius=
N4yNay
@N4yNay
Jan 12 2017 00:18
Alright, thanks guys. How do I tell them that there is an error in their example?
Thomas Adams
@thomasfadams
Jan 12 2017 00:19
not sure what else im supposed to do, heres what I put:
Joseph
@revisualize
Jan 12 2017 00:19
@moi238 actually you don't.
Thomas Adams
@thomasfadams
Jan 12 2017 00:19

function nextInLine(arr, item) {
// Your code here
arr.push(item);
arr.shift();
return item; // Change this line
}

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

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

return item?
Martine Ross
@moi238
Jan 12 2017 00:20
@revisualize it worked for me
mitron6
@mitron6
Jan 12 2017 00:20
@N4yNay Can you show a like of the error? I didn't notice it before.
Pieter Stokkink
@forkerino
Jan 12 2017 00:20

@N4yNay This is straight from the instructions:

Best Practice
Write variable names in Javascript in camelCase. In camelCase, multi-word variable names have the first word in lowercase and the first letter of each subsequent word is capitalized.

Joseph
@revisualize
Jan 12 2017 00:20

@thomasfadams Do you understand that this is a set of TWO questions. The second relates to the first.

@thomasfadams then remove the first element of array (arr) ... How do you remove the first element from an array (arr)? What does this method return?

mitron6
@mitron6
Jan 12 2017 00:21
@N4yNay This is not an error. It is a good definition of camelCase. As @forkerino suggests.
Thomas Adams
@thomasfadams
Jan 12 2017 00:21
right but I dont know what "What does this method return?" means exactly
Joseph
@revisualize
Jan 12 2017 00:21
@thomasfadams The shift() method removes the first element from an array and returns that element.
Thomas Adams
@thomasfadams
Jan 12 2017 00:21
@revisualize I appreciate the help im just not understanding it and I really want to get it
ok
Joseph
@revisualize
Jan 12 2017 00:22
@thomasfadams So, return what is returned from your .shift() and just have it all on one line.
Thomas Adams
@thomasfadams
Jan 12 2017 00:22
so...?
so do i type return arr.shift();?
Joseph
@revisualize
Jan 12 2017 00:22
@thomasfadams Do you?
@thomasfadams Did that work?
Thomas Adams
@thomasfadams
Jan 12 2017 00:23
no
Joseph
@revisualize
Jan 12 2017 00:23
@thomasfadams Are you doing .shift() twice?
Thomas Adams
@thomasfadams
Jan 12 2017 00:23
no just once
Joseph
@revisualize
Jan 12 2017 00:23
Show me.
Thomas Adams
@thomasfadams
Jan 12 2017 00:23

function nextInLine(arr, item) {
// Your code here
arr.push(item);
arr.shift();
return item; // Change this line
}

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

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

Joseph
@revisualize
Jan 12 2017 00:23
You're not returning the .shift()
Thomas Adams
@thomasfadams
Jan 12 2017 00:24
when i typed return arr.shift() it didnt work though
Joseph
@revisualize
Jan 12 2017 00:24
Show me.
Thomas Adams
@thomasfadams
Jan 12 2017 00:24

function nextInLine(arr, item) {
// Your code here
arr.push(item);
arr.shift();
return arr.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, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));

Joseph
@revisualize
Jan 12 2017 00:24
@thomasfadams Are you doing .shift() twice?
Yes. Yes you are.
Thomas Adams
@thomasfadams
Jan 12 2017 00:25
so that doesnt work then
Joseph
@revisualize
Jan 12 2017 00:25
@thomasfadams You're not supposed to remove two elements from the array. Just one.
@thomasfadams Delete your first shift
Thomas Adams
@thomasfadams
Jan 12 2017 00:26
that worked
finally, thanks @revisualize
CamperBot
@camperbot
Jan 12 2017 00:26
thomasfadams sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2936 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 12 2017 00:26
@thomasfadams Do you understand WHY it worked?
Do you understand what these methods do?
Do you understand why you can't .shift() twice for his challenge?
Do you understand that method (usually) have a return value?
Do you understand that you can do NOTHING with that return value or you can do something with the returned value?

The push() method adds one or more elements to the end of an array and returns the new length of the array.

The pop() method removes the last element from an array and returns that element.

The shift() method removes the first element from an array and returns that element.

The unshift() method adds one or more elements to the beginning of an array and returns the new length of the array.

Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 00:28
can somebody help me my code for factorialize a number is not working
Thomas Adams
@thomasfadams
Jan 12 2017 00:28
ah ok ill just need to study that then
Joseph
@revisualize
Jan 12 2017 00:28
@thomasfadams Do you understand that .push() returns the new length of the array but, you chose to do nothing with it.
Thomas Adams
@thomasfadams
Jan 12 2017 00:28
yeah i think so
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 00:29

function factorialize(num) {
  for (var i = 1; i < num; i++){
   return i * (i + 1);
  }
}

factorialize(5);
it is not working
Thomas Adams
@thomasfadams
Jan 12 2017 00:29
when you say returns the new length of the array where is it returning that info to? The console or do I have to type "return _"?
cjljohnson
@cjljohnson
Jan 12 2017 00:29
@unlawfulspoonisback you are returning during your loop
@thomasfadams it returns it to whatever called the function
Joseph
@revisualize
Jan 12 2017 00:30

@thomasfadams Question:

function getName() { return "Happy Feet" }
var name = getName();
console.log(name);

What do you think is output to the console when you log the variable name?
Why do you think that is?

Vinicius Miranda da Silva
@vmsilva19
Jan 12 2017 00:30
hello everyone
Thomas Adams
@thomasfadams
Jan 12 2017 00:30
Happy Feet
Vinicius Miranda da Silva
@vmsilva19
Jan 12 2017 00:30
i'm kind stucked in this class "Returning Boolean Values from Functions"
mitron6
@mitron6
Jan 12 2017 00:30
@unlawfulspoonisback This does not work. You are right.
Vinicius Miranda da Silva
@vmsilva19
Jan 12 2017 00:31

function isLess(a, b) {
// Fix this code
if (a < b) {
return true;
} else {
return false;
}
}

// Change these values to test
isLess(10, 15);

mitron6
@mitron6
Jan 12 2017 00:31
@mitron6 You have to finish the calculation before you return it.
@mitron6 Looks like it always returns a 2
Vinicius Miranda da Silva
@vmsilva19
Jan 12 2017 00:31
I don't figure out how to return true/false without if/else
Instructions
Fix the function isLess to remove the if/else statements.
cjljohnson
@cjljohnson
Jan 12 2017 00:32
@vmsilva19 you can return an evaluation
mitron6
@mitron6
Jan 12 2017 00:32
@vmsilva19 Just return the part inside the () after if.
Jason Luboff
@JLuboff
Jan 12 2017 00:32
@vmsilva19 What is the result of a < b?
Joe Escobedo
@joeEscob1023
Jan 12 2017 00:32
I dont know how to use the escape sequences ..
Thomas Adams
@thomasfadams
Jan 12 2017 00:32
@revisualize Happy Feet right?
Joe Escobedo
@joeEscob1023
Jan 12 2017 00:32
like i have no idea on where to put them
mitron6
@mitron6
Jan 12 2017 00:32
@vmsilva19 if (a < 5) ... so just return a<5 like that.
cjljohnson
@cjljohnson
Jan 12 2017 00:32
@vmsilva19 so you could do return a === 5
Joseph
@revisualize
Jan 12 2017 00:32
@thomasfadams Yes. Do you have a habit of being asked two questions and only answering one of them?
Thomas Adams
@thomasfadams
Jan 12 2017 00:33
haha no
mitron6
@mitron6
Jan 12 2017 00:33
@revisualize You are brilliant and helpful. I worry you intimidate some of the beginners. What do you think?
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 00:33
my code is still not working for factorializing a number
```
Joseph
@revisualize
Jan 12 2017 00:33
@mitron6 I do too.
Vinicius Miranda da Silva
@vmsilva19
Jan 12 2017 00:33
thanks
hmm.. it worked @mitron6
Thomas Adams
@thomasfadams
Jan 12 2017 00:34
@revisualize if i dont get the logic of the questions though there might be some confusion. just need to immerse myself in more JS
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 00:34

function factorialize(num) {
  for (var i = 1; i < num; i++){
   var newNum = i * (i + 1);
  }
  return newNum;
}
factorialize(5);
not working for factorializing a number
dont look at the color scheme just text
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:35
@unlawfulspoonisback newNum is out of scope
cjljohnson
@cjljohnson
Jan 12 2017 00:35
@unlawfulspoonisback write out what your function would do on paper to see what it is doing
Jceciliani
@Jceciliani
Jan 12 2017 00:35
I need to have encoded text with the proper escape sequences and no spacing. Does anyone see the problem here? var myStr="\Firstline\n\Secondline\r\Thirdline\\";
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:35
@unlawfulspoonisback make newNum global in your function
cjljohnson
@cjljohnson
Jan 12 2017 00:35
@unlawfulspoonisback manually do the calculation that you have there and you will see why it doesn't work
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:36
@Jceciliani where is backslash? it should be before and after SecondLine
cjljohnson
@cjljohnson
Jan 12 2017 00:36
@Jceciliani you probably need to escape the backslashes you want as part of the string
Jceciliani
@Jceciliani
Jan 12 2017 00:36
@cjljohnson I actually did that, it just didnt show up on the paste
cjljohnson
@cjljohnson
Jan 12 2017 00:37
is it right that there are backslashes at the beginning and end of the string?
iirc it's only around the SecondLine
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:37
@Jceciliani remove \ at the beginning and end of the string, you're escaping double quotes doing that
Joseph
@revisualize
Jan 12 2017 00:38
@mitron6 I go fast. I focused on learning the material and not on "getting the correct answer". So, I don't know. I've taken a bunch of time to try to create additional material for a lot of these lessons and most people just get it when I ask the question. There are a few cases where people just don't get it. Like when I ask someone: How do you add an element to the end of an array? ... They can't even respond with .push() or if they do. It feels like they didn't actually learn how / why .push() works. They won't add an argument. But, they give the answer .push(). I think they understand it but, clearly they don't. It's something that I need to work on. And there are cases when I ask someone "How do you remove the first element from an array (arr)? What does this method return?" They'll respond with .shift() and actually say they don't know and pull the MDN documentation: The shift() method removes the first element from an array and returns that element.
Sometimes, I don't know if the problem is me... Or if the problem is the person on the other end.
I know that I can only correct .. me.
I may need to find a better way of delivering questions or material.
cjljohnson
@cjljohnson
Jan 12 2017 00:40
I don't think the way FCC has you basically copy down what it asks you to do is a good way to learn programming
Dan Couper
@DanCouper
Jan 12 2017 00:40
@thomasfadams 1. shift, push etc are also functions, if you give them a value, they will return a value ([10, 20, 30].shift() will return 10) 2. but if you write a function and you want it to return a value, in JavaScript you have to type return to say you want a value returned, so 3. you use shift() in your function and return what shift gives you
mitron6
@mitron6
Jan 12 2017 00:40
@revisualize I don't have any suggestions. If you were in person, you'd be able to look at the person. On chat it is just a lot harder to know of you are getting through to the person.
Jceciliani
@Jceciliani
Jan 12 2017 00:40
@Lumexralph I just did that. It says i have all of the correct escape sequences, but i guess there is spacing somewhere I am not seeing? var myStr= "Firstline\n\Secondline\r\Thirdline\\";
mitron6
@mitron6
Jan 12 2017 00:41
@revisualize Just to be clear, I think you are really helpful and a lot of people really appreciate what you do.
Jceciliani
@Jceciliani
Jan 12 2017 00:41
I don't know why it keeps cutting off my two ending backslashes
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:41
@revisualize you're not the problem, though you can be blunt but you ain't the problem, you've done good works here helping but i'll suggest you add something to your teaching Empathy
Joseph
@revisualize
Jan 12 2017 00:41
@Jceciliani That's the way the Gitter chat works. It cuts off \s
@Jceciliani Your problem. You're not escaping your \s around SecondLine correctly.
cjljohnson
@cjljohnson
Jan 12 2017 00:42
I think he is
I think it's gitter escaping them
Joseph
@revisualize
Jan 12 2017 00:42
@Jceciliani You're also trying to escape backslashes at the end of your string. Which is not required.
Dan Couper
@DanCouper
Jan 12 2017 00:42
@thomasfadams open the developer tools in your browser, and select the console, then you can actually type in things to see how they work
cjljohnson
@cjljohnson
Jan 12 2017 00:42
\SecondLine\
see
Dan Couper
@DanCouper
Jan 12 2017 00:42
chrome-console.gif
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:42
@Jceciliani remove \ at the end of ThirdLine
Joseph
@revisualize
Jan 12 2017 00:42
@Jceciliani Secondline is NOT the same as SecondLine. Cap L
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:43
@Jceciliani and the typo @revisualize mentioned
Joseph
@revisualize
Jan 12 2017 00:43
@Lumexralph Adding empathy to my help is where I'd struggle.
Jason Luboff
@JLuboff
Jan 12 2017 00:44
Honestly I feel that half the issues in here are people just not taking the time to fully read the lessons/look at the examples. Then @revisualize comes in and destroys them (just playing of course)
Joseph
@revisualize
Jan 12 2017 00:44
If people want to see what a person actually types into the chat box. You can just Quote the line item.
cjljohnson
@cjljohnson
Jan 12 2017 00:44
I learnt programming by following the CS50x course on EDX, i think if my first exposure to it was FCC i wouldn't understand things like return values either
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:45
@revisualize why?
Joseph
@revisualize
Jan 12 2017 00:45
@Lumexralph Oh, I have a high IQ and a lower EQ.
cjljohnson
@cjljohnson
Jan 12 2017 00:45
lol
Joseph
@revisualize
Jan 12 2017 00:46
My IQ is something like 118? 123? I can't quite remember which of those two numbers it was. My EQ. let's just not talk about that.
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:46
@revisualize lol..... i understand but you can learn that with your IQ :smirk:
Dan Couper
@DanCouper
Jan 12 2017 00:47
@revisualise can you tell me the answer to the code, I am having some problems and FCC keeps telling me I have done something wrong?
fnuction 
// Add your code here
Joseph
@revisualize
Jan 12 2017 00:48
I can also just say screw it .. put on my :trollface: and :fire: the :house: :point_down:
@DanCouper Sure, first off you misspelled function ... You haven't supplied a function name nor have you supplied a return value. But, What are you trying to actually do?
@DanCouper And you're far more knowledgeable in JS than me. Why are you asking me questions?
Dan Couper
@DanCouper
Jan 12 2017 00:50
const forTheBads = () => :trollface:
:)
Joseph
@revisualize
Jan 12 2017 00:51
:ghost:
So there's a :house: , :house_with_garden: and there is a :fire_engine: but there is no :fire: :house: ... Where's the :fire_engine: supposed to go?
Jason Luboff
@JLuboff
Jan 12 2017 00:54
:bread: :house: ?
Joseph
@revisualize
Jan 12 2017 00:56
:gun: :cop: :police_car: :rotating_light:
456pm!
HOME!
Jason Luboff
@JLuboff
Jan 12 2017 00:57
Yup...3 more minutes
Jason Lafrance
@SgtRaziel
Jan 12 2017 00:57
var Car = function(wheels,seats,engines) {
  //Change this constructor
  this.wheels = 4;
  this.seats = 5;
  this.engines = 1;
};

//Try it out here
var myCar = new Car(2,6,3);
code not working any ideas?
https://www.freecodecamp.com/challenges/make-unique-objects-by-passing-parameters-to-our-constructor
Joseph
@revisualize
Jan 12 2017 00:57
@SgtRaziel You should be passing the parameters? Do you know what parameters are?
Ogundele Olumide
@Lumexralph
Jan 12 2017 00:58
@SgtRaziel because you've predefined the values of the constructors properties instead of using the parameters
mitron6
@mitron6
Jan 12 2017 00:59
@SgtRaziel Instead if this.wheels = 4; you write this.wheels = wheels; etc.
Jason Lafrance
@SgtRaziel
Jan 12 2017 01:00

@revisualize I thought I did

var myVar = function(parameter) {
do something
};

myVar("passed paramater");

this is my understanding...more or less

Ogundele Olumide
@Lumexralph
Jan 12 2017 01:00
@SgtRaziel quick one
function Bike(name) {
     this.name = "BMX"
}

and 

function Bike(name) {
     this.name = name;
}
Jceciliani
@Jceciliani
Jan 12 2017 01:01
it is still not working, but I have to a better code. var myStr = "FirstLine\n\\SecondLine\\rThridline"; This is how it says i should do it, but i don't see a difference. "FirstLine newline backslash SecondLine backslash carriage-return ThirdLine"
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:01
@SgtRaziel create an instance of the two constructors and see what you'll get
Joe Escobedo
@joeEscob1023
Jan 12 2017 01:01
i cant figure out the escape string lesson..I've looked all over and cant figure it out
Jason Lafrance
@SgtRaziel
Jan 12 2017 01:01
@mitron6 @Lumexralph OMFG lol! I forgot to have the function access the passed parameters
Jceciliani
@Jceciliani
Jan 12 2017 01:02
there are 3 backslashes on before and after Secondline
Walid Ashri
@walidashri
Jan 12 2017 01:02
@Jceciliani "FirstLine\n\\\SecondLine\\\rThridline"; extra \ after the \n
Joe Escobedo
@joeEscob1023
Jan 12 2017 01:02
escape sequence *
miner_paul
@aeselden92
Jan 12 2017 01:02
@revisualize Yo, understand that people struggling has nothing to do with their IQ. You are not good at this because you have a "high" IQ you are good at this because you have done it for a number of years. These people struggling are not dumb but inexperienced.
Jceciliani
@Jceciliani
Jan 12 2017 01:03
@walidashri thats what I have. i fixed the spelling error as well
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:03
@Jceciliani Thirdline should be ThirdLine
Jceciliani
@Jceciliani
Jan 12 2017 01:04
@Lumexralph Yeah, i caught that and fixed it, still no luck
Walid Ashri
@walidashri
Jan 12 2017 01:04
@Jceciliani "FirstLine\n\\SecondLine\\\rThridLine" here it's
Joe Escobedo
@joeEscob1023
Jan 12 2017 01:05
Im working on the same lesson and nothing goes through..
Jceciliani
@Jceciliani
Jan 12 2017 01:05
@walidashri thats what I have now but its not that either
Johnny
@JohnnyBizzel
Jan 12 2017 01:06
https://jsfiddle.net/JohnnyBizzel/1jrseyq5/
var str= "FirstLine\n\\SecondLine\\\rThirdLine";
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:06
@Jceciliani let me see the string
Jceciliani
@Jceciliani
Jan 12 2017 01:06
@Lumexralph var myStr="FirstLine\n\\SecondLine\\rThirdline";
Walid Ashri
@walidashri
Jan 12 2017 01:06
@Jceciliani paste ur code now please
Johnny
@JohnnyBizzel
Jan 12 2017 01:07
@Jceciliani "FirstLine\n\\SecondLine\\\rThridLine" Third @walidashri
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:07
@Jceciliani look at what @JohnnyBizzel showed you
Walid Ashri
@walidashri
Jan 12 2017 01:07
@JohnnyBizzel :wave:
Jason Lafrance
@SgtRaziel
Jan 12 2017 01:07
@TacoJoe var myStr = "FirstLine\n\\SecondLine\\\rThirdLine"
this passed
Jceciliani
@Jceciliani
Jan 12 2017 01:07
3 \ before and after SecondLine still
Johnny
@JohnnyBizzel
Jan 12 2017 01:07

@Jceciliani

@Lumexralph var myStr="FirstLine\n\\SecondLine\\rThirdline"; rThirdLine

Joe Escobedo
@joeEscob1023
Jan 12 2017 01:08
thanks you @SgtRaziel that was an annoying lesson
CamperBot
@camperbot
Jan 12 2017 01:08
tacojoe sends brownie points to @sgtraziel :sparkles: :thumbsup: :sparkles:
:cookie: 232 | @sgtraziel |http://www.freecodecamp.com/sgtraziel
Walid Ashri
@walidashri
Jan 12 2017 01:08
LOL
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:08
@TacoJoe more annoyance abounds :smile:
Jason Lafrance
@SgtRaziel
Jan 12 2017 01:09
@TacoJoe no worries, it's kind of too literal the way it's explained
Jceciliani
@Jceciliani
Jan 12 2017 01:09
@SgtRaziel @JohnnyBizzel @walidashri thanks, finally got there.. Holy smokes that took waaaaaaayyy to long..
CamperBot
@camperbot
Jan 12 2017 01:09
:cookie: 838 | @walidashri |http://www.freecodecamp.com/walidashri
jceciliani sends brownie points to @sgtraziel and @johnnybizzel and @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 234 | @sgtraziel |http://www.freecodecamp.com/sgtraziel
:star2: 1115 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Johnny
@JohnnyBizzel
Jan 12 2017 01:09
@Jceciliani Everything else is easy after that one ;)
Joe Escobedo
@joeEscob1023
Jan 12 2017 01:10
is it an important skill to even know? i dont see the significance of it. I thought it was going to do something different rather than just put it apart of the string quote
Jason Lafrance
@SgtRaziel
Jan 12 2017 01:10
@Jceciliani wait t'ill you get further along, you'll wish for escape sequence lol!
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:10
@TacoJoe you'll know with time, you'll need to build projects and it will come handy
Johnny
@JohnnyBizzel
Jan 12 2017 01:10
@TacoJoe It is a test of reading instructions to the letter!
Jason Lafrance
@SgtRaziel
Jan 12 2017 01:11
@TacoJoe if you want your output to look a specific way i guess
Joe Escobedo
@joeEscob1023
Jan 12 2017 01:11
i kept putting it outside the quotes because i thought it was going to do something with the text in quotes lol
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 01:16
my code is not working for factorialize a number help

function factorialize(num) {
  for (var i = 1; i < num; i++){
    console.log(i * (i + 1));
    }
}
factorialize(5);
Joe Escobedo
@joeEscob1023
Jan 12 2017 01:18
ok i see how escape sequences are important now
Justin
@tanpaopao
Jan 12 2017 01:18
Hello, I have no idea about this course, can some one give me a little hint? https://www.freecodecamp.cn/challenges/word-blanks#
Moisés Man
@moigithub
Jan 12 2017 01:19
@tanpaopao do u remember "string concatenation using variables" exercise ?
Justin
@tanpaopao
Jan 12 2017 01:21
@moigithub Yes
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:22
@unlawfulspoonisback have a global variable in your function, compute the product with it and return that variable when the loop is done, outside the loop
limbobark
@limbobark
Jan 12 2017 01:23
@unlawfulspoonisback add to the function var num=num
Moisés Man
@moigithub
Jan 12 2017 01:24
ur function is called with 4 words.. u need to form a phrase with those (using the functin parameters/variables ) and adding a proper separators between words @tanpaopao
Justin
@tanpaopao
Jan 12 2017 01:28
Thank you, I am trying it @moigithub
CamperBot
@camperbot
Jan 12 2017 01:28
tanpaopao sends brownie points to @moigithub :sparkles: :thumbsup: :sparkles:
:star2: 2457 | @moigithub |http://www.freecodecamp.com/moigithub
Faisal Patel
@faisal148991
Jan 12 2017 01:31
could someone give me a hand, I'm working on the Falsy Bouncer challenge and I've tried solve the problem by returning "arr.filter(Boolean(false))" but I keep getting the error that false is not a function :/
Phil Seidel
@psbyron3
Jan 12 2017 01:31

@unlawfulspoonisback You are not returning anything in your function.. So you are likely getting undefined. Also, I don't know the exact context of this problem, but you are also not doing anything besides a console.log.

I assume you need to return the factorial of whatever number gets plugged in so you need a number to start

Here's the pseudocode

function factorial(num) {
    var factor = 0;
    for (...)
        factor += (*insert your factorial logic here*)
    return factor
}
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:31
@faisal148991 Boolean without argument
@faisal148991 arr.filter(Boolean) just like every built in constructors like Number String
Faisal Patel
@faisal148991
Jan 12 2017 01:32
@Lumexralph done that but it's not working :/
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:34
@faisal148991 remember doing that will coerce explicitly the values to true or false, corresponding boolean
Zaluth
@Zaluth
Jan 12 2017 01:34

convert html entities, how can i use regex to find everything that's not alphanumeric or a space?

function convertHTML(str) {
  var regex = /\W\s/g;
  var search = regex.exec(str);

  return search;
}


convertHTML("Hamburgers < Pizza < Tacos");

it's returning ["< "] ( it's counting the space to the right)

Ogundele Olumide
@Lumexralph
Jan 12 2017 01:35
@faisal148991 can you show your code?
Joseph
@revisualize
Jan 12 2017 01:35
@aeselden92 sure. I think it does have something to do with hiw quickly I learn and grasp the material. I am going to re-evaluate my verbiage and method of delivery. Also, I didnt really know JS before I started FCC. My programming experience was quite limited. I have learned more here with FCC in 6 months than I did in three college classes. I think the material here is amazing. If used to learn.
Faisal Patel
@faisal148991
Jan 12 2017 01:36
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
  var bool = arr.filter(Boolean);
  return bool;
}

bouncer([7, "ate", "", false, 9]);
Joseph
@revisualize
Jan 12 2017 01:36
@Zaluth i created an object and used Regexp from the Object keys. I have seen some people do it with two arrays.
limbobark
@limbobark
Jan 12 2017 01:36
@unlawfulspoonisback
Faisal Patel
@faisal148991
Jan 12 2017 01:37
@Lumexralph (posted the code above)
limbobark
@limbobark
Jan 12 2017 01:37
window.onload = function() {
function factorialize(num){
    var num=num;
    for(var i=1;i<num;i++){
        console.log(i*(i+1));
    }
}
factorialize(5);
}
Joseph
@revisualize
Jan 12 2017 01:37
@faisal148991 you can cut out the varialble acting like a middle man.
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:38
@faisal148991 what's not working?
Faisal Patel
@faisal148991
Jan 12 2017 01:38
@Lumexralph @revisualize I keep getting the error that return arr.filter(Boolean);
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:39
@faisal148991 it should return [7, "ate",9]
Joseph
@revisualize
Jan 12 2017 01:39
That is how i did it.
CoryCMyers
@CoryCMyers
Jan 12 2017 01:39
Can someone please offer an explanation on https://www.freecodecamp.com/challenges/global-scope-and-functions I was able to muddle through the rest but for the life of me I cannot understand what they are asking me to do here.
Zaluth
@Zaluth
Jan 12 2017 01:39
@revisualize i'll give it a try, thanks
CamperBot
@camperbot
Jan 12 2017 01:39
zaluth sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2937 | @revisualize |http://www.freecodecamp.com/revisualize
Faisal Patel
@faisal148991
Jan 12 2017 01:39
my bad it's '''typeerrro: false is not a function```
CamperBot
@camperbot
Jan 12 2017 01:39
:bulb: to format code use backticks! ``` more info
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:39
@faisal148991 then return what it's saying return arr.filter(Boolean)
Justin
@tanpaopao
Jan 12 2017 01:40
@moigithub Hi, I read all the lessons about string concatenation again, here is my work, but it doesn't work out.

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");

Ogundele Olumide
@Lumexralph
Jan 12 2017 01:41
@faisal148991 i ran your code and didn't get any error even in strict mode
Joseph
@revisualize
Jan 12 2017 01:41
@tanpaopao you dont have space between your parameters
Faisal Patel
@faisal148991
Jan 12 2017 01:41
@Lumexralph do you think its my session thats wrong?
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:42
@faisal148991 probably, run your code here and see for yourself https://repl.it/languages/JavaScript
CoryCMyers
@CoryCMyers
Jan 12 2017 01:42
Can someone please offer an explanation on https://www.freecodecamp.com/challenges/global-scope-and-functions I was able to muddle through the rest but for the life of me I cannot understand what they are asking me to do here. Anyone ? I have tried digging around online but it is just not making sense with what I need to do.
Faisal Patel
@faisal148991
Jan 12 2017 01:44
@Lumexralph I just ran it in a different session on a different browser and it worked, thanks for the help
CamperBot
@camperbot
Jan 12 2017 01:44
:cookie: 715 | @lumexralph |http://www.freecodecamp.com/lumexralph
faisal148991 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:44
@faisal148991 :+1:
Walid Ashri
@walidashri
Jan 12 2017 01:44
@CoryCMyers I think the instructions are clear
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:45
@CoryCMyers what are you to do?
CoryCMyers
@CoryCMyers
Jan 12 2017 01:45
I understand it verbally, but my brain does not understand how to get there @walidashri @Lumexralph
Walid Ashri
@walidashri
Jan 12 2017 01:46
@CoryCMyers try a shoot and show it please :)
CoryCMyers
@CoryCMyers
Jan 12 2017 01:47
I will do what I can
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:47
:point_up: January 12, 2017 2:45 AM @CoryCMyers
Johnny
@JohnnyBizzel
Jan 12 2017 01:47
@walidashri Hi
:star: Happy New Year :star:
Walid Ashri
@walidashri
Jan 12 2017 01:47
@JohnnyBizzel realy
Joseph
@revisualize
Jan 12 2017 01:48
:cookie:
Oh. I have ice cream at home.
Walid Ashri
@walidashri
Jan 12 2017 01:48
@JohnnyBizzel thanks
:star: Happy New Year to u too:star:
CamperBot
@camperbot
Jan 12 2017 01:48
walidashri sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1116 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
Johnny
@JohnnyBizzel
Jan 12 2017 01:49
:yum:
Anmar0293
@Anmar0293
Jan 12 2017 01:49
Hello I need help please!
Johnny
@JohnnyBizzel
Jan 12 2017 01:49
@walidashri Thanks boss :partly_sunny:
CamperBot
@camperbot
Jan 12 2017 01:49
johnnybizzel sends brownie points to @walidashri :sparkles: :thumbsup: :sparkles:
:cookie: 841 | @walidashri |http://www.freecodecamp.com/walidashri
Walid Ashri
@walidashri
Jan 12 2017 01:49
@revisualize give me the :ice_cream: I gave you :cookie:
Johnny
@JohnnyBizzel
Jan 12 2017 01:50
@Anmar0293 What could be simpler?
Assign the value 7 to variable a.

Assign the contents of a to variable b.
Justin
@tanpaopao
Jan 12 2017 01:50
@revisualize thank you, passed.
CamperBot
@camperbot
Jan 12 2017 01:50
tanpaopao sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2938 | @revisualize |http://www.freecodecamp.com/revisualize
Johnny
@JohnnyBizzel
Jan 12 2017 01:50
:sundae: <--- where's the emoji???
Anmar0293
@Anmar0293
Jan 12 2017 01:50
@JohnnyBizzel I know it is simple, but i'm a little confused. Not a big fan of Java Script
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 01:51
function factorialize(num) {
for (var i = 1; i < num; i++){
console.log(i * (i + 1));
}
}
factorialize(5);
MY CODE IS NOT WORKING FOR FACTORIALIZE A NUMBER HELP
Johnny
@JohnnyBizzel
Jan 12 2017 01:51
@Anmar0293 Not a fan? You will be one day. GO JAVASCRIPT!!!!
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:51
@Anmar0293 using = operator
@unlawfulspoonisback i gave you a suggestion, have you tried it?
Joseph
@revisualize
Jan 12 2017 01:51
@Anmar0293
How do you assign the value of 7 to a variable num? ... var num = 7;
Now if you want you can use a variable to store values.
Like in mathmatics. num + 3 = 10 What is the value of num?
var x = num + 3; ... That outputs 10
So, you can do several things with variables. But, you need to understand that variables hold values and variables can be used with other variables.
So, how do you assign the value of 5 to a variable x? ... x = 5; (Which is also overwriting the previous value of 10 from above.
How do you assign the value of x to a variable y?
Look at the way things are written. var y = x;
How do you assign the value of 42 to a variable answer? ... What is the answer?
Variables hold values. Just understand that.
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 01:52
I dont know how to make a global var in a function
@Lumexralph
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:52
JS...................................................... when he gets comfy, he'll be a die hard fan!
Joseph
@revisualize
Jan 12 2017 01:53
@unlawfulspoonisback you dont make a global var in a function.
Anmar0293
@Anmar0293
Jan 12 2017 01:53
@revisualize Thanks for the explaination
CamperBot
@camperbot
Jan 12 2017 01:53
anmar0293 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2939 | @revisualize |http://www.freecodecamp.com/revisualize
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:54
@unlawfulspoonisback declare a variable at the top of your function just like you did in your for loop and initialize it, making it global scope for your function environment
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 01:55
ok
Joseph
@revisualize
Jan 12 2017 01:55
Well I guess I would need to know the scope. A variable may be global to one function but local to the parent function.
Lexical Scoping?
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:56
@revisualize sure..you're right, that's in nested functions, his code is just a function, declaring a variable makes it global for that environment
Yeah. So .. anyhow.
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:57
anyway
anyroad..... :smile:
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 01:58
 var newNum = i * (i + 1);
function factorialize(num){
  for (var i = 1; i < num; i++){
    return newNum;
    }
  }
factorialize(5);
not working :(
Ogundele Olumide
@Lumexralph
Jan 12 2017 01:58
@unlawfulspoonisback in your function
@unlawfulspoonisback i think you need to have some understanding, how did you arrive at your initial code?
Margaret
@Margaret2
Jan 12 2017 01:58
@unlawfulspoonisback if var i is declared inside your function, then you can't use it in a calculation outside your function
limbobark
@limbobark
Jan 12 2017 02:00

window.onload = function() {
function factorialize(num){
    for(var i=1;i<num;i++){
        console.log(i*(i+1));
    }
}
factorialize(5);
}
it's working... @unlawfulspoonisback
Josh Bivens
@joshbivens
Jan 12 2017 02:00
I'm having a total brainfart. How would I isolate members 4 through 8, say, of an array?
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:00
function factorialize(num){
   var newNum = i * (i + 1);
  for (var i = 1; i < num; i++){
    return newNum;
    }
  }
factorialize(5);
it returned null
dont focus on the colors dont know why it does that
Anmar0293
@Anmar0293
Jan 12 2017 02:01
I have question, I know it is not the smartest question, but as a beginner, what I can possible create JavaScript?
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:01
@joshbivens slice, splice....try them
Josh Bivens
@joshbivens
Jan 12 2017 02:01
@Lumexralph Ah! Thank you!
CamperBot
@camperbot
Jan 12 2017 02:01
joshbivens sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 716 | @lumexralph |http://www.freecodecamp.com/lumexralph
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:01
oh so I just had to do a widow onload function
Anmar0293
@Anmar0293
Jan 12 2017 02:02
with*
Margaret
@Margaret2
Jan 12 2017 02:02
@Anmar0293 jQuery is JavaScript, so you probably already know how to do stuff with that... the first thing I made on my own with JS was a clock, you might try that :D
something simple, ya know?
Manish Giri
@Manish-Giri
Jan 12 2017 02:03
yea like printing hello world
Margaret
@Margaret2
Jan 12 2017 02:03
...... :unamused:
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:03
@Anmar0293 a lot of simple stuffs
@joshbivens :+1:
Margaret
@Margaret2
Jan 12 2017 02:04
@unlawfulspoonisback the fix is not the window onload function, the fix is that his variables and calculations are in the right places
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:06
actually no because his code is not working
@Margaret2
and I deleted all my code to put his in and now i lost my code
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:07
@unlawfulspoonisback :laughing:
limbobark
@limbobark
Jan 12 2017 02:07
window.onload = function() {

function factorialize(num){
  for (var i = 1; i < num; i++){
      var newNum = i * (i + 1);
    }
    return newNum;
  }
  console.log(factorialize(5));
}
result 20; @unlawfulspoonisback
Margaret
@Margaret2
Jan 12 2017 02:07
well, you pasted it right up there lol :point_up_2: @unlawfulspoonisback
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:07
@limbobark result should be 120
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:08
tis not working for me
limbobark
@limbobark
Jan 12 2017 02:08
okay..
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:08
and this guy limbobark is wrong
it should be 120
Margaret
@Margaret2
Jan 12 2017 02:08
@unlawfulspoonisback yeah, i guess that is not the solution, but you do need to put any calculations with i inside your for loop
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:08
@unlawfulspoonisback your code is on the way, you just need to do some lil stufffs
Yoel Trujillo
@y0el22
Jan 12 2017 02:09
i a have a question guys
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:09
I do not know what to do else it looks fine to me
Yoel Trujillo
@y0el22
Jan 12 2017 02:10
var array = [1, 12, 21, 2];
array.sort(function(a, b) {
  return a - b;
});
[1, 2, 12, 21]
`
Grahame Rivers
@riversgr
Jan 12 2017 02:10

Hello folks! I cannot get this else if statement to work. After a lot of googling I am stuck. Can anyone give me some advice? <p>Please input a number:</p>

<input id="numb" type="text">

<button type="button" onclick="myFunction()">Submit</button>

<p id="demo"></p>

<script>
function myFunction() {
var x, text;

x = document.getElementById("numb").value;

if (isNaN(x) || x > 1 || x < 100) {
text = "Answer one";

} else if (isNaN(x) || x > 101 || x < 300) {
text = "Answer two";

} else {
text = "Answer three";
}
document.getElementById("demo").innerHTML = text;
}
</script>

Ogundele Olumide
@Lumexralph
Jan 12 2017 02:11
@y0el22 what's the question?
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:11
it looks fine to me I do not know what else to do @Lumexralph
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:12
@unlawfulspoonisback
function factorialize(num) {
  var product = 1;   // this is what i suggested, have a variable in your function to hold the products of your calculations from the loop
  for (var i = 1; i < num; i++){

    }
    return product;
}
factorialize(5);
Margaret
@Margaret2
Jan 12 2017 02:13
@riversgr just tested it, so if var x = 135, the result is "Answer one". I think that is because the if statement stops evaluating once it hits the first true condition, which is x>1
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:13
@y0el22 it should be return b - a and get rid of the last array
Josh Bivens
@joshbivens
Jan 12 2017 02:14
Can anyone help me for just a sec?
Margaret
@Margaret2
Jan 12 2017 02:14
@riversgr so if you want "Answer one" to only be the answer if x is between 1 and 100, then you need to use && (and) instead of || (or)
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:14
@joshbivens okay...
limbobark
@limbobark
Jan 12 2017 02:14
@Lumexralph runing result 1
Margaret
@Margaret2
Jan 12 2017 02:14
@riversgr also having isNan(x) twice seems redundant
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:15
@limbobark i left the part of the loop out for him to work it out himself
Albert L. C.
@sirus3020
Jan 12 2017 02:15
How do I use substring?
Grahame Rivers
@riversgr
Jan 12 2017 02:15
@Margaret2 Thank you! Will give it a try!
CamperBot
@camperbot
Jan 12 2017 02:15
riversgr sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
:star2: 1151 | @margaret2 |http://www.freecodecamp.com/margaret2
Josh Bivens
@joshbivens
Jan 12 2017 02:15
This applies to all the swatches in an array, but I only want it to work for swatches 4 through 11:
Josh Bivens
@joshbivens
Jan 12 2017 02:15
swatches.map(swatch => swatch.style.background = this.style.background );
Margaret
@Margaret2
Jan 12 2017 02:16
@sirus3020 "mystring".substring(index), e.g. "hello".substring(1) = "ello"
Albert L. C.
@sirus3020
Jan 12 2017 02:16

not sure if I'm doing it right.

if ( str[i].substring(target))

Margaret
@Margaret2
Jan 12 2017 02:16
@sirus3020 is str[i] a word or a letter?
Albert L. C.
@sirus3020
Jan 12 2017 02:16
a word.
Margaret
@Margaret2
Jan 12 2017 02:16
ok, and what is target?
Albert L. C.
@sirus3020
Jan 12 2017 02:17
for now. a word.
Grahame Rivers
@riversgr
Jan 12 2017 02:17
@Margaret2 And it works! Thanks again.
CamperBot
@camperbot
Jan 12 2017 02:17
riversgr sends brownie points to @margaret2 :sparkles: :thumbsup: :sparkles:
:warning: riversgr already gave margaret2 points
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:17
@sirus3020 () in if statement will always implicitly coerce whatever is there to a boolean true/false, be sure you understand what you're trying to do
Margaret
@Margaret2
Jan 12 2017 02:18
@sirus3020 won't work with a string inside the parentheses, you have to use a numeric value, like in my example above
:D
never mind...
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:19
@Margaret2 was responding to this if ( str[i].substring(target)) :smirk:
Margaret
@Margaret2
Jan 12 2017 02:19
yeah, just saw that
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:19
anyroad......
Josh Bivens
@joshbivens
Jan 12 2017 02:19
nm i got it
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:20
anyway
anyroute
Albert L. C.
@sirus3020
Jan 12 2017 02:21
hmmm.

if ( str[i].substring(target.length - i))

is this better? or still not right?

or do I still need something to compare it to?
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:26
@sirus3020 it's right but depending on what you're trying to do, logically might be wrong
@sirus3020 or do I still need something to compare it to? i think so
Albert L. C.
@sirus3020
Jan 12 2017 02:30
This is my code. I'm not sure if im using the substring correctly.
for ( var i = 0; i < str.length; i++ ) {
if ( i == str.length ) {
if ( str[i] == str[i].substring(target.length - i)) {
return true;
} else { return false; }
}
}
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:30
I dont really know what to do with the code you gave me
function factorialize(num) {
  var product = 1;   // this is what i suggested, have a variable in your function to hold the products of your calculations from the loop
  for (var i = 1; i < num; i++)
console.log(i * product);
    }
    return product;
}
factorialize(5);
Albert L. C.
@sirus3020
Jan 12 2017 02:30
if target = Bastian. what would target.length - i return?
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:30
@Lumexralph
Albert L. C.
@sirus3020
Jan 12 2017 02:31
@unlawfulspoonisback read about recursion.
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:31
ok
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:32
@unlawfulspoonisback product *= i + 1; do that in your for loop, it's still what you're trying to do in your code
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:32
@Lumexralph thanks
CamperBot
@camperbot
Jan 12 2017 02:32
unlawfulspoonisback sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 717 | @lumexralph |http://www.freecodecamp.com/lumexralph
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:32
@Lumexralph thanks
CamperBot
@camperbot
Jan 12 2017 02:32
unlawfulspoonisback sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:warning: unlawfulspoonisback already gave lumexralph points
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:32
@unlawfulspoonisback we good now?
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 02:33
ya bye thankyou
@Lumexralph
bye thankyou
Ogundele Olumide
@Lumexralph
Jan 12 2017 02:33
@unlawfulspoonisback Tschuus!
Chris Burros
@cburros
Jan 12 2017 02:57
so I don't want to ruin the fun for fellow campers and post the solution, but I solved the "Title Case a sentence" algorithm with a regular expression. I looked up how others have solved the problem after I came up with a solution and it doesn't appear that RegExp is used often or as a suggested solution. Is there a reason that using a regular expression would not be a good idea here?
johnboland91
@johnboland91
Jan 12 2017 03:08

function mutation(arr) {
arr[0] = arr[0].toLowerCase();
arr1 = arr1.toLowerCase();
var count = 0;

for (var i = 0; i < arr1.length; i++) {
for (var j = 0; j < arr[0].length; j++) {
if (arr[0][j] == arr[1][i])
{
count += 1;
}
}

if (count == arr[1].length){
  return true;
}

}
return false;
}

my mutation function fails on ["hello", "Hello"]. Any idea what the issue is?
Cal-culator
@Cal-culator
Jan 12 2017 03:09
Do you guys know why XMLHttpRequest.status would be 0 but the response exists?
Rose
@Rose901
Jan 12 2017 03:30

/ Example
var ourArr = [ 9, 10, 11, 12];
var ourTotal = 0;

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

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

// Only change code below this line
var myTotal =0;
for (var i= 2; i < myArr.length; i++) {
myTotal += myArr[i];
}

anyone can help this thanks
this code from "Iterate Through an Array with a For Loop"
Ogundele Olumide
@Lumexralph
Jan 12 2017 03:33
@Rose901 your for loop i should start from 0 so as to start from first index of myArray
Rose
@Rose901
Jan 12 2017 03:35
@Lumexralph I tried start from , but it seem not work .
start from 0
@Lumexralph // Only change code below this line
var myTotal =0;
for (var i= 0; i < myArr.length; i++) {
myTotal += myArr[i];
}
I changed it . but not working !
Paulo Tokimatu
@paulotokimatu
Jan 12 2017 03:43
@Rose901 What message/result are you getting?
Nathan Parsons
@10milliondollarwebpage
Jan 12 2017 03:45
thanks @Lumexralph Sorry I had to leave so fast I needed to go eat dinner with my family, Thank you for your help and the solution you provided me with worked great.
CamperBot
@camperbot
Jan 12 2017 03:45
unlawfulspoonisback sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 718 | @lumexralph |http://www.freecodecamp.com/lumexralph
Rose
@Rose901
Jan 12 2017 03:46
@paulotokimatu I got "total is undefined
Moisés Man
@moigithub
Jan 12 2017 03:46
soo ur variable should be named total
and NOT myTOtal
Paulo Tokimatu
@paulotokimatu
Jan 12 2017 03:46
@Rose901 Ah, so just change the name of your variable to total
Liz Chen
@moist17
Jan 12 2017 03:49

hey, can anyone help me with wikipedia viewer?
jquery autocomplete works on my own computer, but when i move to codepen it's invalid. i've checked console but nothing happened...
here's my autocomplete code -

// auto suggestion
$('.searchbox').autocomplete({
  source: function(request, response) {
    $.ajax ({
      url: 'https://en.wikipedia.org/w/api.php',
      dataType: 'jsonp',
      data: {
        'action': 'opensearch',
        'format': 'json',
        'search': request.term
      },
      success: function(yodata) {
        response(yodata[1]);
      }
    });
  }
});

my codepen link -
http://codepen.io/dilute/pen/pRjEpz

Rose
@Rose901
Jan 12 2017 03:49
@paulotokimatu thanks ! it is working now.
CamperBot
@camperbot
Jan 12 2017 03:49
rose901 sends brownie points to @paulotokimatu :sparkles: :thumbsup: :sparkles:
:cookie: 344 | @paulotokimatu |http://www.freecodecamp.com/paulotokimatu
Paulo Tokimatu
@paulotokimatu
Jan 12 2017 03:50
@moist17 did you import the jquery library?
Ali Andersen
@alirezaandersen
Jan 12 2017 03:50

Hi everyone trying to figure out Escape Sequence in Strings.

Here is my solution
var myStr = "\n \ \ \r";
the error I keep receive is
myStr should have encoded text with the proper escape sequences and no spacing.

Any ideas? Thanks!

Liz Chen
@moist17
Jan 12 2017 03:50
it works on my own computer http://i.imgur.com/0IvC9dh.png
@paulotokimatu i link jquery js from cdn
uriznik
@uriznik
Jan 12 2017 03:58
@moist17 there doesn't appear to be an element with a searchbox class? If I change it to use #keyword then it works
Liz Chen
@moist17
Jan 12 2017 04:01
@uriznik oops turns out i just forgot to update my html...thanks!
Moisés Man
@moigithub
Jan 12 2017 04:03
@alirezaandersen u also need to include the words specified there.. FirstLine, SecondLine ThirdLine
in the correct order
Bardoe Bess
@bardbess
Jan 12 2017 04:03
Seems like 99% of your time on the weather/quote challenge is spent fighting with ssl and non ssl api requests
C.A. Reis
@drcharlie98
Jan 12 2017 04:17
hi, I need help but I don't know how to show my code here :) could anyone help please?
Sean Stephens
@ssteph90
Jan 12 2017 04:17
Hi guys, I'm struggling with the escaping literal quotes in strings can someone help me?
var myStr= "I am a \"double quoted"\ string inside \"double quotes\"."; // Change this line
^There's my code
kez
@keztheminer
Jan 12 2017 04:18
\"double quoted\" my guess
Phil Seidel
@psbyron3
Jan 12 2017 04:18
@ssteph90 I think that exercise has you get rid of the escape characters
so it's a string wrapped in single quotes
Then you just do double quotes where needed. It's to show how to put single or double quotes within a string
'I am a "double quote".....
'I am a "double quote".....'

@drcharlie98 you put three back ticks to start (just over the tab key)

var code = "my code goes here"

and end with back ticks

Hold shift + enter to get to a new line without sending your chat
Sean Stephens
@ssteph90
Jan 12 2017 04:23
@psbyron3 @kezdarkriser Thank you both
CamperBot
@camperbot
Jan 12 2017 04:23
ssteph90 sends brownie points to @psbyron3 and @kezdarkriser :sparkles: :thumbsup: :sparkles:
:cookie: 20 | @psbyron3 |http://www.freecodecamp.com/psbyron3
:cookie: 142 | @kezdarkriser |http://www.freecodecamp.com/kezdarkriser
kez
@keztheminer
Jan 12 2017 04:24
@ssteph90 Your welcome
Phil Seidel
@psbyron3
Jan 12 2017 04:24
no prob!!!
Ali Sahmoud
@asahmoud
Jan 12 2017 04:29
Hi Everyone, I am having trouble with using Objects for Look up, can someone help me??
Ptolemy
@Ptolemy1
Jan 12 2017 04:30
Hey can i get help?
with this: Finding a Remainder in JavaScript?
Phil Seidel
@psbyron3
Jan 12 2017 04:31
@asahmoud I can take a look... Can you send me a link to the spec??
@Ptolemy1 Same goes to you.. link to the spec please I'll take a look.
Ali Sahmoud
@asahmoud
Jan 12 2017 04:32
@psbyron3 here you go
blob
@psbyron3 I just dont know how exactly does the function work
Ptolemy
@Ptolemy1
Jan 12 2017 04:32
Goodnight
Joe Olivier
@joeo235
Jan 12 2017 04:32
Thanks @CaroleAnneHannon for your help with Checkpoint: Stand in Line. It was concise and easy to understand
CamperBot
@camperbot
Jan 12 2017 04:32
joeo235 sends brownie points to @caroleannehannon :sparkles: :thumbsup: :sparkles:
:cookie: 872 | @caroleannehannon |http://www.freecodecamp.com/caroleannehannon
Phil Seidel
@psbyron3
Jan 12 2017 04:33
Hey @Ptolemy1 I figured it out
kez
@keztheminer
Jan 12 2017 04:34
@Ptolemy1 var remainder=11%3;
Phil Seidel
@psbyron3
Jan 12 2017 04:34
You had an incorrect variable declaration, you can't use special characters i.e the semicolon. So all you do is assign the remainder to 11 % 3. You don't need to set 11 % 3 = 2.. The compiler will return 2
@asahmoud gonna read the spec now.. gime a couple mins
Ali Sahmoud
@asahmoud
Jan 12 2017 04:35
@psbyron3 I think I managed to solve it myself
@psbyron3 Thanks a lot
CamperBot
@camperbot
Jan 12 2017 04:35
asahmoud sends brownie points to @psbyron3 :sparkles: :thumbsup: :sparkles:
:cookie: 22 | @psbyron3 |http://www.freecodecamp.com/psbyron3
Phil Seidel
@psbyron3
Jan 12 2017 04:35
Are you sure?
Right-o if so!
Ali Sahmoud
@asahmoud
Jan 12 2017 04:36
@psbyron3 yep! I didnt think that I can fix my 'result' variable
Phil Seidel
@psbyron3
Jan 12 2017 04:36
Oh I see.
Great glad you were able to figure it out
cjljohnson
@cjljohnson
Jan 12 2017 04:39
Does javascript shortcircuit conditionals?
Daniel
@doodleslr
Jan 12 2017 04:41

hey guys i can't figure out why this doesnt work, im searching for palindromes and cant seem to remove any non alphanumeric characters or make it lower case

'function palindrome(str) {
var lowNoGram = str.toLowerCase().replace(/[\W_]/g, '');

//splits, reverses, then rejoins into backwards string
var aStr = lowNoGram.split("").reverse().join("");
//ends here

return aStr === str;

}

palindrome("eye");'

whoa markup

//ignore above, from here

function palindrome(str) {

var lowNo = str.toLowerCase().replace(/[\W_]/g, '');

//splits, reverses, then rejoins into backwards string, SERIOUSLY I CAN STACK THESE?
var aStr = lowNo.split("").reverse().join("");
//ends here

return aStr === str;

}

palindrome("eye");

Phillip Troutman
@troutman21
Jan 12 2017 04:43
Hi everyone, can someone point me in the right direction. Still really new to JavaScript and have no idea what im doing lol...how do i get the program to return the var rather than the name of the var?

function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {
var result = "";
// Your code below this line
var myNoun="dog";
var myAdjective="big";
var myVerb="ran";
var myAdverb="quickly";

var result="My myAdjective myNoun myVerb myAdverb down the street after the car."

// Your code above this line
return result;
}

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

Phil Seidel
@psbyron3
Jan 12 2017 04:43
@doodleslr I just ran your code in repl.it and it runs fine
cjljohnson
@cjljohnson
Jan 12 2017 04:44
@troutman21 you are making a string. variables don't have quotes round them
Phil Seidel
@psbyron3
Jan 12 2017 04:44
It gets rid of special characters and it's lower case... If your having trouble I recommend using console.log
Daniel
@doodleslr
Jan 12 2017 04:44
even with random alphanumerics in the string?
cjljohnson
@cjljohnson
Jan 12 2017 04:44
@troutman21 return "cat" returns the word cat, return cat returns whatever is stored in variable cat
Phil Seidel
@psbyron3
Jan 12 2017 04:44
sorry
@doodleslr https://repl.it/FHAq there you go
If you run the code, it gets rid of special chars and lowercases
Phillip Troutman
@troutman21
Jan 12 2017 04:45
hmmm ok then do i have to concatenate the literal stings to make a complete sentence? @cjljohnson
cjljohnson
@cjljohnson
Jan 12 2017 04:45
yes
Phillip Troutman
@troutman21
Jan 12 2017 04:45
thank you sir. I will give it a try. @cjljohnson
CamperBot
@camperbot
Jan 12 2017 04:45
troutman21 sends brownie points to @cjljohnson :sparkles: :thumbsup: :sparkles:
:cookie: 279 | @cjljohnson |http://www.freecodecamp.com/cjljohnson
Phil Seidel
@psbyron3
Jan 12 2017 04:46
@troutman21 I got you
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:46
hiu
Phil Seidel
@psbyron3
Jan 12 2017 04:46
nevermind it looks like your helped
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:46
does someone see the infinite loop in this
perssonalities
@perssonalities
Jan 12 2017 04:46
Help!!!Please.
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:46
function smallestCommons(arr) {
  arr=arr.sort();
  var found = false,escalon=arr[1],actual=escalon,resultado,i;
  while(!found){
    for(i=0;i<arr.length;i++){
     if (actual%arr[i]!==0){
       break;
     }else if(i==arr.length){
       found=true;
       break;
     }else {
     actual+=escalon;
     }
    }    
  }
  return actual;
}
perssonalities
@perssonalities
Jan 12 2017 04:46
Having trouble with Testing Object Properties
Daniel
@doodleslr
Jan 12 2017 04:46
@psbyron3 it doesnt seem to be working either in repl.it even actual palindromes return false
Phil Seidel
@psbyron3
Jan 12 2017 04:47

variables need to be concatenated into sentences

```
var myString = myNoun + "is the best food";

var myString = myNoun + "is the best food";
@niconielsen Looking at it now..
Phillip Troutman
@troutman21
Jan 12 2017 04:49
thanks @psbyron3 how do i concatenate multiple variables next to each other? do i have to add "+" in between each variable ?
CamperBot
@camperbot
Jan 12 2017 04:49
troutman21 sends brownie points to @psbyron3 :sparkles: :thumbsup: :sparkles:
:cookie: 23 | @psbyron3 |http://www.freecodecamp.com/psbyron3
Phil Seidel
@psbyron3
Jan 12 2017 04:49
Yes
So it would look like this:
myNoun + " " + myVerb + " " + myAdj + " the rest of the sentence"
you need to add spaces in between
Otherwise there will be no white space in between variables
Phillip Troutman
@troutman21
Jan 12 2017 04:50
Yea i just realize that. you have to quote the spaces right? @psbyron3
Kaustubh Srivastava
@kaus1995
Jan 12 2017 04:51
Hey. I cannot figure out what I am doing wrong in celcius to fahrenheit challenge. I am doing this as the solution " fahrenheit = celcius * (9 / 5) + 32;". It shows the error as celcius is not defined.
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:51
@psbyron3 seen anything?
Phillip Troutman
@troutman21
Jan 12 2017 04:51
remove the parentheses @kaus1995
paste your whole code @kaus1995
Kaustubh Srivastava
@kaus1995
Jan 12 2017 04:53

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

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

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

Phil Seidel
@psbyron3
Jan 12 2017 04:53
It's because at the end of your function you are returning the boolean for comparing the aStr which is the string you have modified to the beginning input aka str. So if the 'str' is all caps the aStr is all lowercase.
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:53
im making steps with the biggest number and then comparing with % to each number between the numbers provided
Phil Seidel
@psbyron3
Jan 12 2017 04:53
You can change this by removing one of the = and doing return aStr == str; instead of aStr === str
Phillip Troutman
@troutman21
Jan 12 2017 04:53
chekcing... @kaus1995
checking*
Phil Seidel
@psbyron3
Jan 12 2017 04:54
the double equals is more implicit and it doesn't require it to be EXACTLY the same
Kaustubh Srivastava
@kaus1995
Jan 12 2017 04:54
@troutman21 It gives null for -30 and only works for 0 as param
Phil Seidel
@psbyron3
Jan 12 2017 04:54
@niconielsen Sorry trying to help multiple people haha
Working on it..
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:55
i found it
Phil Seidel
@psbyron3
Jan 12 2017 04:55
Can you send me the link to the spec.. It would be way more helpful
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:55
im only going from index 0 to 1
Phil Seidel
@psbyron3
Jan 12 2017 04:55
Oh yea? Nice!
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:55
not the entire range
Phil Seidel
@psbyron3
Jan 12 2017 04:55
by setting your escalon to arr[1]?
That was a suspect for me..
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:56
 if (actual%i===0){
Phillip Troutman
@troutman21
Jan 12 2017 04:56
remove the "var celcius;" in your code. you added that right ?
@kaus1995
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:56
for(i=0;i<arr[1];i++){
Phil Seidel
@psbyron3
Jan 12 2017 04:56
okay gotcha, I was looking at that line for a while, something seemed funky about it. @niconielsen glad you were able to discover
Kaustubh Srivastava
@kaus1995
Jan 12 2017 04:57
@troutman21 yeah I did that. But then it shows the error that celcius not defined.
Phillip Troutman
@troutman21
Jan 12 2017 04:58
it shows that error after running it ?
Kaustubh Srivastava
@kaus1995
Jan 12 2017 04:58
yeah
perssonalities
@perssonalities
Jan 12 2017 04:58
is anyone there who has already done the Testing Objects for Properties lesson?
Please help
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:59
@psbyron3

function smallestCommons(arr) {
  arr=arr.sort();
  var found = false,escalon=arr[1],actual=escalon,resultado,i;
  while(!found){
    for(i=arr[0];i<arr[1];i++){
     if (actual%i===0){
       break;
     }else if(i==arr.length){
       found=true;
       break;
     }else {
     actual+=escalon;
     }
    }    
  }
  return actual;
}


smallestCommons([1,5]);
Phillip Troutman
@troutman21
Jan 12 2017 04:59
celcius is spelled wrong @kaus1995
Nicolas Nielsen
@niconielsen
Jan 12 2017 04:59
still not workingg
Phillip Troutman
@troutman21
Jan 12 2017 05:00
lol I do that ALL the time @kaus1995
Kaustubh Srivastava
@kaus1995
Jan 12 2017 05:00
@troutman21 Ohh! Sorry! Thanks for the help :)
CamperBot
@camperbot
Jan 12 2017 05:00
kaus1995 sends brownie points to @troutman21 :sparkles: :thumbsup: :sparkles:
:cookie: 158 | @troutman21 |http://www.freecodecamp.com/troutman21
Phillip Troutman
@troutman21
Jan 12 2017 05:00
let me know if that works
haha no worries anytime @kaus1995
Kaustubh Srivastava
@kaus1995
Jan 12 2017 05:01
@troutman21 It did :D
Phil Seidel
@psbyron3
Jan 12 2017 05:01
@niconielsen Link me to the spec. I need to understand what it wants you to do..
Phil Seidel
@psbyron3
Jan 12 2017 05:03
awesome thanks
gimme a couple minutes here..
Nicolas Nielsen
@niconielsen
Jan 12 2017 05:03
@psbyron3 thanks!
CamperBot
@camperbot
Jan 12 2017 05:03
niconielsen sends brownie points to @psbyron3 :sparkles: :thumbsup: :sparkles:
:cookie: 24 | @psbyron3 |http://www.freecodecamp.com/psbyron3
Phil Seidel
@psbyron3
Jan 12 2017 05:05
No worries, it is so helpful to see the spec haha now I know the context of your code
Nicolas Nielsen
@niconielsen
Jan 12 2017 05:06
@psbyron3 i replaced the else if condition to
}else if(i==arr1){
Aaron
@apalm1341
Jan 12 2017 05:07
Hey all
Phil Seidel
@psbyron3
Jan 12 2017 05:07
did that work??
Nicolas Nielsen
@niconielsen
Jan 12 2017 05:07
it now return 25
Aaron
@apalm1341
Jan 12 2017 05:08
Is anything/everything that can be typed up in a web address bar in any browser on any computer considered to be on the Internet and/ World Wide Web??
Are there exceptions??
How can u normally tell if u r using Internet and/or World Wide Web?
Phil Seidel
@psbyron3
Jan 12 2017 05:09
if the url starts with http or https
Aaron
@apalm1341
Jan 12 2017 05:12
Um not necessarily true all the time tho
Cause I run games via web browser
And it says localhost in web address bar
And it also starts with either http or https
Phil Seidel
@psbyron3
Jan 12 2017 05:13
does that lead of with http?
Aaron
@apalm1341
Jan 12 2017 05:13
And the games I run r just running from my computer I would think cause it says localhost
So they aren't on Internet and/or World Wide Web
Phil Seidel
@psbyron3
Jan 12 2017 05:14
right they say localhost cuz its running directly off your machine, I just don't recall seeing http in front of localhost when I'm running stuff
Aaron
@apalm1341
Jan 12 2017 05:15
Welp
It shows in Microsoft edge as of now
But I have to actually click web address bar
In order for it to show http
Phil Seidel
@psbyron3
Jan 12 2017 05:16
ohh okay. I use chrome and it doesn't show
Aaron
@apalm1341
Jan 12 2017 05:17
Ya same here
Http also shows up when running game via Internet explorer
Phil Seidel
@psbyron3
Jan 12 2017 05:18
Okay so it's different depending on browser. Interesting. Well I stand correct, that is not a definitive solution
corrected*
Aaron
@apalm1341
Jan 12 2017 05:19
Firefox not showing http or https
Same with chrome
Exactly Phil
They don't very good details about http and https online
Aaron
@apalm1341
Jan 12 2017 05:24
Also....
I have seen web addresses/URLs without an http and/or https
Also have seen ones with and without www
This is really really weird
Can someone please explain all this??
Phil Seidel
@psbyron3
Jan 12 2017 05:28
@niconielsen hey still trying to figure this one out
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:35
what am i doing wrong!?!
function nextInLine(arr, item) {
// Add the number to the end of the array,
arr.push(item);
// then remove the first element of array.
arr.shift();
// The nextInLine function should
// then return the element that was removed.
return item; // Change this line
Phil Seidel
@psbyron3
Jan 12 2017 05:35
@apalm1341 www is no longer needed. It stands for world wide web but it isn't necessary. I don't have an in-depth explanation as to why.
I would google it if you want to know what's going on under the hood. quora is a great resource as well for that kind of stuff
the www is up to the website who hosts, some want it others don't. It is more SEO friendly to exclude www
so a lot of companies don't use it for that reason
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:38
anyone help with js
?
Phil Seidel
@psbyron3
Jan 12 2017 05:39
Lemme look.. @RobDeNo
Cheru
@cherukss
Jan 12 2017 05:40
has any one finished smallest common multiple - intermediate algorithm scripting - https://www.freecodecamp.com/challenges/smallest-common-multiple
Phil Seidel
@psbyron3
Jan 12 2017 05:41
You want to return the element that was removed from the array not the one that was pushed in.
return arr.shift();
@RobDeNo
did that solve your issue? @RobDeNo
pinaycoder
@pinaycoder
Jan 12 2017 05:48
Hi all.
Can anyone help me with this:
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:48
@psbyron3 it did not
you wnat me to put the entire problem
been at it for 3 days
this one class
pinaycoder
@pinaycoder
Jan 12 2017 05:49

var Bike = function() {
// Only change code below this line.
var gear;

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

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

};

var myCar = new Car();
var myBike = new Bike();

Robert DeNovellis
@RobDeNo
Jan 12 2017 05:49
i am losing hope
pinaycoder
@pinaycoder
Jan 12 2017 05:49
not sure why I'm failing the test cases: myBike.getGear() should return 4 after calling myBike.setGear(4).
Phil Seidel
@psbyron3
Jan 12 2017 05:51
get rid of the first arr.shift()
Just return arr.shift()
You can consolidate down to two lines of code
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:51
omg
why do i need not put
Phil Seidel
@psbyron3
Jan 12 2017 05:52
arr.push(item);
return arr.shift();
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:52
arr.shift
wiat yes i passed it BUT
why do i need not put that inside the fucntion
before the return
i understand "return arr.shift(); is inside the function
Phil Seidel
@psbyron3
Jan 12 2017 05:53
function whatever(arr, item) {
    arr.push(item);
    return arr.shift();
}
Or you could do
```
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:53
does "return" act as the movement of the removed element. and arr.shift(); just removes it...
i am confused
Phil Seidel
@psbyron3
Jan 12 2017 05:53
function nextInLine(arr, item) {
    arr.push(item);
    var returnedItem = arr.shift();
    return returnedItem;
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:54
becuase return pulls the element itslef
Phil Seidel
@psbyron3
Jan 12 2017 05:54
return simply returns back out of the function
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:54
so...
Phil Seidel
@psbyron3
Jan 12 2017 05:54
So when you call a function you hop into that block of code. For this particular function you need to return the first value of the array you put in
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:55
return, then a parameter following pulls that paramter out of the function
return 1, pulls 1
return 2, pulls to
to put it simply
Phil Seidel
@psbyron3
Jan 12 2017 05:55
so you need to return that value. Once you say return arr.shift() you hop out of that block of code with the value. The compiler then continues through the code where it left off
you don't have to return a parameter necessarily and maybe that's the tricky part about it
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:56
oh my goodness thankyou @psbyron3
CamperBot
@camperbot
Jan 12 2017 05:56
robdeno sends brownie points to @psbyron3 :sparkles: :thumbsup: :sparkles:
:cookie: 25 | @psbyron3 |http://www.freecodecamp.com/psbyron3
Phil Seidel
@psbyron3
Jan 12 2017 05:56
return simply returns you out of the function block.. AKA the code between the curly brackets of your function
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:56
i finally get it, that was what i could not grasp
the return is like a hook to whatever follows it
Phil Seidel
@psbyron3
Jan 12 2017 05:56
No problem.. Does it make sense now
Robert DeNovellis
@RobDeNo
Jan 12 2017 05:57
YES
and i am saving this whole log in my notes
Phil Seidel
@psbyron3
Jan 12 2017 05:57
in a sense. You can write return; and the compiler will hop out of the function
without anything. Sometimes you'll write functions that don't need to return anything.
But more often than not you are returning some type of value.
Especially with the more simple algorithms you are designing
Karthika
@Karthika107
Jan 12 2017 06:12

How to solve counting cards without using any conditional statements.
var count = 0;

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

// 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');

Manish Giri
@Manish-Giri
Jan 12 2017 06:14
@Karthika107 you need to use a switch probably.
Alexander Køpke
@alexanderkopke
Jan 12 2017 06:14
@Karthika107 you can use a switch thingy
Manish Giri
@Manish-Giri
Jan 12 2017 06:14
^
Robert DeNovellis
@RobDeNo
Jan 12 2017 06:14
@psbyron3 you know what is interesting about all the help i got on this problem
for people like me that were missing it
the problem read like there are three steps
instead of two
Phil Seidel
@psbyron3
Jan 12 2017 06:14
Right, there can be three steps. It can be simplified to two.
Robert DeNovellis
@RobDeNo
Jan 12 2017 06:15
it read that adding and removeing elemnts in the array are two seperate steps, then returning it is another step
i wish it was clearer and just said.
Phil Seidel
@psbyron3
Jan 12 2017 06:15

You could do:

push new item
var otherItem = arr.shift()
return otherItem

Robert DeNovellis
@RobDeNo
Jan 12 2017 06:15
so i can add variables to my code in freecodecamp.com
for the lessons
?
Phil Seidel
@psbyron3
Jan 12 2017 06:16
Absoultely
Robert DeNovellis
@RobDeNo
Jan 12 2017 06:16
greatt to know
Phil Seidel
@psbyron3
Jan 12 2017 06:16
Absolutely**
Robert DeNovellis
@RobDeNo
Jan 12 2017 06:16
eveyr lessons i looked up on functions with parameters, had other local variables
this one declared none,
Manish Giri
@Manish-Giri
Jan 12 2017 06:16
try not to use much global variables, especially in the algorithmic challenges
Karthika
@Karthika107
Jan 12 2017 06:16
@Manish-Giri : I did that but now I want to solve counting cards problem only using an array...
Alexander Køpke
@alexanderkopke
Jan 12 2017 06:17
arrow up allows you to alter the last chat entry :)
Manish Giri
@Manish-Giri
Jan 12 2017 06:17
o.O
Robert DeNovellis
@RobDeNo
Jan 12 2017 06:17
@Manish-Giri very true, then you start getting all kinds of error when theyoverlap
small controlled enviorments
Manish Giri
@Manish-Giri
Jan 12 2017 06:17
@RobDeNo yeah
@Karthika107 array?
Karthika
@Karthika107
Jan 12 2017 06:18
@Manish-Giri yeah...
Phil Seidel
@psbyron3
Jan 12 2017 06:18
@RobDeNo He's right, it is bad practice to establish globals variables. Once you start writing hundreds or thousands of lines of codes you can get strange and difficult-to-debug side effects
Sorry, it is bad to set global variables that DONT NEED to be global
Manish Giri
@Manish-Giri
Jan 12 2017 06:19
yeah
Ha Nguyen
@uxsasukexnaruto
Jan 12 2017 06:22
["a", "o", "e", "n"]
How do I capitalize each of these string in the array?
Alexander Køpke
@alexanderkopke
Jan 12 2017 06:23
@Karthika107 dunno seems easier to use an object. This way you can set the key as the card and get it to return the value which you can then sum to a variable.
Manish Giri
@Manish-Giri
Jan 12 2017 06:23
@uxsasukexnaruto use .map() perhaps?
Joseph
@revisualize
Jan 12 2017 06:23
@uxsasukexnaruto You can use a for loop across the array.
You could arr[0] = arr[0].toUpperCase();
You could use .map()
This message was deleted
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:24
https://codepen.io/Geeheeb/full/zNrgdO/ hey ppl, if you could have a go of this hangman game and tell me if you find any bugs that would be cool, and if you have any ideas about how i would reset the game after someone wins or loses that would be cool, and also yeah i know it doesnt look the best yet, just trying to get it functional, thanks in advance
Karthika
@Karthika107
Jan 12 2017 06:25
@Manish-Giri Can you please explain the procedure...
Ha Nguyen
@uxsasukexnaruto
Jan 12 2017 06:25
thanks for the suggestions guys @Manish-Giri @revisualize
CamperBot
@camperbot
Jan 12 2017 06:25
uxsasukexnaruto sends brownie points to @manish-giri and @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3720 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 2940 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jan 12 2017 06:26
@HeebieGeeBee Seriously!?
@HeebieGeeBee The first word that I got.
TROUBLE
Your thing hates me.
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:27
lol
i programmed in a special @revisualize clause
Joseph
@revisualize
Jan 12 2017 06:27
:|
screw you guys.
I'm going to bed.
:fu: and your TROUBLE
:P
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:28
lol
night
Joseph
@revisualize
Jan 12 2017 06:28
Seriously, that was my freaking word.
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:28
didnt evenknow i had it in the word bank
Joseph
@revisualize
Jan 12 2017 06:28
I did A E I O U I got two errors because of the A and the I.
I hit T
And then I almost knew what the word was.
Hit R
Manish Giri
@Manish-Giri
Jan 12 2017 06:29
@Karthika107 well, this would be better off without arrays, but since you want arrays, one idea is maybe have three arrays - one each for 2, 3, 4, 5, 6, 7,8,9, and the third set. Then you could use the function paramter card and check it's indexOf in each array to find which array it is in, and increment/decrement count accordingly. Finally, when you have count, return count along with the string depending on whether it's more than or less than 0..
Joseph
@revisualize
Jan 12 2017 06:29
And I had it.
Horrible.
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:29
well congrats on winning anyways
at least thats something
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:34
cant remember if i said but ty for you help yesterday @Manish-Giri still havent made the used letters array an object
CamperBot
@camperbot
Jan 12 2017 06:34
heebiegeebee sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 3721 | @manish-giri |http://www.freecodecamp.com/manish-giri
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:34
and ty @revisualize for playing
CamperBot
@camperbot
Jan 12 2017 06:34
heebiegeebee sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 2941 | @revisualize |http://www.freecodecamp.com/revisualize
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:35
and just being you i guess
Manish Giri
@Manish-Giri
Jan 12 2017 06:35
haha
@HeebieGeeBee the game runs fine without the object, so you probably don't need it
good job!
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:35
thanks i still need to figure out how to reset after a win or lose
Joseph
@revisualize
Jan 12 2017 06:36
Horrible should be another word in your selection.
HORRIBLE!
:P
I'm still shocked that my first word was TROUBLE
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:36
lol
Manish Giri
@Manish-Giri
Jan 12 2017 06:36
mine was ASK
lol
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:37
yeah theres some real tough ones in that word bank
Manish Giri
@Manish-Giri
Jan 12 2017 06:38
do you have words with repeating letters?
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:38
yeah
Manish Giri
@Manish-Giri
Jan 12 2017 06:38
okay
twitter button not working
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:41
@shenoyabhijith where do you link the twitter button a the twitter website?
your quote looping thing is a bit crazy aswell
it just starts looping through loads of quotes when you press the button
Abel lizarraga
@abelmoon18
Jan 12 2017 06:42
Hey guys can someone help me out with this
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:43
@shenoyabhijith your twitter button anchor tag doesnt have a link in it
Abel lizarraga
@abelmoon18
Jan 12 2017 06:43
I'm haveing a hard time with the converting C to F
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:44
just need to put the equation they give you in the details into the function
@abelmoon18
do you see the equation how to convert celsius to fahrenheit?
Abel lizarraga
@abelmoon18
Jan 12 2017 06:44
yea I do
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:45
so whats your code look like at the moment?
Abel lizarraga
@abelmoon18
Jan 12 2017 06:45
how can I post a pic here?
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:45
you can take a snippet and then just copy and paste it into the chat
Abel lizarraga
@abelmoon18
Jan 12 2017 06:46
Ok hold on
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:46
or you can just copy and paste your code and if you put it between backticks
'''
CamperBot
@camperbot
Jan 12 2017 06:46
:bulb: to format code use backticks! ``` more info
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:46
if you read that more info it will tell you how to format code in the chat
Phil Seidel
@psbyron3
Jan 12 2017 06:46
code goes here
Abel lizarraga
@abelmoon18
Jan 12 2017 06:46

function convertToF(celsius) {
var fahrenheit;
// Only change code below this line
fahrenheit = 0 9/5 + 32;
fahrenheit = -30
9/5 + 32;
fahrenheit = -10 * 9/5 + 32;

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

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

Phil Seidel
@psbyron3
Jan 12 2017 06:47
backticks baby
Manish Giri
@Manish-Giri
Jan 12 2017 06:47
lol
Abel lizarraga
@abelmoon18
Jan 12 2017 06:47
It doesn't say anywhere to use them
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:47
thats just for the chat @abelmoon18
'fahrenheit = -30 9/5 + 32;' you see here where you've put -30
Abel lizarraga
@abelmoon18
Jan 12 2017 06:48
Yea
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:48
thinking that you want to just convert -30c into fahrenheit
Abel lizarraga
@abelmoon18
Jan 12 2017 06:49
I don't understand what your saying sorry
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:49
in the function we dont want a specific temp, we want to create an algorithm
that uses the functions parameter, which in this case is celsius
Abel lizarraga
@abelmoon18
Jan 12 2017 06:50
So what am I suppose to put instead of the -30
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:50
youre meant to put the parameter of the function
and also its celsius * 9/5 make sure you dont miss that out
Abel lizarraga
@abelmoon18
Jan 12 2017 06:52
Oh I see what your saying
Let me try that
I'll be back in a bit
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:52
but the idea of doing a function is that we can run it and pass any value in the parameter so that it will do the conversion
Abel lizarraga
@abelmoon18
Jan 12 2017 06:54
Oh man thank you so much @HeebieGeeBee
CamperBot
@camperbot
Jan 12 2017 06:54
abelmoon18 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:cookie: 529 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Abel lizarraga
@abelmoon18
Jan 12 2017 06:54
I've bin stuck on that all day haha
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:54
yw, try read up about how functions and algorithms work in general
Abel lizarraga
@abelmoon18
Jan 12 2017 06:55
I will, thanks again
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:55
it will start to get very complicated if you just start going through the challenges without understanding the steps
Abel lizarraga
@abelmoon18
Jan 12 2017 06:56
yea I can see that now I'm gonna look into it right now
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 06:58
newarr.concat(steamrollArray(arr[i]) @cjljohnson what does this do?
oops
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 07:00
i mean is it doing what you intend it to do
cjljohnson
@cjljohnson
Jan 12 2017 07:00
no
it just returns [1]
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 07:01
well that is the else statement doing that
so the if is obviously picking up whats an array and what isnt
but this ' newarr.concat(steamrollArray(arr[i])' isnt doing what you hope
cjljohnson
@cjljohnson
Jan 12 2017 07:04
i realise that
i want to know why
why is the concat method not working?
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 07:05
might have something to do with the loop
cjljohnson
@cjljohnson
Jan 12 2017 07:06
so Array.isArray(arr[i]) is not valid?
that's what it says to use in the instructions
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 07:06
i think that part is valid
cjljohnson
@cjljohnson
Jan 12 2017 07:06
So the loop is fine then
HeebieGeeBee
@HeebieGeeBee
Jan 12 2017 07:07
yeah but you pass the function that goes and loops again
Ali Sahmoud
@asahmoud
Jan 12 2017 07:08
Hi guys, I am having problem with the profile lookup lesson can someone help me out with the code?
cjljohnson
@cjljohnson
Jan 12 2017 07:08
no i pass the element that is an array to run in recursively
Ali Sahmoud
@asahmoud
Jan 12 2017 07:09
blob
Joe Escobedo
@joeEscob1023
Jan 12 2017 07:16

i dont think i understand this concept...heelp

var arr = [
[1,2,3],
[4,5,6],
[7,8,9],
[[10,11,12], 13,14]
];
arr[3]; //equals [[10,11,12], 13, 14]
arr[3][0]; //equals [10,11,12]
arr[3]0;//equals 11

Andrei Constantin
@andrei-constantin
Jan 12 2017 07:18
hey @TacoJoe
Aaron
@apalm1341
Jan 12 2017 07:18
Hey all
Andrei Constantin
@andrei-constantin
Jan 12 2017 07:18
you have an array of arrays there
Aaron
@apalm1341
Jan 12 2017 07:18
I am thinking of getting online comp sci and/or gaming dev/designer and/or mobile app dev/designer bachelors and/or associates degrees
Andrei Constantin
@andrei-constantin
Jan 12 2017 07:19
where [1,2,3] is the first member, [4,5,6] the second and so on
Aaron
@apalm1341
Jan 12 2017 07:19
Does anyone out there know of good online programs for these things???
Would really appreciate it
Cause I am having hard time researching into it
Joe Escobedo
@joeEscob1023
Jan 12 2017 07:19
i thought [1,2,3] was the 0?