These are chat archives for FreeCodeCamp/HelpJavaScript

25th
Apr 2017
Stephen James
@sjames1958gm
Apr 25 2017 00:00
@JLuboff $(".sort:first") this seems to me to be the more explicit way
@MathematicsCoding bye
Oscar Lopez Guzman
@olopezg
Apr 25 2017 00:00
Hi guys!
Jason Luboff
@JLuboff
Apr 25 2017 00:00
@sjames1958gm Ya that makes more sense to me also. Anywho...I'm out...have a good afternoon/night all
Stephen James
@sjames1958gm
Apr 25 2017 00:01
@JLuboff cheers
@olopezg Hola
Oscar Lopez Guzman
@olopezg
Apr 25 2017 00:01
Im getting this error, trying to use Opern Weather API...
blob
Pagnito
@Pagnito
Apr 25 2017 00:01
@MathematicsCoding sup
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:02
@Pagnito hey
Pagnito
@Pagnito
Apr 25 2017 00:02
so in dna pairing, i split the string, but now i want to split that array into 3 seperate arrays, is ther a way to do that
Bryan Reese
@breese8009
Apr 25 2017 00:02
@olopezg did u copy ur api end point an paste in the browser an get this?
Pagnito
@Pagnito
Apr 25 2017 00:02
@MathematicsCoding u called for me?
i just came back into char
chat
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:02
ah
Im at Wherefore art thou..
Pagnito
@Pagnito
Apr 25 2017 00:03
yea fck where art thou
tho its a rly good practice
Bryan Reese
@breese8009
Apr 25 2017 00:03
@MathematicsCoding how u get that far with out knowing what an object an array is??
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:03
lol
Bryan Reese
@breese8009
Apr 25 2017 00:03
or an array*
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:03
@breese8009 I know what an array is...
I keep hearing about this object but never asked what object is
Oscar Lopez Guzman
@olopezg
Apr 25 2017 00:04
@breese8009 Im also getting this from console...
blob
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:04
@olopezg did you add jQuery to JS setting?
Pagnito
@Pagnito
Apr 25 2017 00:04
@SkyCoder01 hey r u online
Bryan Reese
@breese8009
Apr 25 2017 00:04
@olopezg it doesnt like ur api url endpoint
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:05
@Pagnito so help me with Wherefore art thou?
:\
Stephen James
@sjames1958gm
Apr 25 2017 00:05
@olopezg You have your js files out of order in your settings and openweather doesn't accept https URLs
Pagnito
@Pagnito
Apr 25 2017 00:06
@MathematicsCoding yea lemm see what u got
Oscar Lopez Guzman
@olopezg
Apr 25 2017 00:06
@MathematicsCoding yes I did
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:06
function whatIsInAName(collection, source) {
  var key = collection;
  for (var i = 0; i < collection.length; i++) {

  }
  return key[i-1];
}

whatIsInAName([{
  first: "Romeo",
  last: "Montague"
}, {
  first: "Mercutio",
  last: null
}, {
  first: "Tybalt",
  last: "Capulet"
}], {
  last: "Capulet"
});
Oscar Lopez Guzman
@olopezg
Apr 25 2017 00:06
@sjames1958gm Mmm... how can i fix that?
Bryan Reese
@breese8009
Apr 25 2017 00:07
@MathematicsCoding what is this?
Joseph
@revisualize
Apr 25 2017 00:08
@breese8009 Wherefore Art Thou.
@MathematicsCoding collection is an array of objects.
Stephen James
@sjames1958gm
Apr 25 2017 00:09
@olopezg You can change it to http:// on your URL - if you need https then add https://crossorigin.me/ to the front
Joseph
@revisualize
Apr 25 2017 00:09
@MathematicsCoding source is just an object.
Bryan Reese
@breese8009
Apr 25 2017 00:09
@revisualize he doesnt know objects yet.
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:09
I only know object is in {}
Joseph
@revisualize
Apr 25 2017 00:09
@breese8009 He does.
Bryan Reese
@breese8009
Apr 25 2017 00:10
@revisualize he doesnt
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:10
...
Joseph
@revisualize
Apr 25 2017 00:10
What?
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:10
@revisualize I guess its true
I had no idea what object is
But I learned object is only in {}
Im checking out this link
Joseph
@revisualize
Apr 25 2017 00:10
@MathematicsCoding Oh. Umm. To do that challenge you have to know what an object is.
Alyx
@Krimnsomb
Apr 25 2017 00:11
help! stuck on the JS Switch function. not sure if my grammer is wrong or what
Bryan Reese
@breese8009
Apr 25 2017 00:11
@Krimnsomb post ur code
Pagnito
@Pagnito
Apr 25 2017 00:11
@MathematicsCoding why are u sayin key = collection?
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:11
@Pagnito I just wanted to do it :\
Bryan Reese
@breese8009
Apr 25 2017 00:11
lol
Pagnito
@Pagnito
Apr 25 2017 00:12
@MathematicsCoding oh boi...
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:12
So I knew what object looks like,...
Joseph
@revisualize
Apr 25 2017 00:12
@Krimnsomb Help I can't see your code.
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:12
SO that was object..
Whole time I did API projects lol
Pagnito
@Pagnito
Apr 25 2017 00:12
@MathematicsCoding lol
Bryan Reese
@breese8009
Apr 25 2017 00:13
@MathematicsCoding if u did an api project then u have worked with objects before
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:13
Yeah I did
I didnt know what object meant
Pagnito
@Pagnito
Apr 25 2017 00:13
u should go back to javascript basics, and find the object lessons, and just go thru them one more time
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:13
...
Bryan Reese
@breese8009
Apr 25 2017 00:13
id go thru it 10 times
thats what i did
Pagnito
@Pagnito
Apr 25 2017 00:14
yea dude
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:14
Jeez...
Joseph
@revisualize
Apr 25 2017 00:14
@MathematicsCoding Objects are values that are represent collections of key value pairs.
Pagnito
@Pagnito
Apr 25 2017 00:14
i went thry the basics 4 times
Alyx
@Krimnsomb
Apr 25 2017 00:14
how do i post that?
Bryan Reese
@breese8009
Apr 25 2017 00:14
i went thru it till i completely understood what i was lookin at
Joseph
@revisualize
Apr 25 2017 00:14
@Krimnsomb Copy Paste
Alyx
@Krimnsomb
Apr 25 2017 00:14
copy
Bryan Reese
@breese8009
Apr 25 2017 00:14
cause first 2 i had no fucking clue what i was lookin at lmao
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:14
What about JS book? xD
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:14
@breese8009 lol
Pagnito
@Pagnito
Apr 25 2017 00:14
whatever u want, just go thru the basics until its a solid structure in ur head
Stephen James
@sjames1958gm
Apr 25 2017 00:14
@breese8009 third time he had a clue - and now he has a fucking clue :)
Gulsvi
@gulsvi
Apr 25 2017 00:14
@Pagnito Back now
Pagnito
@Pagnito
Apr 25 2017 00:15
@SkyCoder01 sweeeeeeet
Alyx
@Krimnsomb
Apr 25 2017 00:15

function caseInSwitch(val) {
var answer = "";
// Only change code below this line
case answer:
"alpha";
break;

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

// Change this value to test
caseInSwitch(1);

Bryan Reese
@breese8009
Apr 25 2017 00:15
@sjames1958gm lmao
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:15
Yeah man Im trying out JS book
first
Joseph
@revisualize
Apr 25 2017 00:15

If you are posting code that is large, Please use Gist - https://gist.github.com/ then please paste the link here.
...
How to do code block format: ..... PLEASE try with a small block of code before you try to make a bigger one.
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code
```js [SHIFT+ENTER]
// your code here
``` [CTRL+ENTER or CMD+ENTER to send]
Please do not confuse `s with 's.
Also note that the ```s need to each be on their own lines
The ` key can usually be found on most keyboards up next to the 1 key.
If you hit SHIFT+` it will give you the ~.
Example:
```
code
```
...
Output:

var code = undefined;

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

Bryan Reese
@breese8009
Apr 25 2017 00:15
Pagnito
@Pagnito
Apr 25 2017 00:15
@SkyCoder01 i couldnt find a way to split an array into each element being its own array without looping thru it and slicing or splicing it, do u know a way?
Joseph
@revisualize
Apr 25 2017 00:16
@Krimnsomb So you don't have a switch. You just have a case statement.
Gulsvi
@gulsvi
Apr 25 2017 00:16
@Pagnito Can you give me an example array and what you want it to look like - not sure I understand :)
Pagnito
@Pagnito
Apr 25 2017 00:16
k hold on
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:16
I will try go thru Basic JS again on my old account
Bryan Reese
@breese8009
Apr 25 2017 00:16
@MathematicsCoding udemy.com/javascript-essentials/learn/v4/content is king for beginners
Alyx
@Krimnsomb
Apr 25 2017 00:16
ok
Joseph
@revisualize
Apr 25 2017 00:17
@breese8009 @MathematicsCoding That's a good course.
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:17
@breese8009
Introduction
6 Lectures
30:02
+
Basic Syntax
13 Lectures
03:36:19
+
Conditional Functions
5 Lectures
01:37:32
+
DOM Manipulation
8 Lectures
02:21:19
+
Final Overview
2 Lectures
03:58
These lessons?
Bryan Reese
@breese8009
Apr 25 2017 00:17
@MathematicsCoding yup
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:17
Alright thanks @breese8009
CamperBot
@camperbot
Apr 25 2017 00:17
mathematicscoding sends brownie points to @breese8009 :sparkles: :thumbsup: :sparkles:
:cookie: 486 | @breese8009 |http://www.freecodecamp.com/breese8009
Pagnito
@Pagnito
Apr 25 2017 00:17
var arr = ['abc']
var firstSplit = [a,b,c]
var finalSplit = [[a],[b],[c]]
@SkyCoder01
Bryan Reese
@breese8009
Apr 25 2017 00:17
for sure
Gulsvi
@gulsvi
Apr 25 2017 00:19
@Pagnito Yeah, there are ways to do it, .map() would be good
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:19
That is tough challenge @Pagnito
Pagnito
@Pagnito
Apr 25 2017 00:20
@SkyCoder01 so map thru firstsplit and slice each?
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:21
Alright Im also addicted to anime sorry.. So after that I will go through that udemy course :)
@breese8009 Is that like entire lessons of JS?
Better lessons than basic JS here?
Gulsvi
@gulsvi
Apr 25 2017 00:22
@Pagnito Had to test it out - but it looks like this:
arr[0].split('').map(function(letter) {
  return [letter];
})
That gives you: [["a"], ["b"], ["c"]]
Bryan Reese
@breese8009
Apr 25 2017 00:23
@MathematicsCoding def not js in its entirety, nothing has js in its entirety but it def got me goin w JS
Kyle Naumovski
@egnarodrinksOJ
Apr 25 2017 00:23
@Chrono79 Thank u!
CamperBot
@camperbot
Apr 25 2017 00:23
egnarodrinksoj sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 3854 | @chrono79 |http://www.freecodecamp.com/chrono79
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:23
@breese8009 I dont understand..
Its not JS course?
Pagnito
@Pagnito
Apr 25 2017 00:23
@SkyCoder01 hm, hold gotta study real quik lol
Gulsvi
@gulsvi
Apr 25 2017 00:23
No problem
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:25
Hm Udemy is like Edx.
Bryan Reese
@breese8009
Apr 25 2017 00:25
@MathematicsCoding what? its not js in it entirety... theres ALOT to JS
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:26
Oh I see...
@breese8009 so are they all free lessons?
Bryan Reese
@breese8009
Apr 25 2017 00:26
yep
free99
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:27
free99?
Bryan Reese
@breese8009
Apr 25 2017 00:27
lol
free
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:27
lol
But some of other courses cost like 10 dollars
So this course is only free?
Pagnito
@Pagnito
Apr 25 2017 00:28
@SkyCoder01 so by mapping thru eacch, and return will take it out of the array and put it in its own array?
Saboor Malik
@MathematicsCoding
Apr 25 2017 00:28
Never mind...
Thanks again
Gtg
Gulsvi
@gulsvi
Apr 25 2017 00:29
@Pagnito Yeah, .map() returns a new array
Pagnito
@Pagnito
Apr 25 2017 00:29
oooooh
Gulsvi
@gulsvi
Apr 25 2017 00:29
It basically loops through every value, and puts all of those values into a new array
Pagnito
@Pagnito
Apr 25 2017 00:30
mwuahahahaha!!!
yesss >:))
Gulsvi
@gulsvi
Apr 25 2017 00:30
:)
Pagnito
@Pagnito
Apr 25 2017 00:30
thanks @SkyCoder01
CamperBot
@camperbot
Apr 25 2017 00:30
pagnito sends brownie points to @skycoder01 :sparkles: :thumbsup: :sparkles:
:star2: 1178 | @skycoder01 |http://www.freecodecamp.com/skycoder01
Oscar Lopez Guzman
@olopezg
Apr 25 2017 00:31
@sjames1958gm aun no he podido hacer que funcione...
blob
nsonhouse
@nsonhouse
Apr 25 2017 00:32
Can someone explain how to define the search params for a npm package, when using the get function?
Stephen James
@sjames1958gm
Apr 25 2017 00:33
@olopezg Use https://crossorigin.me/ in front of your openweather URL
you cannot load http:// over https site - so this allows that
Mark Bryan
@MarkBryan
Apr 25 2017 00:35
Anybody done the "Counting Cards" exercise?
Oscar Lopez Guzman
@olopezg
Apr 25 2017 00:35
@sjames1958gm i already did... look
@sjames1958gm 'function getWeather(lat, lon){
$.getJSON('https://crossorigin.me/http://api.openweathermap.org/data/2.5/weather?lat=' + lat + '&lon='+ lon + '&APPID=53057ff2960c9c0abde9e301235da54f',function(json){
console.log('json')
});'
Stephen James
@sjames1958gm
Apr 25 2017 00:36
@olopezg Hmm.
Oscar Lopez Guzman
@olopezg
Apr 25 2017 00:36
''' function getWeather(lat, lon){
$.getJSON('https://crossorigin.me/http://api.openweathermap.org/data/2.5/weather?lat=' + lat + '&lon='+ lon + '&APPID=53057ff2960c9c0abde9e301235da54f',function(json){
console.log('json')
}); '''
CamperBot
@camperbot
Apr 25 2017 00:36
:bulb: to format code use backticks! ``` more info
Oscar Lopez Guzman
@olopezg
Apr 25 2017 00:36
function getWeather(lat, lon){ $.getJSON('https://crossorigin.me/http://api.openweathermap.org/data/2.5/weather?lat=' + lat + '&lon='+ lon + '&APPID=53057ff2960c9c0abde9e301235da54f',function(json){ console.log('json') });
Stephen James
@sjames1958gm
Apr 25 2017 00:36
@olopezg can you link your pen?
@MarkBryan yes
Oscar Lopez Guzman
@olopezg
Apr 25 2017 00:37
Mark Bryan
@MarkBryan
Apr 25 2017 00:39
@sjames1958gm Hi Steve, here's my codepen link: codepen.io/markbryan/post/counting-cards
Stephen James
@sjames1958gm
Apr 25 2017 00:40
@MarkBryan getting 404 error
mr.huang
@molunrenfei
Apr 25 2017 00:40
function largestOfFour(arr) {
  // You can do this!
  var newArr= new Array();
  for(var i=0;i<arr.length;i++){
    for(var j=0;j<i.length;j++){
      var num=arr[i][j];
      if(num<arr[i][j]){
        num=arr[i][j];
      }
    }
  newArr[i]=num;
  }
  return newArr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
kelsaurus89
@kelsaurus89
Apr 25 2017 00:40

Hi folks, I'm stuck on the Testing Objects for Properties exercise. Pretty sure I'm just having a brain fart, but I'm not seeing what I did wrong. Here's my code:

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

function checkObj(checkProp) {
 var isThere = myObj.hasOwnProperty(checkProp);

  if(isThere) {
    return myObj.checkProp;
  } else {
    return "Not Found";
  }
}

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

Any ideas?

CamperBot
@camperbot
Apr 25 2017 00:40
:bulb: to format code use backticks! ``` more info
Mark Bryan
@MarkBryan
Apr 25 2017 00:41
@sjames1958gm Sorry, It should be ok now. codepen.io/markbryan/post/counting-cards
Stephen James
@sjames1958gm
Apr 25 2017 00:42
@olopezg https://hide.me/en/ maybe this instead of crossorigin
mr.huang
@molunrenfei
Apr 25 2017 00:44
function largestOfFour(arr) {
  // You can do this!
  var newArr= new Array();
  for(var i=0;i<arr.length;i++){
    for(var j=0;j<arr[i].length;j++){
      var num=arr[i][j];
      if(num<arr[i][j]){
        num=arr[i][j];
      }
    }
  newArr[i]=num;
  }
  return newArr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Stephen James
@sjames1958gm
Apr 25 2017 00:45
@MarkBryan No space after Bet or Hold
kelsaurus89
@kelsaurus89
Apr 25 2017 00:46
NVM on my question, figured it out :)
Stephen James
@sjames1958gm
Apr 25 2017 00:46
@molunrenfei you are reseting num each loop initialize var num = 0 before the inner loop
@kelsaurus89 :+1:
mr.huang
@molunrenfei
Apr 25 2017 00:48
function largestOfFour(arr) {
  // You can do this!
  var newArr= new Array();
  var num=0;
  for(var i=0;i<arr.length;i++){
    for(var j=0;j<arr[i].length;j++){

      if(num<arr[i][j]){
        num=arr[i][j];
      }
    }
  newArr[i]=num;
  }
  return newArr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Mark Bryan
@MarkBryan
Apr 25 2017 00:49
@sjames1958gm Thank You! :)
CamperBot
@camperbot
Apr 25 2017 00:49
markbryan sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6942 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
mr.huang
@molunrenfei
Apr 25 2017 00:49
@sjames1958gm largestOfFour([[4, 9, 1, 3], [13, 35, 18, 26], [32, 35, 97, 39], [1000000, 1001, 857, 1]]) This group can not pass
Stephen James
@sjames1958gm
Apr 25 2017 00:50
@molunrenfei You moved it too far - between the two for loops - reset it for each inner array
@MarkBryan :checkered_flag:
@MarkBryan Hard to see as it looked "right"
mr.huang
@molunrenfei
Apr 25 2017 00:51
@sjames1958gm Thank you, I have to understand it。
CamperBot
@camperbot
Apr 25 2017 00:51
molunrenfei sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6943 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Mark Bryan
@MarkBryan
Apr 25 2017 00:52
@sjames1958gm Yes, I removed the spaces like you suggested and then I appended a space (" " )between count and the "Bet" or "Hold" strings.
Kyle Naumovski
@egnarodrinksOJ
Apr 25 2017 00:53
@coymeetsworld Thx ! val not answer
CamperBot
@camperbot
Apr 25 2017 00:53
egnarodrinksoj sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 2481 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
mr.huang
@molunrenfei
Apr 25 2017 00:57
@sjames1958gm No reset, the second group all the numbers are smaller than him, so it can not pass. what
Stephen James
@sjames1958gm
Apr 25 2017 00:59
@molunrenfei :+1:
Caleb Brenner
@cwborion
Apr 25 2017 01:02
I'm not sure how I'm supposed to pass the Word Blanks step. I enter the code correctly for the first set of word blanks, but the final step is still incorrect, for the other set of word blanks that aren't prewritten as part of the exercise.
It's like you have to do it one way or the other, but in that cased, only two of the three steps are completed in the end.
Coy Sanders
@coymeetsworld
Apr 25 2017 01:08
what code do you have so far @cwborion ?
Caleb Brenner
@cwborion
Apr 25 2017 01:08

@coymeetsworld

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

result += "The " + myNoun + " was so " + myAdjective +" that when he " + myVerb + " he " + myAdverb + " got tired.";

// Your code above this line
return result;
}

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

Coy Sanders
@coymeetsworld
Apr 25 2017 01:09
you dont want to declare variables inside the function
myNoun, myAdjective, etc are passed to you inside the function
just erase the 4 lines that start with var (keep var result) so you're using the parameters instead of the variables you declare, then it should be ok
Caleb Brenner
@cwborion
Apr 25 2017 01:11
@coymeetsworld I don't understand. Probably because Freecodecamp gives zero explanation about how that works or how the result works. Thanks, will try!
CamperBot
@camperbot
Apr 25 2017 01:11
cwborion sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 2482 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
Apr 25 2017 01:12
i feel like it explains it fine @cwborion , maybe consider revisiting other challenges
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:12
@cwborion read the instructions: passing arguments tofunctions
Coy Sanders
@coymeetsworld
Apr 25 2017 01:13

when you have a function declaration like above,
function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {

that means when you call wordBlanks the first argument will be referenced as myNoun inside the function, second argument would be myAdjective, and so on

Caleb Brenner
@cwborion
Apr 25 2017 01:14
@forwebtech that step is like ten ahead of the challenge I'm on
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:14
@cwborion but actually still you don't get the concepts !
Caleb Brenner
@cwborion
Apr 25 2017 01:14
@forwebtech oh I was just explaining that it wasn't covered yet so I don't know how I would have had that knowledge
@coymeetsworld that makes senes to me
Coy Sanders
@coymeetsworld
Apr 25 2017 01:15
FCC by no means all exclusive @cwborion, its not bad to try to look at other sources of information either
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:15
@cwborion FCC gives just references ! so you should to look out your self !
Coy Sanders
@coymeetsworld
Apr 25 2017 01:16
it doesn't just give references it does try to explain the concepts
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:16
@coymeetsworld but its really hard for beginners, folks come here and pasting code here, actually they didn't get the concepts .
@coymeetsworld how much time you have passed in programming ??
Coy Sanders
@coymeetsworld
Apr 25 2017 01:18
@forwebtech a while, but the program has been successful to new people
it does have a high fail rate, since its free and programming is relatively difficult
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:18
@coymeetsworld did you join FCC as beginner ??
Coy Sanders
@coymeetsworld
Apr 25 2017 01:18
no
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:19
@coymeetsworld well then we can't imagine the problem, that new comers faces !!, but the biggest problem is that they rely only on FCC !
Coy Sanders
@coymeetsworld
Apr 25 2017 01:19
plenty of new people that do get it though
Caleb Brenner
@cwborion
Apr 25 2017 01:19
for sure, I've done lots of searching but it's hard to know what to search for sometimes if the lesson is extremely vague. For instance, if some of the code that is prewritten has characters and formats and such that are completely unfamiliar, a brief explanation of their purposes and why they're there, in my opinion, would give me the correct information to at least search for it online and figure it out myself. I wouldn't have thought in a million years to start the code with "return=". From everything I've learned so far, I would have written it as such. I would have just made my own string for it.
Coy Sanders
@coymeetsworld
Apr 25 2017 01:20
and you can gauge how someone new will read new content
since you had to do it before and you know what worked and what didn't
start code with "return="?
Caleb Brenner
@cwborion
Apr 25 2017 01:21
I've had lots of success figuring things out on my own through searching though. Learned lots of new cool tricks on my portfolio project just from looking and messing around. This particular situation struck me as really vague.
Coy Sanders
@coymeetsworld
Apr 25 2017 01:21
when do you do that?
Caleb Brenner
@cwborion
Apr 25 2017 01:21
result*
sorry
Coy Sanders
@coymeetsworld
Apr 25 2017 01:21
takes practice to learn the material
variables are just like what you used in HS math
Caleb Brenner
@cwborion
Apr 25 2017 01:22
for sure. Lots of familiarizing with syntax and such ahead of me
Coy Sanders
@coymeetsworld
Apr 25 2017 01:22
can be anything you want
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:22
@coymeetsworld indeed, not !, well i am doing it and by my experience in FCC, am telling ! specially in the help section, mostly new comers didn't get the concept!
but at last, they have to learn at their own, like search / experimenting, therefore here they can only just pass out from any problem.
Coy Sanders
@coymeetsworld
Apr 25 2017 01:24
@forwebtech you spoke with most new comers and they all had trouble with the concepts?
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:24
mostly !
Coy Sanders
@coymeetsworld
Apr 25 2017 01:25
wow, quite a bit of people, FCC has over 200k stars
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:25
but i also read :)
comments
@coymeetsworld did you take any course in programming ??
or web development ??
Coy Sanders
@coymeetsworld
Apr 25 2017 01:27
yes I graduated with a CS degree
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:27
:) so how the teacher taught you ??
*teachers
Coy Sanders
@coymeetsworld
Apr 25 2017 01:27
not sure I understand the question
could you be more specific?
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:28
what was the procedure of teaching of your teachers in your institute ?
where you did graduate !
Nick
@Ninikitos
Apr 25 2017 01:30
Need some help with JS syntactics. I'm doing a simple challenge. How do \n and \ working? here is my code var myStr = '\nFirstLine\ newline \backslash\ SecondLine \backslash\ \rcarriage-return\ ThirdLine'; // Change this line
Name of challenge Escape Sequences in Strings
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:31
@Ninikitos that is the \ escape character
if we put that backslash, to characters like \n or \r so they just not print n or r but they do some action like : breaking lines, or putting tab space !

so:

newline >   \n
backslash  >  \\
carriage return  > \r

just use those characters instead of their names !

also if you want to print \ in your string then you have to escape it also like: \\
Nick
@Ninikitos
Apr 25 2017 01:36
@forwebtech I'm keep trying to replace escape characters but its not working var myStr = "FirstLine\n \SecondLine\ \rThirdLine";
@forwebtech var myStr = "FirstLine\n \SecondLine\ \rThirdLine";
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:37
@Ninikitos escape also \ backslash as, \\
@Ninikitos one more thing is that, remove any space in your string.
Nick
@Ninikitos
Apr 25 2017 01:38
@forwebtech Spacing was a problem =) Thank You
CamperBot
@camperbot
Apr 25 2017 01:38
ninikitos sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 326 | @forwebtech |http://www.freecodecamp.com/forwebtech
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:39
@Ninikitos Welcome :sparkles:
daiwik
@daiwik
Apr 25 2017 01:48
for random quote
when i tweet p gets outputted as text
any hints?
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:48
@daiwik first save text and then delete the tag !
aRtoo
@artoodeeto
Apr 25 2017 01:49
hello guys. been struggling on this problem. "Nesting for Loops" its in 225 on fcc.
the problem is to multiply this array. multiplyAll([[1,2],[3,4],[5,6,7]]); and
i also cant understand my code. but i tried to trace it on paper and somewhat know about it but if anyone could explain the program and why am i wrong. please. please please.


function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line


    for(var i=0; i < arr.length; i++){
      for(var c=0; c < arr[i].length; c++){

        product = product * arr[i] * arr[c];

      }
    }

  // Only change code above this line
  return product;

}



// Modify values below to test your code
multiplyAll([[1],[2],[3]]);
//multiplyAll([[1,2],[3,4],[5,6,7]]);
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:49
how did you save it ??
@artoodeeto why are you multiplying with * arr[c]
@artoodeeto you just have to use it like: product x arr[i][c]
aRtoo
@artoodeeto
Apr 25 2017 01:52
@forwebtech because from tracing it on paper when i goes the loop it will ask the condition if c<i. so if yes. the program. will mult arry 0 then arry 1
@forwebtech ha?? why. then it wont multiply
daiwik
@daiwik
Apr 25 2017 01:52
nvm got it
I used $(<p>Passion, dedication, and silly lists of what designers need are what designers need.</p>Arman Nobari).text()
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:52
@artoodeeto surely it will multiply just try it ??
codeman1988
@codeman1988
Apr 25 2017 01:55
var myStr; // Change this line
myStr="We are the so-called \"Vikings\" from the north.";
why the \" is not working
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:55
@codeman1988 is it their any space between backslash and comma ??
@codeman1988 i think you are using single comma two times like '' without space it looks like double comma
aRtoo
@artoodeeto
Apr 25 2017 01:57
@forwebtech but man can u explain man/?\
Stephen James
@sjames1958gm
Apr 25 2017 01:57
@codeman1988 Some times these challenges are pretty picky - maybe move the string up to the var myStr line
Keon Samuel
@keonsam
Apr 25 2017 01:57
which should I learn first angular or react?
aRtoo
@artoodeeto
Apr 25 2017 01:58
@forwebtech its like i just know how to solve it because theres a example on the side
Aizaz Shahid
@aizazshahid
Apr 25 2017 01:58
@artoodeeto try to reset your code then ! but copy first !
aRtoo
@artoodeeto
Apr 25 2017 01:59
@forwebtech i mean. i know how to use the for loop. but when i tried to trace it. it confuses me.
Aizaz Shahid
@aizazshahid
Apr 25 2017 02:00
hmm well think about that, outer loop handles rows and inner loop handles columns, get it ??
awipio002
@awipio002
Apr 25 2017 02:00
hello
aRtoo
@artoodeeto
Apr 25 2017 02:01
@forwebtech bro can i PM u man??
please man
Aizaz Shahid
@aizazshahid
Apr 25 2017 02:01
@artoodeeto sure !
Stephen James
@sjames1958gm
Apr 25 2017 02:01
@artoodeeto arr[i] will be each of the inner arrays as the first for loop runs
arr[i][c] will then be the numbers inside the inner arrays.
arr is [[1,2],[3,4],[5,6,7]] 
then arr[0] is [1, 2]  when i is 0
   arr[0][0] is 1 then arr[0][1] is 2 for each c 0,1
then arr[1] is [3, 4} when i is 1
   arr[1][0] is 3 then arr[0][1] is 4 for each c 0,1
then arr[2] is [5, 6, 7] when i is 2
   arr[2][0] is 5, arr[2][1] is 6 arr [2][2] is 7 for each c 0, 1, 2
awipio002
@awipio002
Apr 25 2017 02:03
i need help for this challeng Escape Sequences in Strings
Greg Duncan
@GregatGit
Apr 25 2017 02:03
@artoodeeto it is an array with arrays in it - an array of arrays
awipio002
@awipio002
Apr 25 2017 02:03
this is my input:
var myStr ="newline\"\backslash\\ncariage-return\r"; // Change this line
Stephen James
@sjames1958gm
Apr 25 2017 02:05
@awipio002 You were supposed to replace those words, but keep the others -
aRtoo
@artoodeeto
Apr 25 2017 02:05
@sjames1958gm fudge man!! thanks man!! kinda understand it a little bit.
CamperBot
@camperbot
Apr 25 2017 02:05
artoodeeto sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6944 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
aRtoo
@artoodeeto
Apr 25 2017 02:05
@sjames1958gm thanks man. i love you
CamperBot
@camperbot
Apr 25 2017 02:05
artoodeeto sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: artoodeeto already gave sjames1958gm points
barki mustapha
@barkinet
Apr 25 2017 02:05

1 contributor
RawBlameHistory

11 lines (9 sloc) 241 Bytes

layout: default
title: Support Article Not Found

permalink: /404.html

<div class="text-center">
<h1>Hmm…</h1>
<p>This article doesn’t exist here. Try the <a href="{{site.baseurl}}/#faq">Support</a> page.</p>
</div>

Stephen James
@sjames1958gm
Apr 25 2017 02:05
@artoodeeto :heart: lol
Greg Duncan
@GregatGit
Apr 25 2017 02:05
@artoodeeto multipying arr[i] is trying to say multiply [3,4]
Manny
@Alloffices
Apr 25 2017 02:05

``` var motorBike = {
"wheels":4,
"engines":4,
"seats":4
// Only change code below this line.

};
```

aRtoo
@artoodeeto
Apr 25 2017 02:06
@GregatGit yea. thanks man. its like accessing multi demnsion arrays
CamperBot
@camperbot
Apr 25 2017 02:06
artoodeeto sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 844 | @gregatgit |http://www.freecodecamp.com/gregatgit
Manny
@Alloffices
Apr 25 2017 02:06
THese are objects correct?
Aizaz Shahid
@aizazshahid
Apr 25 2017 02:06
@Alloffices correct !
Manny
@Alloffices
Apr 25 2017 02:06
how dose a constructor differ from it
Greg Duncan
@GregatGit
Apr 25 2017 02:06
@artoodeeto do you know how to put a break point in
aRtoo
@artoodeeto
Apr 25 2017 02:07
@GregatGit ha?? it doesnt say
Aizaz Shahid
@aizazshahid
Apr 25 2017 02:07
@Alloffices when you want to use that object more than two places then constructor came !
aRtoo
@artoodeeto
Apr 25 2017 02:07
@GregatGit u mean like break; ??
Greg Duncan
@GregatGit
Apr 25 2017 02:07
@artoodeeto no
Aizaz Shahid
@aizazshahid
Apr 25 2017 02:07
only its template !
Stephen James
@sjames1958gm
Apr 25 2017 02:07
@Alloffices A constructor will be a function, which is called with the new operator and builds the object
Greg Duncan
@GregatGit
Apr 25 2017 02:07
@artoodeeto are you using chrome?
Manny
@Alloffices
Apr 25 2017 02:08
@forwebtech @sjames1958gm thanks
awipio002
@awipio002
Apr 25 2017 02:08
OK i see thx @sjames1958gm
CamperBot
@camperbot
Apr 25 2017 02:08
alloffices sends brownie points to @forwebtech and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 327 | @forwebtech |http://www.freecodecamp.com/forwebtech
:star2: 6945 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Apr 25 2017 02:08
@awipio002 It is a single string so only one set of " "
aRtoo
@artoodeeto
Apr 25 2017 02:09
@GregatGit ahw. hahaha. sorry man but yea im on chrome
Greg Duncan
@GregatGit
Apr 25 2017 02:09
if so use the line debugger; then open up the dev tools shift control i run the example and it will stop at the debugger line
aRtoo
@artoodeeto
Apr 25 2017 02:10
@GregatGit where should i put the line debugger
Greg Duncan
@GregatGit
Apr 25 2017 02:10
just before or just in the for loop
Cherri Sorrells
@csorrells
Apr 25 2017 02:21
Use a for loop to work to push the values 1 through 5 onto myArray.
Can someone help with this?
I'm super stuck
Andy
@Andy189
Apr 25 2017 02:21
blob
Ask how to change here
Stephen James
@sjames1958gm
Apr 25 2017 02:22
@csorrells Do you have any code? Probably similar code to the sample
@Andy189 setGear needs a parameter to set gear to
Cherri Sorrells
@csorrells
Apr 25 2017 02:22
Screen Shot 2017-04-24 at 9.22.28 PM.png
@sjames1958gm
Screen Shot 2017-04-24 at 9.22.28 PM.png
Stephen James
@sjames1958gm
Apr 25 2017 02:24

@csorrells this code pushes the values from 0 - 4 onto ourArray

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

var i = 0 sets the first value of (or the first value pushed to ourArray)
i < 5 says keep going until i is 5
i++ says after each loop add one to i

Andy
@Andy189
Apr 25 2017 02:25
@sjames1958gm Okay thank you.
CamperBot
@camperbot
Apr 25 2017 02:25
andy189 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6946 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Pagnito
@Pagnito
Apr 25 2017 02:25
why is it that if i set a condition in a loop and once that condition is true and i want to define a variable at that point THEN break the loop, it doesnt let me define, it just breaks the loops once the condition is true
Stephen James
@sjames1958gm
Apr 25 2017 02:25
@csorrells
so you will need a for loop - modified for the range 1 - 5
for (var i = ?; i < ?; i++)
What values should go in these two ?
@Pagnito because the condition is tested before entering the loop again
Manny
@Alloffices
Apr 25 2017 02:27
whats the difference btwn : var thing = function() & function thing()
Saboor Malik
@MathematicsCoding
Apr 25 2017 02:27
You cant have function assigned to variable..
Unless they are methods
Stephen James
@sjames1958gm
Apr 25 2017 02:27
@MathematicsCoding Sure you can
Saboor Malik
@MathematicsCoding
Apr 25 2017 02:27
Really?
Manny
@Alloffices
Apr 25 2017 02:28
Are they the same thing?
Pagnito
@Pagnito
Apr 25 2017 02:28
@sjames1958gm is there way to get done what im talking about
Stephen James
@sjames1958gm
Apr 25 2017 02:30
@Alloffices In the code below the function f1 will be defined everywhere in the function so the call to f1()
can be before the definition. The function f2 is only valid after the assignment.
Research function hoisting for more info
function test() {
    f1();  // valid
    f2(); // invalid
    function f1() {}
    var  f2 = function() {}
    f2(); // valid
}
@Pagnito Just before the loop ends you could see if the condition - 1 is true and do something
Saboor Malik
@MathematicsCoding
Apr 25 2017 02:30
Interesting..
Stephen James
@sjames1958gm
Apr 25 2017 02:31
@MathematicsCoding Functions are first class entities in js
TahsinTabassum
@TahsinTabassum
Apr 25 2017 02:31

need help
function myLocalScope(myVar) {
myVar = 'use strict';

console.log(myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
console.log(myVar);

// Now remove the console log line to pass the test

Stephen James
@sjames1958gm
Apr 25 2017 02:32
@TahsinTabassum Did you do what that last line says?
Pagnito
@Pagnito
Apr 25 2017 02:32

@sjames1958gm

function fearNotLetter(str) {

  var arr = [];
  for (var i = 0; i < str.length; i++) {
    var uniC = str[i].charCodeAt();
    arr.push(uniC);
  }

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

    if (arr[j] !== arr[0] + j)
     console.log(String.fromCharCode(arr[j] - 1));
     break;

  }

}

fearNotLetter("abcdefghjklmno");

not sure what you mean, but this is what i got , can u modify it to let me what u mean

if i use return instead of console i can pass, but iwant to to know how to save that value
barki mustapha
@barkinet
Apr 25 2017 02:33
"Premature optimization is the root of all evil."
—Donald Knuth
Mathew Gellner-Garcia
@Rafewey
Apr 25 2017 02:33

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

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

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

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

var Bike = function() {
  var gear = 0;

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

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




  // Only change code below this line.

};

var myCar = new Car();

var myBike = new Bike();
how is this wrong?
Stephen James
@sjames1958gm
Apr 25 2017 02:33
@Rafewey Don't add in setGear - it is just setting the gear
@Pagnito Your if is missing {} - you can set the value to a variable defined outside the for loop
LeSean Johnson
@leseanbiz
Apr 25 2017 02:34
hey guys, anyone mind looking at my weather app? I have the logic for changing the back groud working and i have tested the code block for getting geoloc data, and it works solo. however im getting connection errors. I have changed codepen to https as well as my api call.
Daniel Zeff
@Diesirae9
Apr 25 2017 02:35
Did you guys find JS hard to learn....
Pagnito
@Pagnito
Apr 25 2017 02:35
@sjames1958gm haha nice, well that was soo satsifying to hear
Stephen James
@sjames1958gm
Apr 25 2017 02:35
if (arr[j] !== arr[0] + j) {
     console.log(String.fromCharCode(arr[j] - 1));
     someVar = String.fromCharCode(arr[j] - 1);
     break;
}
Daniel Zeff
@Diesirae9
Apr 25 2017 02:36
I am just wondering, I ceel like I am having a really hard time understanding how I should be thinking when I am doing this I guess.
Pagnito
@Pagnito
Apr 25 2017 02:36
@sjames1958gm yup the brackets did the tricks, thanks, i dnno how i forgot those
CamperBot
@camperbot
Apr 25 2017 02:36
pagnito sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6947 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Daniel Zeff
@Diesirae9
Apr 25 2017 02:36
I feel*
Stephen James
@sjames1958gm
Apr 25 2017 02:36
@leseanbiz openweather doesn't support https without paying
LeSean Johnson
@leseanbiz
Apr 25 2017 02:37
@sjames1958gm hrm, ok. so how am i supposed to use them since they are recommended? my browser is erroring out when i try and run the code with the god function in
@Diesirae9 its not easy
Stephen James
@sjames1958gm
Apr 25 2017 02:38
@Diesirae9 My advice is to think about the algorithms from a non-code perspective before committing to code.
If you commit to code too soon and get off the path it can be hard to get back on.
Don't be afraid to reset the code if it gets too complex.
When you put down a line of code try to understand what it does when you do
LeSean Johnson
@leseanbiz
Apr 25 2017 02:38
if it was easy this chat room wouldnt be nearly this active
Daniel Zeff
@Diesirae9
Apr 25 2017 02:39
makes me feel better, HTML and CSS seemed to make a lot of sense, I feel like I keep needing to look up answers and then think about how the answer actually solves my problem.
LeSean Johnson
@leseanbiz
Apr 25 2017 02:40
yeah…..thats how it works
lol
Stephen James
@sjames1958gm
Apr 25 2017 02:40
@leseanbiz Yeah, chrome kind of screwed the pooch on this one by forcing https:// for geoloc about a year ago.
I went the ip based location route - using http://ip-api.com/json for my location info (so I am running the whole thing http://)
I know others that have used https://www.wunderground.com/weather/api/ because it supports https
LeSean Johnson
@leseanbiz
Apr 25 2017 02:40
you pretty much hit the nail on the head
well……damnit
Daniel Zeff
@Diesirae9
Apr 25 2017 02:40
lol alright then... just keep grinding huh?
LeSean Johnson
@leseanbiz
Apr 25 2017 02:40
i already write all my code based on the condition id value that isnt returned by other weather pia
apis
*
Stephen James
@sjames1958gm
Apr 25 2017 02:41
It is a challenge to get into the mindset of translating English instructions to coding concepts.
The more you do it the easier it gets.
@leseanbiz Then I would fall back to ip based location -
@Diesirae9 If you are committed to understanding rather than just pushing through the challenges it will come.
LeSean Johnson
@leseanbiz
Apr 25 2017 02:42
ok, so then that just adds another getJSON call to my code instead of the getcurrentposition function??
Stephen James
@sjames1958gm
Apr 25 2017 02:43
@leseanbiz yes
LeSean Johnson
@leseanbiz
Apr 25 2017 02:43
man, thank you…. @sjames1958gm
CamperBot
@camperbot
Apr 25 2017 02:43
leseanbiz sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6948 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Apr 25 2017 02:44
@leseanbiz Since geoloc was async already it shouldn't be too hard to wedge in there :)
yw
Daniel Zeff
@Diesirae9
Apr 25 2017 02:44
I like your idea of really trying to understand the algorithms I am writing. So if I need to look it up. just take some extra time to re translate the code.
LeSean Johnson
@leseanbiz
Apr 25 2017 02:44
not sure exactly what that means @sjames1958gm
Daniel Zeff
@Diesirae9
Apr 25 2017 02:45
I feel like when I look at the answer I understand what I am writing down, the hard hard at this points seem to take what I know and put it into the computer in a logical way that the computer says "Ahhhh, you want this!"
Stephen James
@sjames1958gm
Apr 25 2017 02:46
@leseanbiz You already are calling openweather in the geoloc callback, now you will call it from the new getJSON callback
TahsinTabassum
@TahsinTabassum
Apr 25 2017 02:46
@sjames1958gm still not working :(
Saboor Malik
@MathematicsCoding
Apr 25 2017 02:46
@sjames1958gm Where did you learn JS?
Stephen James
@sjames1958gm
Apr 25 2017 02:47
@TahsinTabassum try refreshing the page.
TahsinTabassum
@TahsinTabassum
Apr 25 2017 02:47
ok
Danny Welstad
@GoonTwo
Apr 25 2017 02:47
if I am getting the "call stack size exceeded" error on a function using recursion is there any way I am doing it correctly, but just getting cut off before the answer? Is there any way around this?
Stephen James
@sjames1958gm
Apr 25 2017 02:47
@MathematicsCoding I watched some YouTube videos. I have actually learned a lot here by helping, and seeing some of the others helping.
Saboor Malik
@MathematicsCoding
Apr 25 2017 02:47
I see
LeSean Johnson
@leseanbiz
Apr 25 2017 02:49
@sjames1958gm ahh ok, thats what i was thinking
Stephen James
@sjames1958gm
Apr 25 2017 02:49
@GoonTwo could be a bit of both. if you are doing recursion on a large dataset you might have to revert to non-recursive.
None of the challenges here should get you there.
Danny Welstad
@GoonTwo
Apr 25 2017 02:50
@sjames1958gm I have been unsuccesfully trying to implement the minimax algorithm on my tic tac toe game >:( are you fairly familiar with it?
TahsinTabassum
@TahsinTabassum
Apr 25 2017 02:50
@sjames1958gm still not working
Stephen James
@sjames1958gm
Apr 25 2017 02:51
@GoonTwo I am not. You shouldn't be recursing more than a few levels in that game.
@TahsinTabassum hmm let's see your code?
LeSean Johnson
@leseanbiz
Apr 25 2017 02:53
@sjames1958gm so, if i add that in i cant use ‘json’ in the call back since it is used before and that would screw up because of bad variable scoping? right?
json as the argument i mean
TahsinTabassum
@TahsinTabassum
Apr 25 2017 02:54

@sjames1958gm
function myLocalScope(myVar) {
'use strict';

console.log(myVar);
}
myLocalScope();

Stephen James
@sjames1958gm
Apr 25 2017 02:54
@leseanbiz If your callback, calls a function that does the getJSON (like you did with geoloc) then they have different scope
Ramzy Rashaun Arief
@ambi23
Apr 25 2017 02:54
could someone tell me where is the error

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

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

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

Stephen James
@sjames1958gm
Apr 25 2017 02:54
@TahsinTabassum What happened to var myVar in the function?
@ambi23 mispelled variable name
LeSean Johnson
@leseanbiz
Apr 25 2017 02:54
even of the api call would then be nested inside of the geolocation by ip call?
Ramzy Rashaun Arief
@ambi23
Apr 25 2017 02:55
@sjames1958gm thankss
CamperBot
@camperbot
Apr 25 2017 02:55
ambi23 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6949 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Saboor Malik
@MathematicsCoding
Apr 25 2017 02:56
@sjames1958gm lol I wonder if someone asked me same question in the future
Stephen James
@sjames1958gm
Apr 25 2017 02:56

@leseanbiz

$getJSON(url, function(json) {
    getWeather(info from json);
}

function getWeather(info) {
   $getJSON(url, function(json) {});
}

These two json variables are in completely different scopes

Saboor Malik
@MathematicsCoding
Apr 25 2017 02:56
Stephen James
@sjames1958gm
Apr 25 2017 02:57
@ambi23 :+1:
@MathematicsCoding lol
LeSean Johnson
@leseanbiz
Apr 25 2017 02:57
makes sense but i think my code is a little different than that.
Stephen James
@sjames1958gm
Apr 25 2017 02:58
@TahsinTabassum
function myLocalScope() {
  'use strict';
  var myVar;

  console.log(myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
// console.log(myVar);

// Now remove the console log line to pass the test
LeSean Johnson
@leseanbiz
Apr 25 2017 02:58
@sjames1958gm i made the argument ‘geo’ just to be safe. but it seems like the openweather api call is inside the first call to the ip-to-geoloc call
its working btw, i just want to actually understand why thats not buggering up the works
Stephen James
@sjames1958gm
Apr 25 2017 02:58
@leseanbiz Oh, ok. That is fine - I must have been remembering someone elses code
LeSean Johnson
@leseanbiz
Apr 25 2017 02:59
so, it would be an issue because of scoping?
Stephen James
@sjames1958gm
Apr 25 2017 03:00

@leseanbiz because you are extracting the data

      var latitude = geo.lat.toFixed(0);
      var longitude = geo.lon.toFixed(0);

before you call the second getJSON and block access to the first json variable

@leseanbiz If you tried to access the first json variable inside the second callback and they had the same name you would be hosed.
Moustapha
@moustaflo
Apr 25 2017 03:01
why is this not returning undefined?

function addTogether() {
 for(x=0; x<arguments.length;x++){
   if(typeof(arguments[x]) !== 'number' ){
      return undefined;
  }
 }

  if(arguments.length == 2){
    return arguments[0]+arguments[1];
  }
  if(arguments.length == 1){
    return function(){return 2+arguments[0];};

 }
}

addTogether(2)([3]);
LeSean Johnson
@leseanbiz
Apr 25 2017 03:01
yes!!!! @sjames1958gm thats what i thought and if they were both named json that would have happened.
Stephen James
@sjames1958gm
Apr 25 2017 03:01
@leseanbiz :+1:
LeSean Johnson
@leseanbiz
Apr 25 2017 03:01
thank you very much! i feel like i kind of get it the least little bit lol
Stephen James
@sjames1958gm
Apr 25 2017 03:01
:crescent_moon: Night all.
TahsinTabassum
@TahsinTabassum
Apr 25 2017 03:02

@sjames1958gm what did I do wrong ?
function myLocalScope(myVar) {
'use strict';

console.log(myVar);
}
myLocalScope();

// Run and check the console
// myVar is not defined outside of myLocalScope
var myVar = 10;
// Now remove the console log line to pass the test

Pagnito
@Pagnito
Apr 25 2017 03:02
so i read the mdn page on boolean object and still dont really understand it O.o
Stephen James
@sjames1958gm
Apr 25 2017 03:03
@TahsinTabassum myVar is supposed to be inside the function (not as a parameter) but as var myVar
You will likely have to refresh to get rid of the global myVar
TahsinTabassum
@TahsinTabassum
Apr 25 2017 03:04
@sjames1958gm oh ok thanks
CamperBot
@camperbot
Apr 25 2017 03:04
tahsintabassum sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 6950 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Danny Welstad
@GoonTwo
Apr 25 2017 03:05
Anyone on here who could lend a hand on using the minimax algorighm for the tic-tac-toe project?
TahsinTabassum
@TahsinTabassum
Apr 25 2017 03:06
@sjames1958gm not working :(
eduwin7
@eduwin7
Apr 25 2017 03:06
hi all
please help me
what am i missing

function destroyer(arr) {
// Remove all the values

var args = Array.prototype.slice.call(arguments);

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

}

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

?
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:08

@Pagnito look at that:

var x = "some";
if ( x ) { // returns true
  ....
}
// same as above
var boolObj = new Boolean(x);
// return true

hope that will make clear !

eduwin7
@eduwin7
Apr 25 2017 03:08

function destroyer(arr) {
// Remove all the values

var args = Array.prototype.slice.call(arguments);

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

}

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

Aizaz Shahid
@aizazshahid
Apr 25 2017 03:09
eduwin7
@eduwin7
Apr 25 2017 03:09

\\function destroyer(arr) {
// Remove all the values

var args = Array.prototype.slice.call(arguments);

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

}

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

\\

function destroyer(arr) {
// Remove all the values

var args = Array.prototype.slice.call(arguments);

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

}

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

Aizaz Shahid
@aizazshahid
Apr 25 2017 03:11

@Pagnito

Do not use a Boolean object in place of a Boolean primitive

Pagnito
@Pagnito
Apr 25 2017 03:11
@forwebtech so boolean promitive is basically true or false right?
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:12
yes :)
Pagnito
@Pagnito
Apr 25 2017 03:12
@forwebtech whats the point of boolean objects?
TahsinTabassum
@TahsinTabassum
Apr 25 2017 03:13
wheew solved
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:14
@Pagnito that's really a point, am still wondering hahah :)
Saboor Malik
@MathematicsCoding
Apr 25 2017 03:14
@Pagnito Will you do advanced one?
Pagnito
@Pagnito
Apr 25 2017 03:14
@forwebtech haha
Ken Haduch
@khaduch
Apr 25 2017 03:14
@sjames1958gm - :point_up: April 24, 2017 10:51 PM - hey, me too! Well, mine didn't have a rotary phone dial on it, but basically the same idea. I think it was ASR-33... :)
Pagnito
@Pagnito
Apr 25 2017 03:14
@MathematicsCoding of course haha, u have to do all
Saboor Malik
@MathematicsCoding
Apr 25 2017 03:14
:\
It not required tho
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:14
@Pagnito i think, they are used for objects like:
Pagnito
@Pagnito
Apr 25 2017 03:15
@MathematicsCoding skipping any parts only will hurt urself
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:15
objBool = Boolean(obj.property);
Saboor Malik
@MathematicsCoding
Apr 25 2017 03:15
Yeah I know
Pagnito
@Pagnito
Apr 25 2017 03:15
@forwebtech and what does that mean?
@MathematicsCoding the more u skip, the less fun coding will become
@MathematicsCoding eventually leading do demise!
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:17
to check whether it has the value or not !. but for that we have built in function, now here is the game, if we look onto that function !
we will know what is used there like how they are checking !
Pagnito
@Pagnito
Apr 25 2017 03:17
@forwebtech ooh ok
@forwebtech so its sort of like hasownproperty but more broad?
Ian Arsenault
@ianarsenault
Apr 25 2017 03:18
Wondering if anyone can help me . I'm trying to access two key values at the same time to display, then after set time display another two key values in a div. This would be continous. I'm stuck with being able to change the keys and still change the displaying of the contents in a div repeatedly. If anyone can help it would be much appreciated
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:20
@Pagnito yes !
Pagnito
@Pagnito
Apr 25 2017 03:20
@forwebtech mwuahahah thank you!
CamperBot
@camperbot
Apr 25 2017 03:20
pagnito sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 328 | @forwebtech |http://www.freecodecamp.com/forwebtech
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:21
.hasOwnProperty: A Boolean indicating whether or not the object has the specified property as own property.
its return description !
sorry return value description !
@Pagnito may be am wrong by that logic but who knows :+1:
Pagnito
@Pagnito
Apr 25 2017 03:22
@forwebtech hehe
brb
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:22
tyt
Ian Arsenault
@ianarsenault
Apr 25 2017 03:23
@forwebtech How would that work for a continuous loop of changing the keys?
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:24
@GorgonsMaze didn't get you ?
Ian Arsenault
@ianarsenault
Apr 25 2017 03:25
Im sorry, not sure if you were responding to me?
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:25
yes ! can you please clear you question ?
Ken Haduch
@khaduch
Apr 25 2017 03:27
@GorgonsMaze - your code index = ( index + 2 ) % numOfKeys; is just adding 0 to index, so you're always displaying the same location.
Ian Arsenault
@ianarsenault
Apr 25 2017 03:27
@forwebtech I have a nested object with a sub array. I'm trying to display the contents of each key's sub array in a div repeatedly.
  var obj = {
      "vig": [{
        title: "Vig Title",
        description: "Vig Description One"
      }],
      "sub": [{
        title: "Sub Title",
        description: "Substitution description here"
      }]

    };

    var numOfKeys = Object.keys(obj).length;
    var index = 0;

    console.log("Title: " + obj.vig[0].title + " Description: " + obj.vig[0].description);

    console.log("Title: " + obj.sub[0].title + " Description: " + obj.sub[0].description);

    // Trying to find a way to change vig->sub->vig->sub repeatedly

    setInterval(function() {
      $('#testDiv').text(obj.vig[0].title + " " + obj.vig[0].description);
      index = (index + 2) % numOfKeys;
    }, 5000);
@khaduch Yeah, thats what i'm stuck on. I tested it with a regular array array = ["title1", "description1" , "title2", "description2"]; and it works how I needed. Now I'm just trying to make it work with the object
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:29
make a loop for that as
Ken Haduch
@khaduch
Apr 25 2017 03:30
@GorgonsMaze - and then you aren't really using index for anything - you should be using obj[index].vig[0].title I think that is what you need. - sorry, I misread that.
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:30
you have used setInterval(), so browser will not get stuck !
Ian Arsenault
@ianarsenault
Apr 25 2017 03:31
@khaduch Yeah, I need this obj.vig[0].title to change to this obj.sub[0].title repeatedly, (back and forth)
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:33
@GorgonsMaze your object has only 2 properties ??
means they will not increase afterwards ?/
Ian Arsenault
@ianarsenault
Apr 25 2017 03:33
@forwebtech Yes
correct
Aizaz Shahid
@aizazshahid
Apr 25 2017 03:34
so you can do that :)
var c = 0;

if ( c== 0 ) {
    obj.prop[c];
     c = 1
} else  if ( c == 1 ) {
    obj.prop[c ]
     c = 0 
}
remember its declaration should be outside !
use that conditional statement into your .setInterval()
Ken Haduch
@khaduch
Apr 25 2017 03:35

@GorgonsMaze - you should be using this, maybe - I haven't tried it yet:

var objKeys = Object.keys(obj);
var numOfKeys = objKeys.length;

// then later on
$('#testDiv').text(obj[objKeys[index]][0].title ...

I think something like that will work - you have to use an array of keys, and index will iterate through that.

Ian Arsenault
@ianarsenault
Apr 25 2017 03:37
hmmm. let me see
Ken Haduch
@khaduch
Apr 25 2017 03:37

@GorgonsMaze - yeah, this is the line that will update your text:

$('#testDiv').text(obj[objKeys[index]][0].title + " " + obj[objKeys[index]][0].description);

In conjunction with the first two lines of code that I posted above.

Joseph
@revisualize
Apr 25 2017 03:40
Hello.
Ian Arsenault
@ianarsenault
Apr 25 2017 03:40
@khaduch Dude, yup. thats it.
@khaduch I was messing about with Object.keys() earlier, but couldn't figure it out.
@khaduch Thank you
CamperBot
@camperbot
Apr 25 2017 03:41
gorgonsmaze sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2790 | @khaduch |http://www.freecodecamp.com/khaduch
Ian Arsenault
@ianarsenault
Apr 25 2017 03:41
@forwebtech Thank you for the help
CamperBot
@camperbot
Apr 25 2017 03:41
gorgonsmaze sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 329 | @forwebtech |http://www.freecodecamp.com/forwebtech
Ken Haduch
@khaduch
Apr 25 2017 03:41
@GorgonsMaze - also, don't forget this: index = (index + 1) % numOfKeys; - but you might have already put that i nthere.
Ian Arsenault
@ianarsenault
Apr 25 2017 03:41
Yeah I got that.
Much appreciated
Nikki L.R.
@nikkilr88
Apr 25 2017 03:44
If anyone could help me out, I would really appreciate it! https://forum.freecodecamp.com/t/twitch-project-codepen-https-js-not-loading/109171
Ken Haduch
@khaduch
Apr 25 2017 03:46
@revisualize - hello there... how's it going?
Darwin Rosales
@dawen22
Apr 25 2017 03:48
help

function isLess(a, b) {
// Fix this code

return a === b;

}

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

Joseph
@revisualize
Apr 25 2017 03:48
@khaduch I'm good. Just chillin'. just got home.
@dawen22 isLess
@dawen22 This === is equal
@dawen22 You should be doing is less than
Ian Arsenault
@ianarsenault
Apr 25 2017 03:49
@dawen22 if you're returning true or false return a < b "<" is less than ">" is greater than
Will return true if a is less than b
Darwin Rosales
@dawen22
Apr 25 2017 03:50
ok thanks you
i got it
Pagnito
@Pagnito
Apr 25 2017 03:52
back
Ken Haduch
@khaduch
Apr 25 2017 03:54
@nikkilr88 - it looks like you are getting some kind of error, reported in the console, TypeError: data.follows[i] is undefined - have you seen that? I'm just wondering, since it looks like you're looping with a fixed loop control limit of 10 could it be possible that you are exceeding the limit of an array?
unless I've misread your code...
but that seems to be the same code in your working version... hmmmm.
although it looks like you might have changed the way you are getting your list of users?
MoniqueNoche
@MoniqueNoche
Apr 25 2017 03:57

var count = 0;

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

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

}

if (card >= 1) {
return (+count "Bet");
{
return (+count "Hold");
}
}
return "card";
// Only change code above this line
}

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

var count = 0;

function cc(card) {

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

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

}

if (card >= 1) {
return (+count "Bet");
{
return (+count "Hold");
}
}
return "card";

}

cc(2); cc(3); cc(7); cc('K'); cc('A');

what's wrong in this?

var count = 0;

function cc(card) {

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

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

}

if (card >= 1) {
return (+count "Bet");
{
return (+count "Hold");
}
}
return "card";

}

cc(2); cc(3); cc(7); cc('K'); cc('A');

Joseph
@revisualize
Apr 25 2017 04:02
@MoniqueNoche Counting Cards is a challenge where your function will receive a card parameter. You're supposed to increment or decrement the global count variable according to the card's value
If the value of the card parameter is 2, 3, 4, 5 or 6 you need to increment the global variable count.
If the value of the card parameter is 10, 'J', 'Q', 'K' or 'A' you need to decrement the global variable count.
...
Then the function will return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative.
The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
...
...
Things to note: You should NOT be returning based on the value of the card. The value of card should only be adding or subtracting 1 from the global variable count.
The value of the global variable count is used to determine the return statement.
anderson
@anderson2825
Apr 25 2017 04:02
str20025.png
how can i solve this problem?
Joseph
@revisualize
Apr 25 2017 04:03
@MoniqueNoche Your return statement is not based upon the value of count it's based on the value of card also. you're not doing string concatenation correctly.
@anderson2825 .substr()
Ken Haduch
@khaduch
Apr 25 2017 04:08
@nikkilr88 - I'm not sure what's going on exactly, except that it looks like you've commented out your list of users in the version that isn't working. The userSearch section? I guess I cannot spend too much more time on it now - maybe something that I've mentioned will ring a bell with you? I'm outta here for now...
sadeq
@sadeqabdi
Apr 25 2017 04:08
how to solved level understand string immutability??????????
Nigel Haslam
@motioncircus
Apr 25 2017 04:10
Hey folks,
I'm a novice cobbling together a quiz in javascript. I'm pulling questions in from a Google Sheet, as per this quickstart guide https://developers.google.com/sheets/api/quickstart/js
Oops.. that got away from me..
My problem lies in iterating the questions, one by one to present them as my quiz
From what I've read, finding the type of a javascript object is fraught with error
Joseph
@revisualize
Apr 25 2017 04:13
@sadeqabdi Strings are Immutable. Meaning that the string cannot be changed.
@sadeqabdi So, the string needs to be completely reassigned.
@sadeqabdi Think of strings as a stone carving. You can't really change the stone carving easily. You can however carve a new stone and call it the same thing.
Conor Murphy
@cmurphy580
Apr 25 2017 04:15
hey can anyone tell me why i have a test saying that [12-04] isn't recognized by this regex?
\[(((02-(0[0-9]|1[0-9]|2[0-8]))|((04|06|09|11)-(0[0-9]|1[0-9]|2[0-9]|30)))|((01|03|05|07|08|10|12)-(0[0-9]|1[0-9]|2[0-9]|3[0-1])))\]
sadeq
@sadeqabdi
Apr 25 2017 04:15
ok .
var myStr = "Jello World"
myStr = "Hello world"
myStr[0] = "H"
ok?
Andrew Strong
@bathorystoy
Apr 25 2017 04:19
dont know if it's how it is worded but im currently drawing a blank on this one 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.
Joseph
@revisualize
Apr 25 2017 04:19
@sadeqabdi Remove this line: myStr[0] = "H"
@sadeqabdi The free code camp test wants you to fix / change that line. With that line there.. The test is failing because it doesn't think that you made the corrections.

@bathorystoy Gist by revisualize / FreeCodeCamp - Stand in Line.js
You're supposed to:
Write a function nextInLine which has two parameters
an array (arr) and a number (item).
That part has been done for you here:

function nextInLine(arr, item) { }

Parameters are treated like variables that represent the values that get passed into your function from the function call (arguments).

You just need to add a number (item) to the end of an array (arr).
You also need to remove the first element from an array (arr) and you need to return the element that was removed.

So, How do you add a number (item) to the end of an array (arr)?
How do you remove the first element from an array (arr)?
...
Here's a brief example about how to use parameters:

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

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

sadeq
@sadeqabdi
Apr 25 2017 04:21
tank you @revisualize
anderson
@anderson2825
Apr 25 2017 04:34
@revisualize okay, I'll try it! thanks!
CamperBot
@camperbot
Apr 25 2017 04:34
anderson2825 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3828 | @revisualize |http://www.freecodecamp.com/revisualize
Branden Ng
@BrandenDaniel
Apr 25 2017 04:34
I cant seem to solve this one

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));
stand in line exercise
Andrew Strong
@bathorystoy
Apr 25 2017 04:35
im stuck there too
Joseph
@revisualize
Apr 25 2017 04:36
@BrandenDaniel :point_up: April 24, 2017 9:19 PM
@bathorystoy @BrandenDaniel Look.
You're supposed to:
Write a function nextInLine which has two parameters
an array (arr) and a number (item).
That part has been done for you here:
function nextInLine(arr, item) { }
Roxroy
@roxroy
Apr 25 2017 04:37
@bathorystoy , what is the name of the challenge?
Joseph
@revisualize
Apr 25 2017 04:37
So...
That part is done.
@BrandenDaniel @bathorystoy You just need to add a number (item) to the end of an array (arr).
How do you add a number (item) to the end of an array (arr)?
then.
Andrew Strong
@bathorystoy
Apr 25 2017 04:38
@revisualize .push?
Joseph
@revisualize
Apr 25 2017 04:38
@bathorystoy @BrandenDaniel You also need to remove the first element from an array (arr) and you need to return the element that was removed.
How do you remove the first element from an array (arr)?
@bathorystoy That answer is ambiguous.
@bathorystoy While it's correct I don't really know how correct it is. It may be 0% correct or 100% correct. Depending on how you actually do it.
Branden Ng
@BrandenDaniel
Apr 25 2017 04:40
@revisualize do we need to align any values to the params?
assign*
Joseph
@revisualize
Apr 25 2017 04:40
@BrandenDaniel Nope.
@BrandenDaniel Values are assigned to the parameters from the function call.

@BrandenDaniel If I have this code:

function addThree (num) {
    var result;
    result = num + 3;
    return result;
}

So, when we make the function call of:

addThree(10);

You're calling the function addThree You're also passing a value 10 as an argument.
In the function declaration of function addThree (num) { You see that there is a parameter defined of num
When we do addThree(10) then the value of the parameter num is passed the argument value of ... 10
Then if you follow the code through.. result = num + 3; ... and we know the value of num is 10.
Therefore, if we follow through the function we end up with ... result = 10 + 3; then result = 13; then we return the result.

...
@BrandenDaniel Note: That pre-written example is actually for something else but, I chopped parts out and I'm using it here.
@BrandenDaniel And because I'm lazy. I'm just going to run with it.
I hope you don't mind.
Branden Ng
@BrandenDaniel
Apr 25 2017 04:43
@revisualize quite a bit to digest. But i'll just read through your examples. Cheers
Joseph
@revisualize
Apr 25 2017 04:45
@BrandenDaniel If you have questions feel free to ask.
sbechtold13
@sbechtold13
Apr 25 2017 04:45
@revisualize youre still here XD
Joseph
@revisualize
Apr 25 2017 04:45
@sbechtold13 Nope. I'm a ghost.
BOO!
sbechtold13
@sbechtold13
Apr 25 2017 04:45
AHH
oh jeez, so spooky
Branden Ng
@BrandenDaniel
Apr 25 2017 04:48

function nextInLine(arr, item) {
  arr.push();
  arr.shift();

  return arr;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
@revisualize am i in anyway close?
Ogundele Olumide
@Lumexralph
Apr 25 2017 04:49
@BrandenDaniel yes, just missing out 2 actions
Branden Ng
@BrandenDaniel
Apr 25 2017 04:50
@Lumexralph by 2 actions you mean?
Ogundele Olumide
@Lumexralph
Apr 25 2017 04:50
@BrandenDaniel yes
@BrandenDaniel you need to push item into arr, you're not pushing anything
Branden Ng
@BrandenDaniel
Apr 25 2017 04:51

function nextInLine(arr, item) {
  arr.push(item);
  arr.shift();

  return arr;  // Change this line
}

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

// Display Code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6)); // Modify this line to test
console.log("After: " + JSON.stringify(testArr));
is this what you mean?
Jedifan200
@Jedifan200
Apr 25 2017 04:52
Hey I would like to know if I am in anyway close

function reverseString(str) {
var lstr = str.length;
var newstr = [];
for(var a = (lstr-1);a > -1; a--)
{
newstr.push(str[a]);
}
newstr.toString();
return newstr;
}

reverseString("Howdy");

Ogundele Olumide
@Lumexralph
Apr 25 2017 04:52
@BrandenDaniel then when you shift method remember that it removes and return the first element from the array which you either store or return
Joseph
@revisualize
Apr 25 2017 04:53
@BrandenDaniel Yes.
@BrandenDaniel But, you need to return the element removed from the array.
Ogundele Olumide
@Lumexralph
Apr 25 2017 04:54
@Jedifan200 i'll suggest you join than use toString on newStr array but you're close
Branden Ng
@BrandenDaniel
Apr 25 2017 04:54
@revisualize so return item?

function nextInLine(arr, item) {
  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));
got 2 checks, 2 more to go
or 2 ticks rather
Jedifan200
@Jedifan200
Apr 25 2017 04:55
@Lumexralph yes but that doesn't work either it still keeps it in its array
Ogundele Olumide
@Lumexralph
Apr 25 2017 04:56
@Jedifan200 remember that you need to store or return the joined array
@Jedifan200 look at this return newstr.join("");
@BrandenDaniel not item but the element removed by shift
Jedifan200
@Jedifan200
Apr 25 2017 04:57

function reverseString(str) {
var lstr = str.length;
var newstr = [];
for(var a = (lstr-1);a > -1; a--)
{
newstr.push(str[a]);
}

return newstr.join("");
}

reverseString("Howdy");

that doesn't work
Ogundele Olumide
@Lumexralph
Apr 25 2017 04:58
@Jedifan200 did that give you what you wanted?
@Jedifan200 what doesn't work?
Jedifan200
@Jedifan200
Apr 25 2017 05:00
It should return ydwoH but it returns it in array form
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:01
@Jedifan200 when you join an array is gives a string, so I don't understand what you mean
@Jedifan200
function reverseString(str) {
var lstr = str.length;
var newstr = [];
for(var a = (lstr-1);a > -1; a--)
{
newstr.push(str[a]);
}
return newstr.join("");   // 'ydwoH'

}
reverseString("Howdy");
Joseph
@revisualize
Apr 25 2017 05:02
@BrandenDaniel What is item?
Jedifan200
@Jedifan200
Apr 25 2017 05:03
Oh wait nvm maybe the world just hates me today
I reloaded the page and it works
Joseph
@revisualize
Apr 25 2017 05:03
@BrandenDaniel The shift() method removes the first element from an array and returns that element.
Branden Ng
@BrandenDaniel
Apr 25 2017 05:03
@revisualize im not sure how to return the element removed
@revisualize return shift()? lol
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:05
@BrandenDaniel what is shift acting on?
Jedifan200
@Jedifan200
Apr 25 2017 05:05
Thanks @Lumexralph
CamperBot
@camperbot
Apr 25 2017 05:05
jedifan200 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1571 | @lumexralph |http://www.freecodecamp.com/lumexralph
Branden Ng
@BrandenDaniel
Apr 25 2017 05:05
it removes the first element
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:06
@BrandenDaniel you're very close...... remember that shift is an array method...... it's not a static function
Joseph
@revisualize
Apr 25 2017 05:06
@BrandenDaniel It also returns the element removed.
MoniqueNoche
@MoniqueNoche
Apr 25 2017 05:06

what's wrong here? // Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;

var playerNumber= testObj[player];
var player = testObj[16];

Ogundele Olumide
@Lumexralph
Apr 25 2017 05:06
@Jedifan200 :+1:
Joseph
@revisualize
Apr 25 2017 05:06
@MoniqueNoche playerNumber should just be a number.
MoniqueNoche
@MoniqueNoche
Apr 25 2017 05:06
@revisualize how?
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:06
@MoniqueNoche what property name in the object testObj has the value Montana ?
Branden Ng
@BrandenDaniel
Apr 25 2017 05:07
@Lumexralph @revisualize so what exactly do i return..
Joseph
@revisualize
Apr 25 2017 05:07
@MoniqueNoche playerNumber = 16;
@BrandenDaniel Return the arr.shift()
MoniqueNoche
@MoniqueNoche
Apr 25 2017 05:07

var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;

var playerNumber= 16;
var player = testObj[16];

still wrong
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:07
@BrandenDaniel just put the arr there with the initial return shift(); you wrote
Joseph
@revisualize
Apr 25 2017 05:07
@MoniqueNoche Variables hold values.
The variable playerNumber is currently holding the value 16.
You can use that variable (playerNumber) when referencing that value (of 16 in this case).
Instead of doing: var player = testObj[16]; // Change this Line ... You can use the variable playerNumber to reference the value that the variable playerNumber holds instead of hard coding the value 16 in: testObj[16];
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:08
@MoniqueNoche how do you use a variable to access an object?
Branden Ng
@BrandenDaniel
Apr 25 2017 05:08
@Lumexralph @revisualize like this?

function nextInLine(arr, item) {
  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
Apr 25 2017 05:08
@Lumexralph That's actually what this lesson is teaching.
Pagnito
@Pagnito
Apr 25 2017 05:08
stuck at sorted union
Joseph
@revisualize
Apr 25 2017 05:08
@BrandenDaniel Now you are .shift()ing twice.
@BrandenDaniel So, now you're removing two elements.
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:09
@BrandenDaniel you're shifting twice
Branden Ng
@BrandenDaniel
Apr 25 2017 05:09
@revisualize @Lumexralph i got it.... finally.......
sbechtold13
@sbechtold13
Apr 25 2017 05:09
is convertToF supposed to be a variable?
MoniqueNoche
@MoniqueNoche
Apr 25 2017 05:09

var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};

// Only change code below this line;

var playerNumber;
var player = testObj[16];

Branden Ng
@BrandenDaniel
Apr 25 2017 05:09
@Lumexralph @revisualize thank you both so much lol sorry for wasting your time
CamperBot
@camperbot
Apr 25 2017 05:09
brandendaniel sends brownie points to @lumexralph and @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 1572 | @lumexralph |http://www.freecodecamp.com/lumexralph
:star2: 3829 | @revisualize |http://www.freecodecamp.com/revisualize
sbechtold13
@sbechtold13
Apr 25 2017 05:09
convertToF(-30) should return a value of -22
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:10
@MoniqueNoche you need to use the playerNumber variable to access the value Montana from the object testObj
MoniqueNoche
@MoniqueNoche
Apr 25 2017 05:10
@Lumexralph then how?
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:10
@BrandenDaniel we wanted to help :wink:
@MoniqueNoche var player = testObj[the variable containing the property 16];
@sbechtold13 show your code
sbechtold13
@sbechtold13
Apr 25 2017 05:12

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

var fahrenheit = 9/5+32;

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

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

Ogundele Olumide
@Lumexralph
Apr 25 2017 05:12
@sbechtold13 the formula is celsius * 9/5 + 32
@sbechtold13 you don't need to declare the fahrenheit variable again, it's already been declared
sbechtold13
@sbechtold13
Apr 25 2017 05:13
im not exactly sure what its asking me to do,
says convertToF(-30) should return value of -22
and im just like :hankey:
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:14
@sbechtold13 you need to use the celsius parameter(holding the value you're to convert) with the formula and assign the result to fahrenheit variable
Pagnito
@Pagnito
Apr 25 2017 05:14
anyone help me with sorted union?
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:15
@sbechtold13 :point_up: April 25, 2017 6:12 AM
LeSean Johnson
@leseanbiz
Apr 25 2017 05:15
anybody got any idea how i could close the gap between the 3 bottom wells and the icon?
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:15
@Pagnito what question do you have?
Pagnito
@Pagnito
Apr 25 2017 05:16
@Lumexralph so i have no idea how to check if one array has matching values of other arrays
@Lumexralph would love some hints or point into direction, tho not the answer, cuz thats pretty much the whole challenge lol
Phillip Kelley-Dotson
@pkdotson
Apr 25 2017 05:17

onst sumOfPrimeNums = (arrPrime) => {
let sum = 0;
let primeConfirm = (num)=>{
for (i=2; i<num; i++){
if (num%i ===0){
return false;
}
return true;
}
};

for (i=0; i<arrPrime.length; i++){
  if (primeConfirm(arrPrime[i]) === false){
          sum += arrPrime[i];
  }
}
return sum;

}

Ogundele Olumide
@Lumexralph
Apr 25 2017 05:17
@Pagnito how about you use indexOf ?
Phillip Kelley-Dotson
@pkdotson
Apr 25 2017 05:17
this is giving me an endless loop
any help
trying to find sum of all prime numbers in array
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:17
@pkdotson prime number is number % 2 === 1 even number is number % 2 === 0
Pagnito
@Pagnito
Apr 25 2017 05:18
@Lumexralph but as im looping how do i refer back to the previous array
LeSean Johnson
@leseanbiz
Apr 25 2017 05:18
sorry, wrong chat, just reaized
Markus Kiili
@Masd925
Apr 25 2017 05:19
@Lumexralph Morning.
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:19
@pkdotson if you do this like you have in your code if (num%i ===0) i will change as i increases
@Masd925 Morning Markus :smile:
Phillip Kelley-Dotson
@pkdotson
Apr 25 2017 05:20
thanks @Lumexralph
CamperBot
@camperbot
Apr 25 2017 05:20
pkdotson sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1573 | @lumexralph |http://www.freecodecamp.com/lumexralph
sbechtold13
@sbechtold13
Apr 25 2017 05:20
:| i realize you just told me exactly what to do but im not understanding..ughh, one more time in stupid people terms? :| :| i know im just not reading it correctly or over thinking it.
do i physically have to do the math
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:21
@sbechtold13 fahrenheit = celsius * 9/5 + 32;
sbechtold13
@sbechtold13
Apr 25 2017 05:21
,,,
i definitely over thought that one.
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:22
@Pagnito i really don't know what you have in your code and exactly trying to do
sbechtold13
@sbechtold13
Apr 25 2017 05:22
for some reason i thought i had to code each individually,
thanks @Lumexralph i appreciate it.
CamperBot
@camperbot
Apr 25 2017 05:22
sbechtold13 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1574 | @lumexralph |http://www.freecodecamp.com/lumexralph
Pagnito
@Pagnito
Apr 25 2017 05:22
@Lumexralph
function uniteUnique(arr) {

for( var i =0; i<arguments.length; i++){
  arguments[i].filter(function(item){

  });
}


}

uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]);
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:23
@Pagnito you should have an array with unique values right?
Pagnito
@Pagnito
Apr 25 2017 05:24
@Lumexralph ya
devpaaji
@devpaaji
Apr 25 2017 05:24
@Lumexralph hello mate
how are you
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:25
@Pagnito i'll suggest you concatenate the all the arguments element into an array
@devpaaji Hey Bro! good morning
Peter Kay
@deuscode
Apr 25 2017 05:25
Hey campers, got a strange issue that just recently started happening. Getting a MIME mismatch on my random quote generator. It was working last time I checked a week ago. http://kaypeter.com/rqg
any ideas?
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:25
@Pagnito and you need to convert arguments into a real array
Pagnito
@Pagnito
Apr 25 2017 05:25
@Lumexralph yea i was gonna do that, but the trick is, u never know how many arguments will be passed
rugano
@rugano
Apr 25 2017 05:26
var Bike = function(){

//Only change code below this line.
//this is  private variable

var gear = 4;

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

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

var myCar = new Car();
myCar.getSpeed();

var myBike = new Bike();
myBike.getGear();
what is wrong with this code?
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:27
@Pagnito i'll suggest you use reduce but you have to convert arguments array-like object to a true/ real array first
Vamp
@the-vampiire
Apr 25 2017 05:27
@rugano quite a bit
Pagnito
@Pagnito
Apr 25 2017 05:27
@Lumexralph but reduce, turns it all into one value, how would that b used
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:27
@rugano getGear method should return gear , setGear method should take a parameter which is assigned to gear, not added bu assigned
Vamp
@the-vampiire
Apr 25 2017 05:28
@rugano what are you trying to do? I can’t correct your code without knowing the goal
alpox
@alpox
Apr 25 2017 05:28
@Pagnito one value can also be an an array of values
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:28
@Pagnito then you can use Set
alpox
@alpox
Apr 25 2017 05:29
@Pagnito but you dont necessarily have to use reduce. Do it the way you feel comfortable for now except you are up for explorations - reduce is mighty
Markus Kiili
@Masd925
Apr 25 2017 05:29
@Pagnito Concating all the passed arrays and using filter is a fine way too.
Pagnito
@Pagnito
Apr 25 2017 05:30
@Masd925 but how would i concat them if i dont know how many arguments are passed
@deuscode without seeing your code you can’t be helped, but stackoverflow is great for looking up error codes
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:30
@Pagnito you don't need to worry about that arguments object will do that for you
alpox
@alpox
Apr 25 2017 05:30
@Pagnito you do know. There is a length property on the arguments object
Pagnito
@Pagnito
Apr 25 2017 05:30
@alpox i kinda wanna use reduce cuz its provided in the helpful links, but i dont know how to use it here, as far as i know it reduced an array to one value, but i need an arry of values
Markus Kiili
@Masd925
Apr 25 2017 05:31
@Pagnito You could use a loop or do Array.prototype.concat.apply([],arguments)
That concats all the passed arrays.
Pagnito
@Pagnito
Apr 25 2017 05:32
hmm, nice @Masd925 thanks, i might use that, ima def remember this method, tho i wanna find a way to use reduce for now
CamperBot
@camperbot
Apr 25 2017 05:32
pagnito sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 3922 | @masd925 |http://www.freecodecamp.com/masd925
Peter Kay
@deuscode
Apr 25 2017 05:32
@the-vampiire ahh I was looking at that earlier, but do not think that applied to me
@the-vampiire function getNewQuote() {
$.ajax({
url: 'http://api.forismatic.com/api/1.0/',
jsonp: 'jsonp',
dataType: 'jsonp',
data: {
method: 'getQuote',
lang: 'en',
format: 'jsonp'
},
success: function(response) {
quote = response.quoteText;
author = response.quoteAuthor;
$('#quote').text(quote);
if (author) {
$('#author').text(author);
} else {
$('#author').text('Unknown');
}
}
});
}
oops
Pagnito
@Pagnito
Apr 25 2017 05:33
so can i get soe more hints on using reduce for this
i dont understand how reduce can be used for this, since in my head reduce will return a single value
Peter Kay
@deuscode
Apr 25 2017 05:33
'''
function getNewQuote() {
$.ajax({
url: 'http://api.forismatic.com/api/1.0/',
jsonp: 'jsonp',
dataType: 'jsonp',
data: {
method: 'getQuote',
lang: 'en',
format: 'jsonp'
},
success: function(response) {
quote = response.quoteText;
author = response.quoteAuthor;
$('#quote').text(quote);
if (author) {
$('#author').text(author);
} else {
$('#author').text('Unknown');
}
}
});
}
'''
CamperBot
@camperbot
Apr 25 2017 05:33
:bulb: to format code use backticks! ``` more info
Markus Kiili
@Masd925
Apr 25 2017 05:34
@Pagnito You can first turn arguments object into a real array and then use reduce on it:
var args = [];
for (var i = 0; i < arguments.length; i++) args.push(arguments[i]);
Peter Kay
@deuscode
Apr 25 2017 05:34
    function getNewQuote() {
        $.ajax({
            url: 'http://api.forismatic.com/api/1.0/',
            jsonp: 'jsonp',
            dataType: 'jsonp',
            data: {
                method: 'getQuote',
                lang: 'en',
                format: 'jsonp'
            },
            success: function(response) {
                quote = response.quoteText;
                author = response.quoteAuthor;
                $('#quote').text(quote);
                if (author) {
                    $('#author').text(author);
                } else {
                    $('#author').text('Unknown');
                }
            }
        });
     }
@the-vampiire sorry about that here's the code
rugano
@rugano
Apr 25 2017 05:35
So what method should come first,setGear or getGear?
Peter Nguyen
@iampeternguyen
Apr 25 2017 05:35
can someone tell me why my reduce function returns 335.409999999997 instead of 335.41. I don't get where all the decimals are coming from?
//FCC Exact Change https://www.freecodecamp.com/challenges/exact-change
function checkCashRegister(price, cash, cid) {
  var change;
  // Here is your change, ma'am.
function totalCID (x){
  var sum =[];
  for (i = 0; i <x.length;i++){
    sum.push(x[i][1]);

  }
  return sum.reduce( (prev, curr) => prev + curr );
}

  console.log(totalCID(cid));


}

// Example cash-in-drawer array:
// [["PENNY", 1.01],
// ["NICKEL", 2.05],
// ["DIME", 3.10],
// ["QUARTER", 4.25],
// ["ONE", 90.00],
// ["FIVE", 55.00],
// ["TEN", 20.00],
// ["TWENTY", 60.00],
// ["ONE HUNDRED", 100.00]]

checkCashRegister(19.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);
Markus Kiili
@Masd925
Apr 25 2017 05:36
@Pagnito ES6 javascript also has simpler ways for transforming it.
@iampeternguyen JS numbers are floats, so only small enough integers are guaranteed to be exact.
Vamp
@the-vampiire
Apr 25 2017 05:38
@deuscode and what was the code looking like that was functioning?
Peter Kay
@deuscode
Apr 25 2017 05:39
it was looking exactly like that, which was very odd @the-vampiire
Peter Nguyen
@iampeternguyen
Apr 25 2017 05:39
time to look up what that means but thanks for the help @Masd925 =D
CamperBot
@camperbot
Apr 25 2017 05:39
iampeternguyen sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 3923 | @masd925 |http://www.freecodecamp.com/masd925
Vamp
@the-vampiire
Apr 25 2017 05:39
@deuscode you had to have changed something man
Peter Kay
@deuscode
Apr 25 2017 05:39
I've been searching for the past hour to see what the issue was, but funny thing is, it works fine on safari on my iphone @the-vampiire
I haven't touched this project since last week, and it was working fine then
Vamp
@the-vampiire
Apr 25 2017 05:41
@deuscode why are you using jsonp?
@deuscode you may have had it functioning fine in safari but chrome does not allow it which is why you are seeing the issue now?
Peter Kay
@deuscode
Apr 25 2017 05:41
before it went live and submitted
@the-vampiire I tested it all on firefox, chrome, IE and all was working fine
alpox
@alpox
Apr 25 2017 05:42
Chrome does not allow jsonp? That would be new to me...
It always supported jsonp
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:42
me too
Peter Kay
@deuscode
Apr 25 2017 05:43
@the-vampiire I get an access control origin error on this API so I used jsonp
Vamp
@the-vampiire
Apr 25 2017 05:44
no chrome allows it, I am saying the way he has written his request is not being passed by chrome
Peter Kay
@deuscode
Apr 25 2017 05:45
I had cross-domain restrictions imposed on this API, so jsonp was working fine until I started getting this MIME mismatch error all of a sudden
works fine on mobile
Jedifan200
@Jedifan200
Apr 25 2017 05:45
How do I get my code to ignore "special symbols" - palindrome challenge
Markus Kiili
@Masd925
Apr 25 2017 05:46
@Jedifan200 Most people use replace method and suitable regexp object.
Vamp
@the-vampiire
Apr 25 2017 05:46
@deuscode you can try using https in the request and ditch the jsonp or you can try changing data.format to json
try the latter see if it works
Peter Kay
@deuscode
Apr 25 2017 05:46
@the-vampiire sad thing about the forismatic API is that it does not support https
Vamp
@the-vampiire
Apr 25 2017 05:47
@Jedifan200 www.regex101.com will help you build your regex for that challenge. or you can use a switch case if you want to do it the long way
Peter Kay
@deuscode
Apr 25 2017 05:47
@the-vampiire I've tried switching it to json to isolate it, but I get the access control error restriction imposed by the browser
I'm stumped lol
help me
Vamp
@the-vampiire
Apr 25 2017 05:48
@deuscode hang on
 function getNewQuote() {
        $.ajax({
            url: 'http://api.forismatic.com/api/1.0/',
            jsonp: 'jsonp’, // not this
            dataType: 'jsonp’, // not this
            data: {
                method: 'getQuote',
                lang: 'en',
                format: ‘jsonp’ // switch this to json
            },
            success: function(response) {
                quote = response.quoteText;
                author = response.quoteAuthor;
                $('#quote').text(quote);
                if (author) {
                    $('#author').text(author);
                } else {
                    $('#author').text('Unknown');
                }
            }
        });
     }
is that waht you already did?
Peter Kay
@deuscode
Apr 25 2017 05:49
I
@the-vampiire I've tried both that and changing the datatype and format to json
Vamp
@the-vampiire
Apr 25 2017 05:49
did you respond in binary..
lol
Peter Kay
@deuscode
Apr 25 2017 05:49
LOL
I've obviously been on a console for way too long
So weird thing here is
Vamp
@the-vampiire
Apr 25 2017 05:50
did you try removing jsonp: jsonp
Peter Kay
@deuscode
Apr 25 2017 05:50
when I change the jsonp to json I get a syntax error
Vamp
@the-vampiire
Apr 25 2017 05:51
as far as I know you only need to put datatype: jsonp
Peter Kay
@deuscode
Apr 25 2017 05:51
saying ; is missing before a statement
I wouldn't need a callback for the jsonp?
Vamp
@the-vampiire
Apr 25 2017 05:51
 function getNewQuote() {
        $.ajax({
            url: 'http://api.forismatic.com/api/1.0/',
            dataType: 'jsonp',
            data: {
                method: 'getQuote',
                lang: 'en',
                format: ‘jsonp’ // try as is then try with json here 
            },
            success: function(response) {
                quote = response.quoteText;
                author = response.quoteAuthor;
                $('#quote').text(quote);
                if (author) {
                    $('#author').text(author);
                } else {
                    $('#author').text('Unknown');
                }
            }
        });
     }
rks972131
@rks972131
Apr 25 2017 05:52
var myStr = "This is the first sentence.";
myStr += "This is the second sentence.";
Vamp
@the-vampiire
Apr 25 2017 05:52
@deuscode idk man im just giving suggestions based on my wikifinder project. i had to use jsonp there and I didnt write it the way you have it
rks972131
@rks972131
Apr 25 2017 05:52
requirement:-myStr should have a value of This is the first sentence. This is the second sentence.
Any one is there helpme
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:52
@rks972131 you're missing space
Vamp
@the-vampiire
Apr 25 2017 05:52
Screen Shot 2017-04-25 at 1.52.22 AM.png
Nasson Soneka
@NASSONSONEKA
Apr 25 2017 05:53
Hi guys, I just started JavaScript tutorials and am stuck on the assignment of the = to a and b, Ineed help.
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:53
@rks972131 either you add a space to the end of first sentence or beginning of second sentence
rks972131
@rks972131
Apr 25 2017 05:53
@Lumexralph thanks a lot
CamperBot
@camperbot
Apr 25 2017 05:53
rks972131 sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1575 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:53
@NASSONSONEKA assign 7 to a, then assign a to b
@rks972131 :+1:
Peter Kay
@deuscode
Apr 25 2017 05:54
@the-vampiire are you getting a MIME mismatch error when you go to my website?
Nasson Soneka
@NASSONSONEKA
Apr 25 2017 05:54
@Lumexralph thanks, let me try that
CamperBot
@camperbot
Apr 25 2017 05:54
nassonsoneka sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1576 | @lumexralph |http://www.freecodecamp.com/lumexralph
Vamp
@the-vampiire
Apr 25 2017 05:54
@deuscode ya
did you try my suggestion
Peter Kay
@deuscode
Apr 25 2017 05:54
I did
no go
Vamp
@the-vampiire
Apr 25 2017 05:54
also there is this I came across, but I ended up using jsonp
Jedifan200
@Jedifan200
Apr 25 2017 05:55
@Masd925 how would I get rid of multiple things
Vamp
@the-vampiire
Apr 25 2017 05:56
it says the MIME type “text/html” is not executable. I think this needs to be “application/javascript”
no idea how to change that though
Peter Kay
@deuscode
Apr 25 2017 05:57
yeah I read that too... wasn't sure about that, I'll search around for that, Thanks @the-vampiire mucho appreciated for all the effort
CamperBot
@camperbot
Apr 25 2017 05:57
deuscode sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:cookie: 308 | @the-vampiire |http://www.freecodecamp.com/the-vampiire
Markus Kiili
@Masd925
Apr 25 2017 05:57
@Jedifan200 Regexp has a global modifier /g
Vamp
@the-vampiire
Apr 25 2017 05:57
meh I didnt do anything save the thanks for when it’s solved!
Peter Kay
@deuscode
Apr 25 2017 05:58
@the-vampiire just found an article that text/javascript has been deprecated
Alyx
@Krimnsomb
Apr 25 2017 05:58
help. tried writing "if" statements but it didn't work...
Peter Kay
@deuscode
Apr 25 2017 05:58
just recently
Alyx
@Krimnsomb
Apr 25 2017 05:58

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

// Only change code above this line

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

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

Peter Kay
@deuscode
Apr 25 2017 05:58
that could be the reason why it just stopped working all of a sudden
text/javascript (Obsolete): JavaScript; Defined in and made obsolete in RFC 4329 in order to discourage its usage in favor of application/javascript. However, text/javascript is allowed in HTML 4 and 5 and, unlike application/javascript, has cross-browser support. The "type" attribute of the tag in HTML5 is optional and there is no need to use it at all since all browsers have always assumed the correct default (even in HTML 4 where it was required by the specification).
@the-vampiire
Markus Kiili
@Masd925
Apr 25 2017 05:59
@Krimnsomb If will work. Show what you tried.
Ogundele Olumide
@Lumexralph
Apr 25 2017 05:59
@Krimnsomb how did you write it?
@Masd925 what's happening today?
Vamp
@the-vampiire
Apr 25 2017 05:59
@deuscode fwiw codepen gives me this...
Ogundele Olumide
@Lumexralph
Apr 25 2017 06:00
@Masd925 i didn't show you my pong game
Vamp
@the-vampiire
Apr 25 2017 06:00
Screen Shot 2017-04-25 at 1.59.34 AM.png
Markus Kiili
@Masd925
Apr 25 2017 06:00
@Lumexralph Work mostly. No you didn't.
Alyx
@Krimnsomb
Apr 25 2017 06:00
i added "if (a < 0 || b < 0) {return "undefined";}"
Ogundele Olumide
@Lumexralph
Apr 25 2017 06:00
@Masd925 mind if you take a look?
@Krimnsomb string?
Markus Kiili
@Masd925
Apr 25 2017 06:00
@Krimnsomb undefined is a special value of type Undefined and "undefined" is a string.
Ogundele Olumide
@Lumexralph
Apr 25 2017 06:01
Alyx
@Krimnsomb
Apr 25 2017 06:02
right. that's where i'm stuck. i can't use "undefined" as a string but i don't get how to set a constraint on the "a" and "b" val
thanks for the help btw =)
did i set the "if" statement up right and screwed the "return" or what?
Markus Kiili
@Masd925
Apr 25 2017 06:05
@Lumexralph Nice. Lags a bit at start. Do you know why?
Ogundele Olumide
@Lumexralph
Apr 25 2017 06:06
@Masd925 i noticed too, suspecting the draw handler but not sure
devpaaji
@devpaaji
Apr 25 2017 06:07
@Masd925 morning
how are you
@Lumexralph you had breakfast
or early morning
Jedifan200
@Jedifan200
Apr 25 2017 06:08
str = str.replace(/g);
Ogundele Olumide
@Lumexralph
Apr 25 2017 06:08
@devpaaji nope just a coffee sweet
Markus Kiili
@Masd925
Apr 25 2017 06:08
@devpaaji Morning.
Ogundele Olumide
@Lumexralph
Apr 25 2017 06:08
lol
@Masd925 you have idea why?
Markus Kiili
@Masd925
Apr 25 2017 06:09
@Lumexralph What techniques did you use. Simplegui is some python library?
Jedifan200
@Jedifan200
Apr 25 2017 06:09
this won't get rid of the special characters
Ogundele Olumide
@Lumexralph
Apr 25 2017 06:10
@Masd925 yes a graphic library created by one of the Professors of the course
devpaaji
@devpaaji
Apr 25 2017 06:10
@Lumexralph from where you learning Py
rugano
@rugano
Apr 25 2017 06:10
var Bike = function(){

//Only change code below this line
//this is a private variable
var gear = 5;

//these are public methods
this.setGear = function(){
gear = 3;
};

this.getGear = function(){
gear = 4;

return gear;
};
};
var myCar = new Car();
myCar.getSpeed();

var myBike = new Bike();
myBike.setGear();
myBike.getGear();
Vamp
@the-vampiire
Apr 25 2017 06:10
@Jedifan200 that is not a valid regex expression...
rugano
@rugano
Apr 25 2017 06:11
how about this?
Vamp
@the-vampiire
Apr 25 2017 06:11
@Jedifan200 look up regex and use the site I suggested to help you build the expression you want to capture specific characters
Ogundele Olumide
@Lumexralph
Apr 25 2017 06:11
@devpaaji online resources.....presently taking a course on Coursera
devpaaji
@devpaaji
Apr 25 2017 06:12
ohk
Ogundele Olumide
@Lumexralph
Apr 25 2017 06:12
@rugano getGear method should return gear, setGear method should have a parameter it assigns to gear private/ class variable
Jedifan200
@Jedifan200
Apr 25 2017 06:13
Oh wow I looked at the site and thought what am I supposed to be doing here and then it hit me Thanks @the-vampiire
CamperBot
@camperbot
Apr 25 2017 06:13
:cookie: 309 | @the-vampiire |http://www.freecodecamp.com/the-vampiire