These are chat archives for FreeCodeCamp/HelpJavaScript

23rd
Jun 2017
Dhrumit Thakkar
@Dhrumit14
Jun 23 2017 00:00
Can someone help me ?
Joseph
@revisualize
Jun 23 2017 00:00
@JLuboff 0!!!!!!!!!!!!!
Ateeq Khan
@ez12024
Jun 23 2017 00:02
@revisualize thank you. I thought that at the very end, you needed a statement terminator (;) and didn't know that a bracker was needed
*bracket. Could you use a rounded bracket in terms of final results?
pahosler
@pahosler
Jun 23 2017 00:04
@luccifer00 it doesn't work because val isn't a value that object lookup contains, val is a variable that you assign an object value to, so to access the value of val in the object you have to use lookup[val]
Joseph
@revisualize
Jun 23 2017 00:06
@ez12024 ( ) mean something else in JavaScript.
luccifer00
@luccifer00
Jun 23 2017 00:06
ooookkk.... so many concepts to difference, and the frontier of the language makes me a little bit harder! thanks again for ur answer and ur patient! @pahosler and @revisualize
CamperBot
@camperbot
Jun 23 2017 00:06
luccifer00 sends brownie points to @pahosler and @revisualize :sparkles: :thumbsup: :sparkles:
:warning: luccifer00 already gave pahosler points
:star2: 4228 | @revisualize |http://www.freecodecamp.com/revisualize
mauriciodeleonc
@mauriciodeleonc
Jun 23 2017 00:23
hi, im supposed to 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.

function nextInLine(arr, item) {

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

Steven Nyeo
@limpingstone
Jun 23 2017 00:24
if (before[0]==[A-Z]) {
      after = after.split("");
      after[0] = after[0].toUpperCase;

      after = after.join("");
    }
How do you express you want to identify capitalized letters?
It says reference error
mauriciodeleonc
@mauriciodeleonc
Jun 23 2017 00:24
i have that but i dont know what im supposed to do tbh
Curtis
@CurtisJCamp
Jun 23 2017 00:25
Hey can somebody tell me why this code isn't logging anything in my console on codepen?
var newQuote = new XMLHttpRequest();
newQuote.open('GET', 'http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1');
newQuote.onload = function() {
  console.log(newQuote.responseText);
};
newQuote.send();
Dhrumit Thakkar
@Dhrumit14
Jun 23 2017 00:25

$(document).ready(function() {
var WikiData = "";

$.support.cors = true;
$("#WikiMe").on("click", function() {
    var SearchValue = $("#SearchMe").val();

    console.log(SearchValue);


    var GETWIKISEARCH = 'https://en.wikipedia.org/w/api.php?action=query&format=json&gsrlimit=15&generator=search&origin=*&gsrsearch=' + SearchValue;
    $.getJSON(GETWIKISEARCH).done(function(wiki) {



        console.log(wiki);
        var temp = wiki.query.pages[57570];
        console.log(temp);
        for (var i = 0; i < wiki.query.pages.length; i++) {
            WikiData = wiki.query.pages[i].title;
            console.log(WikiData);
        }

    })



})

})

can any one help ? why console.log(WikiData) undefined ?
Manish Giri
@Manish-Giri
Jun 23 2017 00:26
check the structure of wiki
maybe what you're trying to access isn't there
@Dhrumit14
Arontbt
@Arontbt
Jun 23 2017 00:27

This is my solution to the "Truncate a String" problem. Anybody know why its not working?

function truncateString(str, num) {
// Clear out that junk in your trunk
if (str > num) {
return str.slice(num - 3) + "...";
}
else if (num <= 3) {
return str.slice(num) + "...";
}
else {
return str;
}

}

Dhrumit Thakkar
@Dhrumit14
Jun 23 2017 00:28
@Manish-Giri
wiki.png
Arontbt
@Arontbt
Jun 23 2017 00:29
Btw @JLuboff Thanks for the hint on yesterday's problem. I managed to pass the problem by returning after the loop
CamperBot
@camperbot
Jun 23 2017 00:29
arontbt sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 1975 | @jluboff |http://www.freecodecamp.com/jluboff
Manish Giri
@Manish-Giri
Jun 23 2017 00:29
@Dhrumit14 pages is an object.
you're using it as an array instead
i < wiki.query.pages.length
Dhrumit Thakkar
@Dhrumit14
Jun 23 2017 00:39
@Manish-Giri What should i use instead of that condition ?
Manish Giri
@Manish-Giri
Jun 23 2017 00:39
@Dhrumit14 for..in
to iterate thru objects
scarejar
@scarejar
Jun 23 2017 00:41

Can a method that sits on the prototype also have a prototype?

let human = {

};

human.prototype.someMethod.prototype.name = "example" ;

cause I'm getting errors when I look for the name property on "someMethod"

which, you would think it would look at the prototype
Dhrumit Thakkar
@Dhrumit14
Jun 23 2017 00:43
@Manish-Giri ?
scarejar
@scarejar
Jun 23 2017 00:45
also can a method be used as a contructor to a function?
Dhrumit Thakkar
@Dhrumit14
Jun 23 2017 00:45
oh okay
thanks @Manish-Giri
CamperBot
@camperbot
Jun 23 2017 00:45
dhrumit14 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6089 | @manish-giri |http://www.freecodecamp.com/manish-giri
Csaba Balogh
@JasonCorp84
Jun 23 2017 00:45
roman numeral converter...
o.O
Sunny Bakshi
@Sunnybakshi
Jun 23 2017 00:48
hey guys just a quick option......how could i get a job in the field?
question
sry
aRtoo
@artoodeeto
Jun 23 2017 00:50
hello. question how can i center the bubble speech? i just took the css code from the net. help please.
heres the code pen:
https://codepen.io/artoo/pen/owwKzW
Csaba Balogh
@JasonCorp84
Jun 23 2017 00:52
@artoodeeto
this is how :D
aRtoo
@artoodeeto
Jun 23 2017 00:53
@JasonCorp84 what did you change bro??
Csaba Balogh
@JasonCorp84
Jun 23 2017 00:53
use <center></center> around the elements that you want to center
aRtoo
@artoodeeto
Jun 23 2017 00:54
@JasonCorp84 thanks bro
CamperBot
@camperbot
Jun 23 2017 00:54
artoodeeto sends brownie points to @jasoncorp84 :sparkles: :thumbsup: :sparkles:
:cookie: 276 | @jasoncorp84 |http://www.freecodecamp.com/jasoncorp84
Daniel Narilton
@spaganger
Jun 23 2017 00:56
how can I pass arrays into functions in javascript
Dhrumit Thakkar
@Dhrumit14
Jun 23 2017 01:01
@Manish-Giri It worked
thanks again :)
Manish Giri
@Manish-Giri
Jun 23 2017 01:02
:+1:
@Vigariuoluvi just like any regular variable
Joseph
@revisualize
Jun 23 2017 01:08
Boom. I'm home.
Vanessa Ating
@missating
Jun 23 2017 01:09

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 7:
case 8:
case 9:

count = count;
break;


case 10:
case 'J':
case 'Q':
case 'K':
case 'A':

count++;
break;

}

if (count <= 0){
return "\"" + count + " Bet\"";

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

// Only change code above this line
}

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

Joseph
@revisualize
Jun 23 2017 01:09
It's fucking hot as hell here.
FedeGA93
@FedeGA93
Jun 23 2017 01:09
Hey i have a trouble with my code in the exercise 13
this is my Code
Joseph
@revisualize
Jun 23 2017 01:09
@missating Why are you escaping quotes in your return statement?
FedeGA93
@FedeGA93
Jun 23 2017 01:09
var myStr="Firstline\nSecondLine\\rThirdline\"
Joseph
@revisualize
Jun 23 2017 01:10
@FedeGA93 You have lowercase L's when they should be L's
Vanessa Ating
@missating
Jun 23 2017 01:10
please i need help with my code
FedeGA93
@FedeGA93
Jun 23 2017 01:10
Thanks, didnt notice that
Joseph
@revisualize
Jun 23 2017 01:10
@FedeGA93 You're not escaping the backslash before SecondLine.
@FedeGA93 You're escaping a backslash after ThirdLine that doesn't need to be there.
Vanessa Ating
@missating
Jun 23 2017 01:11
@revisualize that is the expected ouput
Joseph
@revisualize
Jun 23 2017 01:11
@missating No it isn't.
@missating Don't escape the quotes. Just return a string.
Vanessa Ating
@missating
Jun 23 2017 01:11
okay
Joseph
@revisualize
Jun 23 2017 01:12
@missating If that doesn't solve the challenge show me your if/else block again.
Vanessa Ating
@missating
Jun 23 2017 01:14
@revisualize it didn'work

if (count <= 0){
return count + " Bet";

} else {
return count + " Hold";
}

Joseph
@revisualize
Jun 23 2017 01:16
@missating is the <= correct?
@missating You're using <= when you shouldn't be.
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.
Vanessa Ating
@missating
Jun 23 2017 01:18
its suppose to return negative and the bet string when count is equal to zero or negative
@revisualize
Joseph
@revisualize
Jun 23 2017 01:19
@missating But, < is less than. You're saying if count is less than/equal to 0 ... return Bet.
Vanessa Ating
@missating
Jun 23 2017 01:19
ohhhh
its now greater than still didn't solve it
@revisualize
Joseph
@revisualize
Jun 23 2017 01:20
@missating Do you still have the =?
Vanessa Ating
@missating
Jun 23 2017 01:20
no @revisualize
Joseph
@revisualize
Jun 23 2017 01:20
Show me.
Vanessa Ating
@missating
Jun 23 2017 01:21

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

} else {
return count + " Hold";
}

Joseph
@revisualize
Jun 23 2017 01:21
@missating Hmmm.
Okay, Can you post all of your code?
Vanessa Ating
@missating
Jun 23 2017 01:24

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 7:
case 8:
case 9:

count = count;
break;


case 10:
case 'J':
case 'Q':
case 'K':
case 'A':

count++;
break;

}

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

} else {
return count + " Hold";
}

// Only change code above this line
}

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

Joseph
@revisualize
Jun 23 2017 01:24
@missating H!
Why are you count++ two places?
Vanessa Ating
@missating
Jun 23 2017 01:24
Its incrementing
count is set to 0
0 + 1
Joseph
@revisualize
Jun 23 2017 01:24
@missating For 2 through 6 an for 10 -> A?
It's supposed to ++?
Vanessa Ating
@missating
Jun 23 2017 01:25
from 10 should be --
silly mistake
Joseph
@revisualize
Jun 23 2017 01:25
That should solve it.
Vanessa Ating
@missating
Jun 23 2017 01:25
wow thank you
i have been staring at it all day
Muhammad Hasham
@MohammadHasham
Jun 23 2017 01:35
am i doing it right?
var location = 'https://ip-api.com/json';
fetch(location).then(function(x){
   x.json().then(function(y){
      console.log(y);
   });
   });
@revisualize
Joseph
@revisualize
Jun 23 2017 01:35
No idea.
LinoliuMKnifE
@LinoliuMKnifE
Jun 23 2017 01:35
So I need help with the celsius to fahrenheit algorithm. I have no clue where to begin but I've been over the previous lessons 3 times now.
It's just not clicking
Manish Giri
@Manish-Giri
Jun 23 2017 01:39
@LinoliuMKnifE you need to use the celsius variable
apply the formula to it
Hassan McCutchen
@hmccutchen
Jun 23 2017 01:39
I'm having some trouble understanding the javascript Stand In Line challenge..."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."
Manish Giri
@Manish-Giri
Jun 23 2017 01:39
and store the result in fahrenheit
that's all
Hassan McCutchen
@hmccutchen
Jun 23 2017 01:39

```function nextInLine([arr], item) {
// Your code here
nextInLine([6]);
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)); ```

LinoliuMKnifE
@LinoliuMKnifE
Jun 23 2017 01:39
okay I'll try that thanks
Hassan McCutchen
@hmccutchen
Jun 23 2017 01:43
function nextInLine([arr], item) {
  // Your code here
  nextInLine([6]);
  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));
LinoliuMKnifE
@LinoliuMKnifE
Jun 23 2017 01:43
Im still stumped here it's just not making sense to me
celsius = 9/5 + 32;
is that not correct??
/collapse-all
Ahmed Ramy
@Shadilix
Jun 23 2017 01:51
function caseInSwitch(val) {
  var answer = "";
  // Only change code below this line
  switch (val)
    {
      case val === 1:
        answer ="alpha";
        break;
      case val === 2:
        answer ="beta";
        break;
      case val === 3:
        answer ="gamma";
        break;
      case val === 4:
        answer ="delta";
        break;

    }


  // Only change code above this line  
  return answer;  
}
is there is something missing in this code here ?
Joseph
@revisualize
Jun 23 2017 01:52
@Shadilix Yes.
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 01:52
Yes.
Joseph
@revisualize
Jun 23 2017 01:53
@Shadilix Remove all of the val ===
Ahmed Ramy
@Shadilix
Jun 23 2017 01:53
Okai , what is it ??? :D
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 01:53
You have too many vals
Ahmed Ramy
@Shadilix
Jun 23 2017 01:54
bam
solved , thanks @revisualize and @baseballpoetess
CamperBot
@camperbot
Jun 23 2017 01:54
shadilix sends brownie points to @revisualize and @baseballpoetess :sparkles: :thumbsup: :sparkles:
:cookie: 640 | @baseballpoetess |http://www.freecodecamp.com/baseballpoetess
:star2: 4229 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
Jun 23 2017 01:54
@Shadilix The val === is what switch does.
Hassan McCutchen
@hmccutchen
Jun 23 2017 01:54
thanks @revisualize
CamperBot
@camperbot
Jun 23 2017 01:54
hmccutchen sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4230 | @revisualize |http://www.freecodecamp.com/revisualize
Zack
@zackbiernat
Jun 23 2017 01:55
if (myObj.hasOwnProperty(checkProp)) {
return myObj.checkProp;
}
Joseph
@revisualize
Jun 23 2017 01:55
@Shadilix A switch compares the input value val in this case.. To the case value.
@zackbiernat Dot Notation is converting the value to a string (string literal). Example: myObj.name; is the same as myObj["name"]; and as we all know quotes define strings. If you want to use a variable for accessing the value of object properties you cannot use Dot Notation. You have to use Bracket Notation. Example: var num = 42; myObj[num];
Will Gotsch
@NonchalantPotato
Jun 23 2017 01:56
Can someone help me with a pretty basic error?
Zack
@zackbiernat
Jun 23 2017 01:56
@revisualize thanks!
CamperBot
@camperbot
Jun 23 2017 01:56
zackbiernat sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4231 | @revisualize |http://www.freecodecamp.com/revisualize
Will Gotsch
@NonchalantPotato
Jun 23 2017 01:56
I'm writing if else statements and it says I'm missing a semicolon somewhere
}else(num >= 20){
return "Huge";
}
Joseph
@revisualize
Jun 23 2017 01:57
@NonchalantPotato else's don't have conditions.
Will Gotsch
@NonchalantPotato
Jun 23 2017 01:57
Gotcha
thanks so much! I was super confused
Ateeq Khan
@ez12024
Jun 23 2017 01:58
I'm trying to do profile lookup on javascript
Joseph
@revisualize
Jun 23 2017 01:58
@ez12024 What's the code that you have in your function? (I do not want nor do I need to see the large array of objects.)
Ateeq Khan
@ez12024
Jun 23 2017 01:59
I'm confused re the tasks.
Alex
@alexandrupintilei
Jun 23 2017 01:59
can someone help me?
Joseph
@revisualize
Jun 23 2017 01:59
@ez12024 Have you coded anything for the challenge?
fdemaa
@fdemaa
Jun 23 2017 01:59
@revisualize so i finish the algorithm of the other day that you told me to reset the var after the inner loop, but i dont know if its this possible
Its correct this way?
function largestOfFour(arr) {

var finalArray = [] ;
var comparator = 0;

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

      }
    }
  finalArray.push(comparator);  
   comparator = 0;
    }
    return finalArray;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
sharathki442gmailcom
@sharathki442gmailcom
Jun 23 2017 02:00
@missating Have you solved the Counting Cards challenge
Joseph
@revisualize
Jun 23 2017 02:00
@fdemaa Do you see right before the for for the j loop?
Ateeq Khan
@ez12024
Jun 23 2017 02:01
I don't know how what to do with this? It says only change code in the gap between below and above a line and then change values to test function? I played around with iit, but nothing comes up in test blackbox

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

// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");

Joseph
@revisualize
Jun 23 2017 02:01
@fdemaa Basically, I'm saying put the comparator = 0; between the two lines that you for the fors
@fdemaa But, when I stated that I didn't see the comparator = 0; at the end of your inner for block.
fdemaa
@fdemaa
Jun 23 2017 02:02
@revisualize i get it, i pass the exercise with what i have, but its incorrect right?
Joseph
@revisualize
Jun 23 2017 02:03
@fdemaa If it passes.
@fdemaa How is it incorrect?
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:03
@ez12024 there are 2 places to change stuff the code between the lines and the test case, in the // test your function
Joseph
@revisualize
Jun 23 2017 02:03
@baseballpoetess The problem that they have is that they don't understand the challenge and they don't know where to even start.
fdemaa
@fdemaa
Jun 23 2017 02:03
but i mean the 2 ways its correct, like you told me to put between the two lines and mine,
okey thanks man
Joseph
@revisualize
Jun 23 2017 02:04
@fdemaa There's far more than two ways to solve that challenge.
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:04
You can set the // test part to "Cinderella" to see if it behaves correctely if the name doesn't match when you write your code.
fdemaa
@fdemaa
Jun 23 2017 02:04
cool man, thanks again! @revisualize
CamperBot
@camperbot
Jun 23 2017 02:04
fdemaa sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4232 | @revisualize |http://www.freecodecamp.com/revisualize
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:05
oic
Joseph
@revisualize
Jun 23 2017 02:05
@baseballpoetess I've seen it happen a lot. People don't understand that this final challenge of the Basic JavaScript section is talking ALL of their previous knowledge and slamming it into one challenge.
It's a lot to take in.
At this point there's also a lot to understand from a programming standpoint as well.
Some of which I don't feel that freeCodeCamp coverts too well.
fdemaa
@fdemaa
Jun 23 2017 02:06
@revisualize i discover also the function math.max that will simplify my code ?
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:07
yeah. I usually help with this challenge by saying, what is one thing you want to find out, figure out that one thing, then do the next one.
Joseph
@revisualize
Jun 23 2017 02:07
@baseballpoetess Hence the reason: freeCodeCamp/freeCodeCamp#15388 Exists.
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:07
(the answer is usually, if the name is there)
I'm usually in the main room but they're talking about stuff that I don't really have an interest in so I popped over here.
Ateeq Khan
@ez12024
Jun 23 2017 02:09
@baseballpoetess I get it. I understand the editing between lines. But I how can I change something that is not there? There is no code in between lines.
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:09
you put it there. @ez12024 They expressed it poorly.
those are supposed to be .... borders for where you work.
Ateeq Khan
@ez12024
Jun 23 2017 02:11
@baseballpoetess Thank you. Clarity.
CamperBot
@camperbot
Jun 23 2017 02:11
ez12024 sends brownie points to @baseballpoetess :sparkles: :thumbsup: :sparkles:
:cookie: 641 | @baseballpoetess |http://www.freecodecamp.com/baseballpoetess
Tim Porter
@potato8
Jun 23 2017 02:11
helloooo
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:12
hello @potato8 -- there is a guy who misreads my name as baseballpotatoes
Tim Porter
@potato8
Jun 23 2017 02:12
@baseballpoetess lol
J-Mag Guthrie
@baseballpoetess
Jun 23 2017 02:14
I guess that's fries? Garlic fries maybe?
Joseph
@revisualize
Jun 23 2017 02:15
@baseballpoetess Garlic Fries make me throw up.
Curtis
@CurtisJCamp
Jun 23 2017 02:18
Hey Im having a problem with my js where its giving me a Unexpected token ILLEGAL error. Can somebody take a look at it for me?
Joseph
@revisualize
Jun 23 2017 02:19
@CurtisJCamp Name of the challenge?
@CurtisJCamp What code do you have?
Curtis
@CurtisJCamp
Jun 23 2017 02:20
its the random quote machine
  function getQuote(){
    var quotes = [“We are what we repeatedly do. Excellence, therefore, is not an act but a habit”,  “The best way out is always through”, “Do not wait to strike till the iron is hot; but make it hot by striking”,  “Great spirits have always encountered violent opposition from mediocre minds”, “Whether you think you can or think you cant, youre right”, “I know for sure that what we dwell on is who we become”, “Ive missed more than 9000 shots in my career. Ive lost almost 300 games. 26 times, Ive been trusted to take the game winning shot and missed. Ive failed over and over and over again in my life. And that is why I succeed”, “You must be the change you want to see in the world”, “What you get by achieving your goals is not as important as what you become by achieving your goals”, “You can get everything in life you want if you will just help enough other people get what they want”, “Whatever you do will be insignificant, but it is very important that you do it”, “Desire is the starting point of all achievement, not a hope, not a wish, but a keen pulsating desire which transcends everything”, “Failure is the condiment that gives success its flavor”, “Vision without action is daydream. Action without vision is nightmare”];
    var author = [“Aristotle”, “Robert Frost”, “William B Sprague”, “Albert Einstein”, “Henry Ford”, “Oprah Winfrey”, “Michael Jordan”, “Mahatma Gandhi”, “Goethe”, “Zig Ziglar”, “Mahatma Gandhi”, “Napoleon Hill”, “Truman Capote”, “Japanese Proverb”];
    var random = Math.floor((Math.random()*quotes.length));

    var randomQuote= quotes[random];
    var randomauthor= author[random];
    $(".quote").text(randomQuote);
    $(".author").text(randomauthor);  
  }
  $(".btn").on("click", function(){
    getQuote();
  }

});
Joseph
@revisualize
Jun 23 2017 02:21
@CurtisJCamp Do you have this on a codepen?
@CurtisJCamp Or somewhere else?
@revisualize it is definitely a work in progress
Joseph
@revisualize
Jun 23 2017 02:27
@CurtisJCamp Do you realize that you don't have a } to terminate your function() {
@CurtisJCamp You also don't have a ) for encapilating your .ready(
@CurtisJCamp OR!
@CurtisJCamp You don't have a ) for your .on(
@CurtisJCamp You really need to look over all of your ()s and {}s
Joseph
@revisualize
Jun 23 2017 02:31
And make sure that they match up where they're supposed to
@potato8 What code have you written?
Curtis
@CurtisJCamp
Jun 23 2017 02:31
is that what would give me that error?
@revisualize
Joseph
@revisualize
Jun 23 2017 02:31
@CurtisJCamp Yes.
@CurtisJCamp In fact, that's all I did to make the error go away was found that there were missing ) and }
Curtis
@CurtisJCamp
Jun 23 2017 02:33
can you possibly fork it and show me?
Joseph
@revisualize
Jun 23 2017 02:33
@CurtisJCamp Sorry, I can't and won't do that.
Claudio Restifo
@Marmiz
Jun 23 2017 02:33
@potato8 you don't have to re declare var.
If a variable is already declared then below I can simply "use" it in the page like:
var x = 1
x = 5
 // x is now 5
Hamza Amer
@Heyrio
Jun 23 2017 02:37
Is it normal for me to start getting stuck on all the algorithm challenges? It's getting a bit frustrating.
Joseph
@revisualize
Jun 23 2017 02:38
@Heyrio Yes.
@Heyrio One challenge took me over 25hours of work to solve.
Curtis
@CurtisJCamp
Jun 23 2017 02:38
@revisualize I'm sorry I didn't mean to ask for something unreasonable I'm new to all of this.
Hamza Amer
@Heyrio
Jun 23 2017 02:38
@revisualize ok, I love problem solving but I was beging to wonder..
@revisualize ok, just checking. I wasn't sure if I need to maybe next some back steps
take some*
i'm stuck on this

function largestOfFour(arr) {

  var arrResult = [0,0,0,0];

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

   for(var subIndex = 0; subIndex < arr[arrayIndex].length; subIndex++){

     if(arr[arrayIndex][subIndex] > arrResult[arrayIndex]) {         
          arrResult[arrayIndex] = arr[arrayIndex][subIndex];

     }
      return arrResult;
    }

  }

 }


largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Javed Kadri
@devajirdak
Jun 23 2017 02:39
@revisualize, you are not lone, I sometimes wonder too, I get stuck on those challenges too.
Pagnito
@Pagnito
Jun 23 2017 02:40
hey im lookoing for a method like splice but for a string
i tried subtr and substring but it doesnt change the content of the original string
kumquatfelafel
@kumquatfelafel
Jun 23 2017 02:40
@Heyrio There's little purpose to having a for loop that executes more than once if you have a return statement inside said for loop that is guaranteed to execute.
Pagnito
@Pagnito
Jun 23 2017 02:40
i need to literally cut out a section of the string
Hamza Amer
@Heyrio
Jun 23 2017 02:40
@devajirdak It's strange, I'm a math major. I thought i'd be naturally good at this
Hamza Amer
@Heyrio
Jun 23 2017 02:41
@kumquatfelafel so only one loop? I was just going to use a higher order function map but I thought maybe the loops would be easier
Joseph
@revisualize
Jun 23 2017 02:41
You'll see that your loop isn't actually looping.
kumquatfelafel
@kumquatfelafel
Jun 23 2017 02:41
^this. i.e. what @revisualize said. Check the link.
Joseph
@revisualize
Jun 23 2017 02:42
@Heyrio You need more than 1 loop. Unless you do something else completely.
@Heyrio You can do it the way you are.. You just need to understand that once the return statement is triggered the WHOLE function HALTS. Including the loop.
Javed Kadri
@devajirdak
Jun 23 2017 02:43
I am not sure why this code won't show weather for my location, I am very new to JS, and I found this online and I was trying to learn the code. here is the code pen for it, https://codepen.io/jkadri99/pen/EXmLbv
Hamza Amer
@Heyrio
Jun 23 2017 02:43
wait so because the return statment is outside its stopping before it exectues the rest of the code
Fixed, I got it.
@revisualize thank you
CamperBot
@camperbot
Jun 23 2017 02:45
heyrio sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4233 | @revisualize |http://www.freecodecamp.com/revisualize
Hamza Amer
@Heyrio
Jun 23 2017 02:45
@kumquatfelafel thank you
CamperBot
@camperbot
Jun 23 2017 02:45
heyrio sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 282 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
kumquatfelafel
@kumquatfelafel
Jun 23 2017 02:45
@Heyrio Well... because the return statement is inside of the for loop and executes unconditionally, it will stop after executing once, or rather as soon as return statement executed. If you had it inside an if statement, it might or might not stop early. If you have it outside the for loops altogether, it will only return after for loops fully execute.
Curtis
@CurtisJCamp
Jun 23 2017 02:46
@revisualize every {} and () is accounted for and its still giving me the error.
Joseph
@revisualize
Jun 23 2017 02:50
@CurtisJCamp Then I don't know.
Curtis
@CurtisJCamp
Jun 23 2017 02:50
Can I not have certain characters in my quote strings?
Hamza Amer
@Heyrio
Jun 23 2017 02:51
@CurtisJCamp depending on what they are you may need to escape?
Curtis
@CurtisJCamp
Jun 23 2017 02:52
okay Ill try that out
heidisdad2
@heidisdad2
Jun 23 2017 03:01
hey broskis whats going on?
Diego Mayer
@Chrono79
Jun 23 2017 03:02
@CurtisJCamp click the arrow down right-top corner of js panel, click analyze, solve all the troubles there
Those quotes are weird, use ' or "
heidisdad2
@heidisdad2
Jun 23 2017 03:02
function chunkArrayInGroups(arr, size) {
  // Break it up.
  var chunks= [];
  for(var i=0; i<arr.length; i+2){
  chunks.push(arr.slice(i, i +=size));

  }return chunks;
}
chunkArrayInGroups(["a", "b", "c", "d", "e", "f", "g","h"], 2);
got this answer correct, understood many of the concepts but really struggled. finally figured it out but it was a lot of trial and error because i knew i was close.
can someone maybe explain to me why i needed i+2 in this for loop.
Diego Mayer
@Chrono79
Jun 23 2017 03:03
@heidisdad2 you're hardcoding the second parameter (size)
i+2 does nothing to change i value
CallMeOrange
@EgnaroDev
Jun 23 2017 03:04
@Pagnito hey
Pagnito
@Pagnito
Jun 23 2017 03:04
@MCTwoDigitZero sup dude
CallMeOrange
@EgnaroDev
Jun 23 2017 03:05
Im working on Card Countings
Been a while I did that..
Kelechi Chinaka
@ke1echi
Jun 23 2017 03:05
string.replace(/[ąćęłńóśźż]/g, "a,c,e,l,n,o,s,z,z") @Chrono79
Pamela guy
@219tenderlips
Jun 23 2017 03:05

can someone tell me why my code is not working?
// Setup
var outerWear = "T-Shirt";

function myOutfit() {
// Only change code below this line

var outerWear ="Sweater";

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

myOutfit();

Kelechi Chinaka
@ke1echi
Jun 23 2017 03:05
i want to replace them @Chrono79
Diego Mayer
@Chrono79
Jun 23 2017 03:05
not like that
Pamela guy
@219tenderlips
Jun 23 2017 03:06
myOutfit should return to "sweater".
Diego Mayer
@Chrono79
Jun 23 2017 03:06
@219tenderlips sweater, capitalization matters
Danny
@WaterYourRoots
Jun 23 2017 03:07
can any one help me out with what im doing wrong here...

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

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

Pamela guy
@219tenderlips
Jun 23 2017 03:07
ok let me take the capital off thanks so much!
Diego Mayer
@Chrono79
Jun 23 2017 03:07
@WaterYourRoots don't use *= or +=, use the algorithm and celsius
Pamela guy
@219tenderlips
Jun 23 2017 03:08
@Chrono79 bingo worked thank you!
CamperBot
@camperbot
Jun 23 2017 03:08
219tenderlips sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4385 | @chrono79 |http://www.freecodecamp.com/chrono79
José Alves
@zeph7
Jun 23 2017 03:08
@WaterYourRoots Fahreneit variable is probably undefined

did anyone accomplish this challenge without using recursion technique ?

function steamrollArray(arr) {
var array = arguments[1] ? arguments[1] : [];
if(!Array.isArray(arr))
array.push(arr);
else{
arr.forEach(function(x){
steamrollArray(x,array);
});
}
return array;
}

Pagnito
@Pagnito
Jun 23 2017 03:10
@MCTwoDigitZero car countings? is that a fcc challenge?
Ivan Leo
@yaaaas
Jun 23 2017 03:10
Hey guys
Need some help with the wikipedia assignment
Diego Mayer
@Chrono79
Jun 23 2017 03:11
@kelechichinaka create an object with those weird chars as keys and the replacement as values
use a function with replace
Ken Haduch
@khaduch
Jun 23 2017 03:11
@WaterYourRoots - there are a few things going on - first, you should only have var fahrenheit declared (using the keyword var) only ONE time. Second major thing - you are not using the function argument, named celsius, and accessed within your function as a regular variable, in your calculation. Do you see the formula that they give you to perform the calculation? It is a pretty straightforward translation from the english description of the formula to the code that will perform that calculation.
Ivan Leo
@yaaaas
Jun 23 2017 03:12
Im using the open query function to get the results I want. However, i can't seem to get the data from the JSON to appear in the console at all. It was working fine the first few times and then suddenly it seems like my AJAX requests arent working
anyone had the same problem?
Danny
@WaterYourRoots
Jun 23 2017 03:12
@zeph7 @Chrono79 @khaduch thanks guys I just tried this.. didn't work, I feel like im trying obvious of answers
CamperBot
@camperbot
Jun 23 2017 03:12
wateryourroots sends brownie points to @zeph7 and @chrono79 and @khaduch :sparkles: :thumbsup: :sparkles:
:cookie: 288 | @zeph7 |http://www.freecodecamp.com/zeph7
:star2: 4386 | @chrono79 |http://www.freecodecamp.com/chrono79
Danny
@WaterYourRoots
Jun 23 2017 03:12
var celsius = var fahrenheit * (9 / 5) + 32;
CamperBot
@camperbot
Jun 23 2017 03:12
:star2: 3030 | @khaduch |http://www.freecodecamp.com/khaduch
Curtis
@CurtisJCamp
Jun 23 2017 03:13
@Chrono79 That was totally it. I made them in word and copied them over and once I fixed the " to ' or even just edited them it fixed the error. Thanks @Chrono79
CamperBot
@camperbot
Jun 23 2017 03:13
curtisjcamp sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:star2: 4387 | @chrono79 |http://www.freecodecamp.com/chrono79
Diego Mayer
@Chrono79
Jun 23 2017 03:13
@WaterYourRoots don't use var keyword everywhere, fahrenheit should be on the left side
Ken Haduch
@khaduch
Jun 23 2017 03:13
@yaaaas - are you seeing any errors in the browser devtools console? Open the devtools to inspect an element in your page, and then see if you can see any errors. Things change over time, maybe some new error popped up?
Kelechi Chinaka
@ke1echi
Jun 23 2017 03:13
i thought i could use regex? @Chrono79
CallMeOrange
@EgnaroDev
Jun 23 2017 03:13
@Pagnito yeah Counting Cards
Like blackjack
Diego Mayer
@Chrono79
Jun 23 2017 03:14
@kelechichinaka https://repl.it/Is2C/9 it uses regex to match them
CallMeOrange
@EgnaroDev
Jun 23 2017 03:14
Im halfway there but im done..
heidisdad2
@heidisdad2
Jun 23 2017 03:15
@Chrono79 what do you mean?
@Chrono79 i had to change to i+2 or it wouldn't work
José Alves
@zeph7
Jun 23 2017 03:15
@yaaaas I did have some problem on this one, but I don't remember what I did though. Maybe if you show us your AJAX part with the URI we can help
Pagnito
@Pagnito
Jun 23 2017 03:16
@MCTwoDigitZero im not seeing it on the map
Danny
@WaterYourRoots
Jun 23 2017 03:16
@Chrono79 got it, over using the variables was messing me up
Diego Mayer
@Chrono79
Jun 23 2017 03:16
@heidisdad2
function chunkArrayInGroups(arr, size) {
  // Break it up.
  var chunks= [];
  for(var i=0; i<arr.length; i+2){ //the i+2 here does nothing to change i value, you could write i + 100000 and it will work too
  chunks.push(arr.slice(i, i +=size)); //you're changing i value here instead

  }return chunks;
}
chunkArrayInGroups(["a", "b", "c", "d", "e", "f", "g","h"], 2);
CallMeOrange
@EgnaroDev
Jun 23 2017 03:16
@Pagnito really?
Danny
@WaterYourRoots
Jun 23 2017 03:16
thank you @Chrono79
CamperBot
@camperbot
Jun 23 2017 03:16
wateryourroots sends brownie points to @chrono79 :sparkles: :thumbsup: :sparkles:
:warning: wateryourroots already gave chrono79 points
CallMeOrange
@EgnaroDev
Jun 23 2017 03:16
Its in JS section
Diego Mayer
@Chrono79
Jun 23 2017 03:16
:+1:
CallMeOrange
@EgnaroDev
Jun 23 2017 03:16
@Pagnito let me link it...
Ken Haduch
@khaduch
Jun 23 2017 03:16
@yaaaas - and if you do open the devtools console, you will probably have to reload the page so that the attempt at the transaction occurs again, in order to capture any potential errors.
Pagnito
@Pagnito
Jun 23 2017 03:17
ooh @MCTwoDigitZero i was looking at the algorithms
CallMeOrange
@EgnaroDev
Jun 23 2017 03:17
lol
Wanna see my code? Im not done yet tho
Pagnito
@Pagnito
Jun 23 2017 03:17
@MCTwoDigitZero after ur done with front end cert, u should go to codefights.com, the algorithms there are pretty fun and the UI is awesome
CallMeOrange
@EgnaroDev
Jun 23 2017 03:18
@Pagnito yeah I do codefights
also codewars, its so fun lol
Pagnito
@Pagnito
Jun 23 2017 03:18
nice
CallMeOrange
@EgnaroDev
Jun 23 2017 03:18
Im not really ready for codefights, just a bit advanced for me so will have to wait until I learn more JS
Pagnito
@Pagnito
Jun 23 2017 03:18
i like codefights, especially with the whole job helping thing they do if u do well enough
CallMeOrange
@EgnaroDev
Jun 23 2017 03:19
I see
Im stuck in centuryFromYear...
But I will figure it out after I get my knowledge of JS back..
Pagnito
@Pagnito
Jun 23 2017 03:19
yea, once u grasp basic methods of js, its pretty easy, except figuring out part lol
CallMeOrange
@EgnaroDev
Jun 23 2017 03:19
lol
Ken Haduch
@khaduch
Jun 23 2017 03:19

@WaterYourRoots - the equation that you are trying to code is:

The algorithm to convert from Celsius to Fahrenheit is the temperature in Celsius times 9/5, plus 32.

You should end up with a calculation that looks like fahrenheit = at the start, assigning the result of converting the celsius value to a fahrenheit value. celsius time 9/5 plus 32 should be on the right hand side of the =. It looks like you misinterpreted that formula in the most recent code that you posted.

Pagnito
@Pagnito
Jun 23 2017 03:20
ya, i been practicing everyday again, after that scare i had from not doing anything for a week
CallMeOrange
@EgnaroDev
Jun 23 2017 03:20
Just a question, is it possible to put parameter in an array then seperate them?
@Pagnito lol really?
Pagnito
@Pagnito
Jun 23 2017 03:20
yea, that shit had me scared, i had forgotten few lil things, but that was enough to put the wind up my ass
CallMeOrange
@EgnaroDev
Jun 23 2017 03:20
I think I need to do centuryFromYear same way like roman number gen.
Pagnito
@Pagnito
Jun 23 2017 03:21
im not ready to lose months worth of work like that lol
CallMeOrange
@EgnaroDev
Jun 23 2017 03:21
lol
Pagnito
@Pagnito
Jun 23 2017 03:21
ooh dude, i remember that challenge
fck that challenge
lol
CallMeOrange
@EgnaroDev
Jun 23 2017 03:21
yeah
It was hard
just had to find some bunch of right arrays for roman numbers then ...
Pagnito
@Pagnito
Jun 23 2017 03:22
im not lookin forward to redoing all the algorithms on the beta version of FCC, even tho i could copy and paste, i wanna redo them
CallMeOrange
@EgnaroDev
Jun 23 2017 03:22
I see
redoing would be good
If beta version of fCC is done, will this fCC be gone?
Pagnito
@Pagnito
Jun 23 2017 03:22
i dunno, im guessing
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:22
wait what?!? :laughing:
Pagnito
@Pagnito
Jun 23 2017 03:23
it would be kind of obselete, since the the better parts of this version never got finished
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:23
Didn't realize this was a beta
Pagnito
@Pagnito
Jun 23 2017 03:23
@kumquatfelafel there is a new version of FCC coming out soon
CallMeOrange
@EgnaroDev
Jun 23 2017 03:23
no its not beta lol
heidisdad2
@heidisdad2
Jun 23 2017 03:23
@Chrono79 yeah you are correct i just tested it, but when i do i++ it doesn't work. wonder why?
Diego Mayer
@Chrono79
Jun 23 2017 03:23
@heidisdad2 because i++ does modify i value, it's the same as i = i + 1
https://repl.it/Is2C/10
Pagnito
@Pagnito
Jun 23 2017 03:23
@kumquatfelafel this is alpha atm, but there is a new version thats in beta atm, and will become alpha soon
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:24
@heidisdad2 and only adds 1, which is not what you need to add here.
heidisdad2
@heidisdad2
Jun 23 2017 03:24
but i+1 does work
Diego Mayer
@Chrono79
Jun 23 2017 03:24
again i+whatever doesn't change i value
CallMeOrange
@EgnaroDev
Jun 23 2017 03:25
@Pagnito I asked a Mod
She said fCC and beta will be merged but progress of beta will be deleted
Pagnito
@Pagnito
Jun 23 2017 03:25
wait what? merged? dfuq how?
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:25
@heidisdad2 that's because i+1 doesn't increment i. It's like the difference between saying "2 apples" and "I have 1 apple and one more."
CallMeOrange
@EgnaroDev
Jun 23 2017 03:25
But old fCC will stay, nothing deleted
Pagnito
@Pagnito
Jun 23 2017 03:25
i guess with webpack it wouldnt b so hard
CallMeOrange
@EgnaroDev
Jun 23 2017 03:25
@Pagnito I have no idea lol
Pagnito
@Pagnito
Jun 23 2017 03:26
i bet they building this using react
and webpack
CallMeOrange
@EgnaroDev
Jun 23 2017 03:26
but that mean it will add more requirements for front end cert..
More projects would be good
heidisdad2
@heidisdad2
Jun 23 2017 03:26
@kumquatfelafel @Chrono79 thanks guys
CamperBot
@camperbot
Jun 23 2017 03:26
heidisdad2 sends brownie points to @kumquatfelafel and @chrono79 :sparkles: :thumbsup: :sparkles:
:cookie: 283 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
:star2: 4388 | @chrono79 |http://www.freecodecamp.com/chrono79
Pagnito
@Pagnito
Jun 23 2017 03:26
yea, i wonder if front end cert will get taken from me?? gotta print that shit >:) before they do
CallMeOrange
@EgnaroDev
Jun 23 2017 03:26
@Pagnito lol it wont
Well print just in case..
Pagnito
@Pagnito
Jun 23 2017 03:27
yea i dont rly care lol, since tech employers i think care much more about proof of ur skill
Diego Mayer
@Chrono79
Jun 23 2017 03:27
:wave: later
CallMeOrange
@EgnaroDev
Jun 23 2017 03:28
I wonder if fCC allows people keeps their cert or they will have to finish new requirements...
Pagnito
@Pagnito
Jun 23 2017 03:28
yea i wonder the same
Joseph
@revisualize
Jun 23 2017 03:28
about @Pagnito
CamperBot
@camperbot
Jun 23 2017 03:28
:cookie: 253 | @pagnito |http://www.freecodecamp.com/pagnito
Pagnito
@Pagnito
Jun 23 2017 03:28
im rly looking forward tho, i really hope their react and intro to webpack is really good, im struggling with it, proly by the time it comes out ill alrdy know it but still
CallMeOrange
@EgnaroDev
Jun 23 2017 03:29
lol what was that for?
@Pagnito check my cookies..
Pagnito
@Pagnito
Jun 23 2017 03:29
@revisualize if fCC allows people keeps their cert or they will have to finish new requirements
Joseph
@revisualize
Jun 23 2017 03:29
@Pagnito Why would they take the cert from you?
Pagnito
@Pagnito
Jun 23 2017 03:29
@MCTwoDigitZero thanks
CamperBot
@camperbot
Jun 23 2017 03:29
pagnito sends brownie points to @mctwodigitzero :sparkles: :thumbsup: :sparkles:
:cookie: 293 | @mctwodigitzero |http://www.freecodecamp.com/mctwodigitzero
CallMeOrange
@EgnaroDev
Jun 23 2017 03:29
@revisualize only when beta is merged with old fCC
Joseph
@revisualize
Jun 23 2017 03:29
WHAT!?
No.
CallMeOrange
@EgnaroDev
Jun 23 2017 03:29
Yes
I asked a Mod about it
Pagnito
@Pagnito
Jun 23 2017 03:29
@revisualize i dont think they will to be honest
Joseph
@revisualize
Jun 23 2017 03:29
WHAT!?
CallMeOrange
@EgnaroDev
Jun 23 2017 03:30
old fCC progress will stay, dont worry...
but only beta will be affected
Joseph
@revisualize
Jun 23 2017 03:30
If you have the cert on the current live site.
You keep the cert.
CallMeOrange
@EgnaroDev
Jun 23 2017 03:30
Yeah I think so
Joseph
@revisualize
Jun 23 2017 03:30
Unless you cheated.
CallMeOrange
@EgnaroDev
Jun 23 2017 03:30
What about new projects?
Pagnito
@Pagnito
Jun 23 2017 03:30
the new beta doesnt even have front end cert anymore, its called front end libraries
i guess its teh same but doesnt sound as nice
CallMeOrange
@EgnaroDev
Jun 23 2017 03:30
@revisualize yeah remember one old guy who finished every projects each day?
@Pagnito oh yeah new certs
I wonder if I get that certs once its merged...
Pagnito
@Pagnito
Jun 23 2017 03:31
yea
i dunno
CallMeOrange
@EgnaroDev
Jun 23 2017 03:31
Well I would have to finish just these projects then...
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:31
@Pagnito that sounds like a way to maybe allow to keep old certs while making new ones
CallMeOrange
@EgnaroDev
Jun 23 2017 03:31
This is no time to worry about fCC and beta fCC getting merging lol
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:32
if they chose to go that route I mean
Joseph
@revisualize
Jun 23 2017 03:32
LOOK! The BETA will not go live until at LEAST November.
If you are worrying about this shit now. You have issues.
Pagnito
@Pagnito
Jun 23 2017 03:32
@kumquatfelafel yea none of those labels really matter at the end of the day either, so it really is pointless stressing it
nobody is worrying about it, its just a discussion lol
CallMeOrange
@EgnaroDev
Jun 23 2017 03:33
@revisualize really? does it say anything getting merged with fCC?
Mario Ley Tello
@23marioley
Jun 23 2017 03:33
function titleCase(str) {
  var array = str.toLowerCase().split(' ');

  for (var i=0; i<=array.length; i++){
    array[i] = array[i].charAt(0).toUpperCase() + array[i].substring(1);
  }
  return array;
}

titleCase("I'm a little tea pot");
CallMeOrange
@EgnaroDev
Jun 23 2017 03:33
Dunno if I can get a cert in just two months...
Mario Ley Tello
@23marioley
Jun 23 2017 03:33
Can somebody tell me what im doing wrong?
CallMeOrange
@EgnaroDev
Jun 23 2017 03:33
Average is like a year
5 months I meant...
2 months until school start
Yeah I think for me getting a cert at least 5 months is possible
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:34
@23marioley they want you to return a string. array is an array
CallMeOrange
@EgnaroDev
Jun 23 2017 03:34
Dont care about certs. only care about knowledge of programming
Unless I want to post certs on the wall
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:34
@23marioley you can turn back into a string using join
Joseph
@revisualize
Jun 23 2017 03:35
Your personal projects have almost 50x the weight of any stupid cert from some random website.
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:35
@Pagnito yup
Mario Ley Tello
@23marioley
Jun 23 2017 03:36
@kumquatfelafel thank you
CamperBot
@camperbot
Jun 23 2017 03:36
23marioley sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 284 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
CallMeOrange
@EgnaroDev
Jun 23 2017 03:37
@revisualize lol I agree
Kelechi Chinaka
@ke1echi
Jun 23 2017 03:39
u should be interested in uping your skill rather than a paper @MCTwoDigitZero
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:39
@revisualize I disagree, sir. It's thanks to the fake degree from an unknown university I printed out that I'm currently teaching coding to other rodentia. And what is a certificate, if not a fake degree from an unknown university?
CamperBot
@camperbot
Jun 23 2017 03:39
kumquatfelafel sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4234 | @revisualize |http://www.freecodecamp.com/revisualize
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:40
haha. Hope you like brownie points :p
Pagnito
@Pagnito
Jun 23 2017 03:40
when i find aweseme tuts, it feels like when i was a kid about to smoke some good weed
CallMeOrange
@EgnaroDev
Jun 23 2017 03:41
lol
You smoked weed?
@kelechichinaka ya that is what Im doing
Looking forward to improve and better
Pagnito
@Pagnito
Jun 23 2017 03:41
@MCTwoDigitZero dude, i was the biggest pothead
in my heart i stil am tho
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:42
@MCTwoDigitZero To be fair, smoked weed is better on a bagel than ... well... weed.
Pagnito
@Pagnito
Jun 23 2017 03:42
one day, when i can afford to cruise and be more lax with learning programming ill be a pothead again
CallMeOrange
@EgnaroDev
Jun 23 2017 03:43
Yeah you told me you smoked weed but I said it for no reason..
Joseph
@revisualize
Jun 23 2017 03:43
@kumquatfelafel Thanks for the "free" brownie point. I'll just subtract one from the bin where I should have gotten one and didn't because sometimes people don't know how to thank people.
CamperBot
@camperbot
Jun 23 2017 03:43
revisualize sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 285 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
CallMeOrange
@EgnaroDev
Jun 23 2017 03:44
Some states in US weed isn't allowed
Well I gotta watch anime/eating
Cya
Pagnito
@Pagnito
Jun 23 2017 03:44
sweeet, what anime?
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:45

Well I gotta ... eating

Me too. All this talk about pot and brownies is somehow making me hungry.

Who'da thunk it.
CallMeOrange
@EgnaroDev
Jun 23 2017 03:46
@Pagnito Bleach lol
have you heard of Attack on Titan: Junior High?
It was released today and I was first to watch..
Pagnito
@Pagnito
Jun 23 2017 03:47
@MCTwoDigitZero oh dude that used to be my shit!, i stopped watching it tho, after they came back from saving rukia, it was kinda wack
@MCTwoDigitZero WHAT ITS RELEASED!!!
@MCTwoDigitZero dude kissanime?? has it??
CallMeOrange
@EgnaroDev
Jun 23 2017 03:47
no.. crunchyroll
dude it have entire seasons of Bleach
Pagnito
@Pagnito
Jun 23 2017 03:47
ima watcht that shit later, thanks
CallMeOrange
@EgnaroDev
Jun 23 2017 03:48
No problem
12 episodes was released at same time
Pagnito
@Pagnito
Jun 23 2017 03:48
ite man, im not gonna keep u here any longer, go! and get ur fill
!!
CallMeOrange
@EgnaroDev
Jun 23 2017 03:48
Alright lol, see ya
Pagnito
@Pagnito
Jun 23 2017 03:48
cya
Keon Samuel
@keonsam
Jun 23 2017 03:50
@MCTwoDigitZero how old are you?
Cathy
@cathypchui
Jun 23 2017 03:54
still stuck on search and destroy T.T

function destroyer(arr) {
  // Remove all the values
  var newArray = [];
  for (i= 1; i<arguments.length; i++){
    newArray.push(arguments[i]);
  }
  function filterMachine(obj){
    if(newArray.hasOwnProperty(obj)){

    }
    else{
      return obj;
    }
  }
  var test = arr.filter(filterMachine);
  return test;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
madankumar sm
@madanamigo
Jun 23 2017 03:55

unction palindrome(str) {
var key= str.toLowerCase;

if(key!==key.split('').reverse().join('')){
return false;

}

return true ;
}

palindrome("eye");
wat wring with this code??

kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:56
@madanamigo You didn't get rid of non-alphanumeric characters.
e.g. a man, a plan, a canal, panama may be palindrome, but as soon as you include those commas and spaces no longer same front to back and back to front.
CallMeOrange
@EgnaroDev
Jun 23 2017 03:58
@keonsam 16
karthikreddyrenati
@karthikreddyrenati
Jun 23 2017 03:58
hai can anyone help me on the topic of js
anybody is their?
kumquatfelafel
@kumquatfelafel
Jun 23 2017 03:59
@karthikreddyrenati ask away.
karthikreddyrenati
@karthikreddyrenati
Jun 23 2017 04:00
yeah in javascript ,will u tell me about converting fahrenheit to celsius
kumquatfelafel
@kumquatfelafel
Jun 23 2017 04:01
do you write any code for it yet?
karthikreddyrenati
@karthikreddyrenati
Jun 23 2017 04:02
no, i didn't understand even a single line also
Nrupen
@inrupen
Jun 23 2017 04:02

easier solution than this?any?
Title Case A Sentence :

function titleCase(str) {
var strOne=[];
var strNew=str.toLowerCase().split(" ");
for(var i=0;i<strNew.length;i++){
//console.log( strNew[i].length );
//console.log(strNew[i].charAt(0));
strOne.push( strNew[i].charAt(0).toUpperCase() + strNew[i].substr(1,strNew[i].length-1).toLowerCase() );
var finalStr = strOne.join(" ");
}
return finalStr;
}

titleCase("HERE IS MY HANDLE HERE IS MY SPOUT");

CallMeOrange
@EgnaroDev
Jun 23 2017 04:02
@karthikreddyrenati do you know how to convert fahrenheit to celsius?
Ignore coding, how would you calc it in paper?
karthikreddyrenati
@karthikreddyrenati
Jun 23 2017 04:03
yeah its based on that formaula
CallMeOrange
@EgnaroDev
Jun 23 2017 04:03
yeah
Use that
Use parameter in that formula
Well that about it, you should be able to figure it out
karthikreddyrenati
@karthikreddyrenati
Jun 23 2017 04:05
yeah ,temp in (F)=temp(c)*9/5+32
CallMeOrange
@EgnaroDev
Jun 23 2017 04:05
You need to have right formula..
Nrupen
@inrupen
Jun 23 2017 04:06

```function titleCase(str) {
var strOne=[];
var strNew=str.toLowerCase().split(" ");
for(var i=0;i<strNew.length;i++){
//console.log( strNew[i].length );
//console.log(strNew[i].charAt(0));
strOne.push( strNew[i].charAt(0).toUpperCase() + strNew[i].substr(1,strNew[i].length-1).toLowerCase() );
var finalStr = strOne.join(" ");
}
return finalStr;
}

titleCase("HERE IS MY HANDLE HERE IS MY SPOUT");```

Cathy
@cathypchui
Jun 23 2017 04:06
@inrupen I made an array out of the string, converted entire array to lower case with a for loop, then made another for loop to convert the first letter of each item in the array to upper case, then did an array.join(" ");
karthikreddyrenati
@karthikreddyrenati
Jun 23 2017 04:06
@MCTwoDigitZero will explain it once?
fdemaa
@fdemaa
Jun 23 2017 04:07
@inrupen i did this:

  var a = str.toLowerCase().split(" ");  

  for ( var i = 0; i<a.length; i++){
    a[i] = a[i][0].toUpperCase() + (a[i].slice(1));
   }
  return a.join(" ");
}

titleCase("I'm the little tea of pot");
CallMeOrange
@EgnaroDev
Jun 23 2017 04:08
@karthikreddyrenati parameter*(9/5)+32
karthikreddyrenati
@karthikreddyrenati
Jun 23 2017 04:08
@MCTwoDigitZero yeah,i finished that task.
CallMeOrange
@EgnaroDev
Jun 23 2017 04:08
like that then assign it to variable
Nrupen
@inrupen
Jun 23 2017 04:08
Thank you @cathypchui
@fdemaa I shud try to use .slice ...Thanku
CamperBot
@camperbot
Jun 23 2017 04:08
:cookie: 286 | @fdemaa |http://www.freecodecamp.com/fdemaa
inrupen sends brownie points to @cathypchui and @fdemaa :sparkles: :thumbsup: :sparkles:
:cookie: 258 | @cathypchui |http://www.freecodecamp.com/cathypchui
CallMeOrange
@EgnaroDev
Jun 23 2017 04:08
oh Good
sorry I was confusing which to convert.. C to F or F to C :/
fdemaa
@fdemaa
Jun 23 2017 04:09
@inrupen np!
karthikreddyrenati
@karthikreddyrenati
Jun 23 2017 04:09
thanks for your instant help
CallMeOrange
@EgnaroDev
Jun 23 2017 04:09
No problem
Cathy
@cathypchui
Jun 23 2017 04:10
@inrupen you're welcome!
still needing help with my seek and destroy. I've tried a few different ways now
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:13
@cathypchui show what you've done
Nrupen
@inrupen
Jun 23 2017 04:14
testing
Cathy
@cathypchui
Jun 23 2017 04:14

function destroyer(arr) {
  // Remove all the values
  var newArray = [];
  for (i= 1; i<arguments.length; i++){
    newArray.push(arguments[i]);
  }
  function filterMachine(obj){
    if(newArray.hasOwnProperty(obj)===true){

    }
    else{
      return obj;
    }
  }
  var test = arr.filter(filterMachine);
  return test;
}

destroyer([3, 5, 1, 2, 2], 2, 3, 5);
@Lumexralph that's what I have so far
Claudio Restifo
@Marmiz
Jun 23 2017 04:18
@revisualize how's the extra challenges are coming along? :)
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:25
@cathypchui i'll suggest you use indexOf in your filter method callback
SpeedofHuman
@SpeedofHuman
Jun 23 2017 04:27
Working on the Counting Cards exercise. Feeling a little stuck. Code so far:

var count = 0;

function cc(card) {
  // Only change code below this line
  switch (card) {
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      answer = count + 1;
      break;
    case 7:
    case 8:
    case 9:
      answer = count + 0;
      break;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      answer = count - 1;
      break;
  }
  if (count <= 0) {
  return count + " Hold";
  }
  else if (count > 1) {
    return count + " Bet";
  }
  // 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');
cc(2); cc(3); cc(4); cc(5); cc(6);
BlackTiger
@BlackTigerRoar
Jun 23 2017 04:28
@SpeedofHuman Where you define answer? and you assign value to answer but you did not use it.
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:29
@SpeedofHuman where did you get answer ? you should be doing cont += 1 or decrement
BlackTiger
@BlackTigerRoar
Jun 23 2017 04:29
@SpeedofHuman so your count is always 0 right now.
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:30
@SpeedofHuman also you need to check if count is less than 0 or greater than 0 not equal to
Baibhav Gautam
@baibhavx
Jun 23 2017 04:30
Guys I am gonna start the calculator project. I am comfortable with the logic but in terms the user interface, is it advisable to build the calculator UI from stratch using HTML and CSS?
SpeedofHuman
@SpeedofHuman
Jun 23 2017 04:31
@Lumexralph @ShenyuSun Thanks, I think that helps. I can never figure out how much is written into the function they build for testing the count and how much I have to write.
CamperBot
@camperbot
Jun 23 2017 04:31
:warning: @shenyusun's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account.
speedofhuman sends brownie points to @lumexralph and @shenyusun :sparkles: :thumbsup: :sparkles:
:star2: 1984 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:32
@baibhavx you can have a skeleton frame to represent the calculator, then build the functionality, when you're done you can then design your calculator
kumquatfelafel
@kumquatfelafel
Jun 23 2017 04:32

@SpeedofHuman also you need to check if count is less than 0 or greater than 0 not equal to

Just to clarify this statement, if your count is greater than 0, you bet. Otherwise, you hold. You currently are checking if count is greater than 1, which will give wrong results according to instructions

Baibhav Gautam
@baibhavx
Jun 23 2017 04:33
@Lumexralph awesome thanks for the advice
CamperBot
@camperbot
Jun 23 2017 04:33
baibhavx sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1985 | @lumexralph |http://www.freecodecamp.com/lumexralph
Adam Bohannon
@abohannon
Jun 23 2017 04:36
can anyone help me understand why this works? I'm most confused by the if (func(arr[0])) part.
function dropElements(arr, func) {

var emptyArr = [];

  for (var i = 0; i < arr.length; i++){
    if (func(arr[0])){
      break;
    } 
    else {
      arr.shift();
    }
  }
return arr;

}

dropElements([1, 2, 3, 4], function(n) {return n >= 3;});
why wouldn't it be func(arr[i])
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:38
@abohannon this is in place of function(arr[0])
function(arr[0]) {return arr[0] >= 3;}
Adam Bohannon
@abohannon
Jun 23 2017 04:38
sorry ignore the emptyArr at the top - leftover from an experiment
@Lumexralph I guess im wondering by we're passing index 0
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:39
@abohannon but it should be arr[i] don't you think? that'll iterate all the elements in arr
Adam Bohannon
@abohannon
Jun 23 2017 04:40
thats what I thought... was going in circles for so long because I thought it should work. Got to the point where I looked up the solution
and 0 it is
Cathy
@cathypchui
Jun 23 2017 04:40
@Lumexralph I'm not familiar witharr.filter so I'm not sure what you mean. I tried searching, but haven't figured it out
kumquatfelafel
@kumquatfelafel
Jun 23 2017 04:40
It's because you're removing elements as you go along
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:41
@abohannon the reason is if there's no value greater or equal to 3, it's removed using shift
@abohannon so arr get's updated and the index get's reshuffled and it picks the next one now in index 0, that's the reason behind arr[0]
kumquatfelafel
@kumquatfelafel
Jun 23 2017 04:42
^
SpeedofHuman
@SpeedofHuman
Jun 23 2017 04:42
@kumquatfelafel Not according to the instructions: "or "Hold" if the count is zero or negative. "
Adam Bohannon
@abohannon
Jun 23 2017 04:42
@Lumexralph so how come I can't reproduce the values of arr[0] in console?
Joseph
@revisualize
Jun 23 2017 04:43
@Marmiz How's the what coming along?
Adam Bohannon
@abohannon
Jun 23 2017 04:43
@Lumexralph if i break it down in attempt to understand the pieces like so:
for (var i = 0; i < arr.length; i++){

    console.log(arr[0]);

  }
kumquatfelafel
@kumquatfelafel
Jun 23 2017 04:43
@SpeedofHuman Exactly. This is equivalent to "Bet if the count is greater than zero, otherwise hold."
Adam Bohannon
@abohannon
Jun 23 2017 04:43
it only returns 1, 1, 1, 1
Joseph
@revisualize
Jun 23 2017 04:43
@abohannon What's the value of arr[0]?
kumquatfelafel
@kumquatfelafel
Jun 23 2017 04:43
@abohannon Because now you're no longer removing elements.
Suppose you have an array 1, 2, 3, 4 and you remove the first element. Will the array still be 1,2,3,4?
Adam Bohannon
@abohannon
Jun 23 2017 04:44
ahhh i see
because the function returns false for the first 2, they are removed
and arr[0] is shifted one
kumquatfelafel
@kumquatfelafel
Jun 23 2017 04:45
aye
Adam Bohannon
@abohannon
Jun 23 2017 04:45
then true and the loop breaks
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:45
@abohannon i have issues with that solution, it's based on the fact that the array is sorted in ascending, if the array is not sorted in ascending order, it won't work
Adam Bohannon
@abohannon
Jun 23 2017 04:46
@kumquatfelafel @revisualize @Lumexralph thanks for talking it out with me.
CamperBot
@camperbot
Jun 23 2017 04:46
abohannon sends brownie points to @kumquatfelafel and @revisualize and @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 286 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
:star2: 1986 | @lumexralph |http://www.freecodecamp.com/lumexralph
:star2: 4237 | @revisualize |http://www.freecodecamp.com/revisualize
Tej B
@tejib
Jun 23 2017 04:46
image.png
Zack
@zackbiernat
Jun 23 2017 04:47
In a library such as this how do I search for a certain property? Using .length does not work.
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:47
@zackbiernat you can use for...in loop
Sudeep Narkar
@sudeepnarkar
Jun 23 2017 04:48

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

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

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

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

var Bike = function() {

// Only change code below this line.

var gear;

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

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

};

var myCar = new Car();

var myBike = new Bike();

'''

CamperBot
@camperbot
Jun 23 2017 04:48
:bulb: to format code use backticks! ``` more info
Sudeep Narkar
@sudeepnarkar
Jun 23 2017 04:48
var Car = function() {
  // this is a private variable
  var speed = 10;

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

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

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

var Bike = function() {

  // Only change code below this line.

  var gear;

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

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


};

var myCar = new Car();

var myBike = new Bike();
Can anyone take a look what is wrong here?
Zack
@zackbiernat
Jun 23 2017 04:49
@Lumexralph I am not familiar with other types of loops besides for loops or while loops
Claudio Restifo
@Marmiz
Jun 23 2017 04:49
@revisualize I saw a github thread where you proposed to add new challenges/lessons for the JS section... or am I mistaken?
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:50
@zackbiernat the variable in for..in is a placeholder for the object properties but in this case you're dealing with an array or objects, if the array is one elem,element array, you can index the array at 0 and use for...in loop to search the property
Tej B
@tejib
Jun 23 2017 04:50
Hello...I have a problem with the counting card solution....Think I have written the right code but for some reason the challenge is not getting completed. Could someone please help...Not sure how people are inserting their code in the site so pasting a screen print here
image.png
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:51
@zackbiernat check that link to have some understanding about it https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in
Claudio Restifo
@Marmiz
Jun 23 2017 04:51
@zackbiernat it's an array with object inside it.
So if you access contacts[0] you are accessing the first object --> contacts[0].firstName // akira lane
Mukul Agrawal
@mukul09
Jun 23 2017 04:51
can anybody tell me what is wrong in this code
 var api="https://api.darksky.net/forecast/08edb063fb44851af13bdcea3c608e86/"+latlon;
    $.getJSON(api,function(data){
    var currentTemp = data.currently.temperature;
      $("#temp").text(currentTemp);

    });
Sudeep Narkar
@sudeepnarkar
Jun 23 2017 04:51
var Car = function() {
  // this is a private variable
  var speed = 10;

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

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

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

var Bike = function() {

  // Only change code below this line.

  var gear;

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

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


};

var myCar = new Car();

var myBike = new Bike();
Can anyone take a look?
fdemaa
@fdemaa
Jun 23 2017 04:52
Do i have to use a loop to access each final substring on the algorithm Confirm the Ending ? Or it's not necessary
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:52
@sudeepnarkar the setGear method should assign the parameter to the private gear variable not public and don't make one
@mukul09 latlon is what?
Zack
@zackbiernat
Jun 23 2017 04:54
@Marmiz I am trying to loop through the various properties of contacts[i] but I am not sure how to since the object does not have a length
Sudeep Narkar
@sudeepnarkar
Jun 23 2017 04:54
@Lumexralph I did not undrstand
CallMeOrange
@EgnaroDev
Jun 23 2017 04:54
Hey guys, Need help with Counting Cards
This is my code, just started

var count = 0;

function cc(card) {

  if (card >= 2 && card <= 6) { // if 2 to 6 - Bet
    return "5 Bet";
 } else if (card >= 7 && card <= 9) { // if 7 to 9 - Hold
  return "0 Hold";
 } else if (card >= 10, 'J', 'Q', 'K', 'A') { // if 10 | other symbols - (-) Hold
  return "-5 Hold";
 }
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc(2); cc('J');
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:54
@sudeepnarkar i'll suggest you use another parameter name other than gear for the setGear method to avoid conflict
Sudeep Narkar
@sudeepnarkar
Jun 23 2017 04:55
@Lumexralph But I think it should work
kumquatfelafel
@kumquatfelafel
Jun 23 2017 04:55
@tejib They don't actually want those quotes on the outside.
Matthew
@muzcmancoder91
Jun 23 2017 04:55
Can someone please lend a hand.
Sudeep Narkar
@sudeepnarkar
Jun 23 2017 04:55
var Bike = function() {

  // Only change code below this line.

  var gear;

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

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


};

var myCar = new Car();

var myBike = new Bike();
I tried this but still not working
CallMeOrange
@EgnaroDev
Jun 23 2017 04:56
cmon...
abraham anak agung
@padunk
Jun 23 2017 04:56
@MCTwoDigitZero put your count variable inside function, and you need to count the card and return it later
CallMeOrange
@EgnaroDev
Jun 23 2017 04:56
alright
Mario Ley Tello
@23marioley
Jun 23 2017 04:56
function largestOfFour(arr) {
  // You can do this!
  var newArr = [];

    for(var i=0; i<arr.length; i++){
      newArr.push(Math.max.apply(null, arr[i]));
    }


  //var newArr = arr.map(mayor);

  return newArr;
}

largestOfFour([[4, 5, 1, 3], [13, 27, 18, 26], [32, 35, 37, 39], [1000, 1001, 857, 1]]);
Any suggestion to optimize my code?
Matthew
@muzcmancoder91
Jun 23 2017 04:57

Here is the text with the escape sequences written out.

"FirstLine newline backslash SecondLine backslash carriage-return ThirdLine"

SyntaxError: Invalid or unexpected token

myStr should have encoded text with the proper escape sequences and no spacing.

CallMeOrange
@EgnaroDev
Jun 23 2017 04:57
@padunk

function cc(card) {
  var count = 0;
  if (card >= 2 && card <= 6) { // if 2 to 6 - Bet
    count = "5 Bet";
 } else if (card >= 7 && card <= 9) { // if 7 to 9 - Hold
  count = "0 Hold";
 } else if (card >= 10, 'J', 'Q', 'K', 'A') { // if 10 | other symbols - (-) Hold
  count =  "-5 Hold";
 }
  return count;
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc(2); cc('J');
Matthew
@muzcmancoder91
Jun 23 2017 04:57
var myStr = "FirstLine\"\n\" \"\\"SecondLine\"\\" \"\r\"ThirdLine"; // Change this line
CallMeOrange
@EgnaroDev
Jun 23 2017 04:57
Like that?
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:57
@sudeepnarkar when you use this it's referencing an object and doing in setGear will look for the gear property in myCar object and that's not what you're to do
CallMeOrange
@EgnaroDev
Jun 23 2017 04:58
@muzcmancoder91 too many quotes
fdemaa
@fdemaa
Jun 23 2017 04:58
@Lumexralph hey bro, im kind lost on how to begin with the algorithm confirm the ending ? Do i have to use a loop to access each final substring Or it's not necessary, and i can use just substring
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:59
@muzcmancoder91 you should escape newline \n backslash \\ carriage-return \r all without quotes
abraham anak agung
@padunk
Jun 23 2017 04:59
@MCTwoDigitZero you need to count the card. if card 2-6, increment the count, if 10-j-q-k-a, decrement it. don't return -5 hold yet
Matthew
@muzcmancoder91
Jun 23 2017 04:59
Okay thank you @MCTwoDigitZero and @Lumexralph
CamperBot
@camperbot
Jun 23 2017 04:59
muzcmancoder91 sends brownie points to @mctwodigitzero and @lumexralph :sparkles: :thumbsup: :sparkles:
:cookie: 294 | @mctwodigitzero |http://www.freecodecamp.com/mctwodigitzero
:star2: 1987 | @lumexralph |http://www.freecodecamp.com/lumexralph
Ogundele Olumide
@Lumexralph
Jun 23 2017 04:59
@MCTwoDigitZero you should allow your if statements only decrement or increment count
CallMeOrange
@EgnaroDev
Jun 23 2017 04:59
oh ok
kumquatfelafel
@kumquatfelafel
Jun 23 2017 04:59
@MCTwoDigitZero count is declared outside function. That way, you can increment/decrement it through successive function calls. Saying count = "5 Bet" doesn't really make much sense.
CallMeOrange
@EgnaroDev
Jun 23 2017 04:59
like count +=?
@kumquatfelafel yeah.. someone told me to move that variable inside
Tej B
@tejib
Jun 23 2017 05:00
@kumquatfelafel ..Thanks so much!! It worked... :) Appreciate your help...
CamperBot
@camperbot
Jun 23 2017 05:00
tejib sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:cookie: 287 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel
Ogundele Olumide
@Lumexralph
Jun 23 2017 05:00
@fdemaa you don't need a loop, just using the length of the target parameter
fdemaa
@fdemaa
Jun 23 2017 05:01
@Lumexralph thanks man!
CamperBot
@camperbot
Jun 23 2017 05:01
fdemaa sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1988 | @lumexralph |http://www.freecodecamp.com/lumexralph
Zack
@zackbiernat
Jun 23 2017 05:02

var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
"lastName": "Potter",
"number": "0994372684",
"likes": ["Hogwarts", "Magic", "Hagrid"]
}

I know how to loop through the 'contacts' array using contacts.length but I cannot loop through the various properties with that same logic (ie. contacts[i].length). How can I loop through the properties?

Claudio Restifo
@Marmiz
Jun 23 2017 05:03

@zackbiernat the easiest method would be to nest a loop in a loop :)

for () { // loop the array
  for () { // loop in array[i]
    }
}

But there are many more methods like Object.values and so on :)

fdemaa
@fdemaa
Jun 23 2017 05:03
you do concats[i].firstName,
@zackbiernat
thats how you acces
CallMeOrange
@EgnaroDev
Jun 23 2017 05:03
How am I supposed to increment/decrease in statement?
Ogundele Olumide
@Lumexralph
Jun 23 2017 05:03
@sudeepnarkar just assign the parameter to gear variable, it only exists in the constructor when an instance of it myCar it's created with just 2 methods getGear, setGear but both methods have access to the gear variable in the constructor, it's private because it can only be accessed by the methods
@zackbiernat are you trying to solve profile lookup challenge ?
kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:04
@MCTwoDigitZero The problem with having it initialized inside is...
  1. If global, by assigning a value to count inside, count's value will reset every time you call function.
  2. If local, count is no more once function done.
Ogundele Olumide
@Lumexralph
Jun 23 2017 05:04
@zackbiernat contacts is an array of objects
CallMeOrange
@EgnaroDev
Jun 23 2017 05:05
@kumquatfelafel you are right.. I was thinking how to use variable from outside
But If I use count inside while that variable is outside would that work?
It was undefined
Zack
@zackbiernat
Jun 23 2017 05:05
@Lumexralph I understand that but how can I search through the array of objects? contacts[i][j] is not appropriate
CallMeOrange
@EgnaroDev
Jun 23 2017 05:06
never mind that actually works @kumquatfelafel
now the problem is how to increase / decrement
Claudio Restifo
@Marmiz
Jun 23 2017 05:07
@zackbiernat for..in is great to access Object properties in loop:
shamelessly stolen from MDN
var obj = {a: 1, b: 2, c: 3};

for (var prop in obj) {
  console.log(`obj.${prop} = ${obj[prop]}`);
}

// Output:
// "obj.a = 1"
// "obj.b = 2"
// "obj.c = 3"
CallMeOrange
@EgnaroDev
Jun 23 2017 05:08
var count = 0;

function cc(card) {
  if (card >= 2 && card < 6) count += "5 Bet";
 else if (card >= 7 && card < 9) count -= "0 Hold";
 else if (card >= 10, 'J', 'Q', 'K', 'A') count =  "-5 Hold";

  return count;
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc(2); cc('J');
fdemaa
@fdemaa
Jun 23 2017 05:08
@Marmiz claudio i dont remember reading about for in , in the basics of js, or im wrong?
Zack
@zackbiernat
Jun 23 2017 05:09
@fdemaa @Marmiz right that is my issue
Cathy
@cathypchui
Jun 23 2017 05:09
thanks @Lumexralph
CamperBot
@camperbot
Jun 23 2017 05:09
cathypchui sends brownie points to @lumexralph :sparkles: :thumbsup: :sparkles:
:star2: 1989 | @lumexralph |http://www.freecodecamp.com/lumexralph
abraham anak agung
@padunk
Jun 23 2017 05:10
@MCTwoDigitZero count won't work with text. use number instead
CallMeOrange
@EgnaroDev
Jun 23 2017 05:10
So im not supposed to use count?
oh you meant by increment / decrement
This message was deleted
abraham anak agung
@padunk
Jun 23 2017 05:10
yes
CallMeOrange
@EgnaroDev
Jun 23 2017 05:10
So no text? just number
Zack
@zackbiernat
Jun 23 2017 05:11
function lookUpProfile(firstName, prop){
for (var i = 0; i < contacts.length; i++){
if (firstName == contacts[i].firstName){
for (var j = 0; j < contacts[i].length; j++){
if (prop == contacts[i][j]){
return contacts[i][j];
}
else {
return "No such property";
}
}
}
else {
return "No such contact";
}
}
How do I share code in a clean way in this chat?
abraham anak agung
@padunk
Jun 23 2017 05:12
use backticks ``` @zackbiernat
CallMeOrange
@EgnaroDev
Jun 23 2017 05:13
 if (card >= 2 && card < 6) { 
    +1 = "Bet";
  }
fdemaa
@fdemaa
Jun 23 2017 05:13
you have to use count and calculate the value it will have depending , on the conditions And when you finish that, return the final count plus the strings "hold" or "bet"
CallMeOrange
@EgnaroDev
Jun 23 2017 05:13
Like that?
Zack
@zackbiernat
Jun 23 2017 05:13
@padunk is that like an apostrophe? '
CallMeOrange
@EgnaroDev
Jun 23 2017 05:13
Yeah if bet add one but if hold decrease/leave it
kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:13
@MCTwoDigitZero When card 2-6, count increases by one. That's it. You don't really need to say whether you bet or hold yet. Bet/hold is dependent upon the accumulated value of count over n function calls. So, for example, if after calling function 8 times, and the last time card was 5... if count is -3, I hold.
abraham anak agung
@padunk
Jun 23 2017 05:14
@MCTwoDigitZero if var count = 0 how you increment it to 1
Zack
@zackbiernat
Jun 23 2017 05:14
function lookUpProfile(firstName, prop){ // Only change code below this line for (var i = 0; i < contacts.length; i++){ if (firstName == contacts[i].firstName){ for (var j = 0; j < contacts[i].length; j++){ if (prop == contacts[i][j]){ return contacts[i][j]; } else { return "No such property"; } } } else { return "No such contact"; } }
CallMeOrange
@EgnaroDev
Jun 23 2017 05:14
@padunk count + 1?
kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:14
@MCTwoDigitZero yup. count = count + 1, or count +=1 or count++
CallMeOrange
@EgnaroDev
Jun 23 2017 05:15
of course..
kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:15
any of those'll do.
CallMeOrange
@EgnaroDev
Jun 23 2017 05:15
Been a while since I did increment
fdemaa
@fdemaa
Jun 23 2017 05:15
@zackbiernat you dont have to use the second loop, you are not targeting nested arrays, you have nested obj, you want to acces with the dot or bracket notation
CallMeOrange
@EgnaroDev
Jun 23 2017 05:15
so count++ means count + 1 right?
Ashish Patel
@ashishjiit
Jun 23 2017 05:15

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for(var i=0;i<arr.length;i++)
for(var j=0;j<arr[i].lenth;j++)
{
product =product*arr[i][j];

  }

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

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);
//multiplyAll([1,2]);

what is output
hi all where is problem ?
Arindam Biswas
@Arindam0507
Jun 23 2017 05:16

// Declare your variable here

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

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
CallMeOrange
@EgnaroDev
Jun 23 2017 05:16
@kumquatfelafel what will I do with string?
Arindam Biswas
@Arindam0507
Jun 23 2017 05:16
Help
Manish Giri
@Manish-Giri
Jun 23 2017 05:16
@ashishjiit output should be product of all numbers..
fdemaa
@fdemaa
Jun 23 2017 05:16
@zackbiernat
``function lookUpProfile(firstName, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++){
  if (firstName == contacts[i].firstName){ 
    for (var j = 0; j < contacts[i].length; j++){ /* delete this */
      if (prop == contacts[i][j]){ /* this*/
        return contacts[i][j];
      }
      else {
        return "No such property";
      }
    }
  }
  else {
    return "No such contact";
  }
}
Kenneth
@recypher-zz
Jun 23 2017 05:17
Hey is there anyway that I can pull someone aside really quickly and have some help with this problem that I am working on?
Arindam Biswas
@Arindam0507
Jun 23 2017 05:18

```

// Declare your variable here

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

// Only change code above this line
function fun2() {
var output = "";
if (typeof myGlobal != "undefined") {
output += "myGlobal: " + myGlobal;
}
if (typeof oopsGlobal != "undefined") {
output += " oopsGlobal: " + oopsGlobal;
}
console.log(output);
}

```

Help

fdemaa
@fdemaa
Jun 23 2017 05:18
@zackbiernat you also need to use .hasOwnProperty
Zack
@zackbiernat
Jun 23 2017 05:18
@fdemaa that's what I need. thanks
CamperBot
@camperbot
Jun 23 2017 05:18
zackbiernat sends brownie points to @fdemaa :sparkles: :thumbsup: :sparkles:
:cookie: 287 | @fdemaa |http://www.freecodecamp.com/fdemaa
fdemaa
@fdemaa
Jun 23 2017 05:18
@zackbiernat np!
Manish Giri
@Manish-Giri
Jun 23 2017 05:18
@recypher-zz what problem?
Kenneth
@recypher-zz
Jun 23 2017 05:19
@Manish-Giri It's the one where you have to capitalize the first letter of each word including connectors
Manish Giri
@Manish-Giri
Jun 23 2017 05:19
@recypher-zz Title case?
Kenneth
@recypher-zz
Jun 23 2017 05:19
@Manish-Giri Yeah
Manish Giri
@Manish-Giri
Jun 23 2017 05:19
okay
got it
Kenneth
@recypher-zz
Jun 23 2017 05:20
@Manish-Giri I got the string split into an array
Manish Giri
@Manish-Giri
Jun 23 2017 05:20
what's the issue
Arindam Biswas
@Arindam0507
Jun 23 2017 05:20
What am i doing wrong, please help
Kenneth
@recypher-zz
Jun 23 2017 05:20
@Manish-Giri but from there I can't figure out how I should go about running with the rest
like i know I can use a for loop to iterate through the entire array but I can't for the life of me figure out how to targe that first letter
Manish Giri
@Manish-Giri
Jun 23 2017 05:20
@recypher-zz okay so if this is the array - ["hello", "world"]
Kenneth
@recypher-zz
Jun 23 2017 05:21
okay
Manish Giri
@Manish-Giri
Jun 23 2017 05:21
when you loop through it
kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:21

@MCTwoDigitZero There is count++ and ++count. count++ is called post-increment, and will add 1 after rest of line executes. ++count is pre-increment, and will add 1 before rest of line executes. (sorry, not great explanation. Getting pretty tired)

For example, say we have a string, str, and initialize some var i = 1. str.substr(++i) will add one to i (so i becomes 2), then pass 2 to substr function. str.substr(i++) will pass 1 to substr function, then add one to i afterwards.

Manish Giri
@Manish-Giri
Jun 23 2017 05:21
arr[0] will be the first word, when i is 0
so arr[0] is "hello"
Kenneth
@recypher-zz
Jun 23 2017 05:21
okay
Manish Giri
@Manish-Giri
Jun 23 2017 05:22
and you can get the first letter h with arr[0][0] or arr[0].charAt(0)
CallMeOrange
@EgnaroDev
Jun 23 2017 05:22
@kumquatfelafel I know about ++ operator but I dont know substr method yet
If I used it where am I supposed to put string?
Kenneth
@recypher-zz
Jun 23 2017 05:22
so if i split it into an array with say like the variable capitalFirst.split("");
sorry
wrong thing
var capitalFirst = str.split(" ");
Manish Giri
@Manish-Giri
Jun 23 2017 05:23
yeah
Kenneth
@recypher-zz
Jun 23 2017 05:23
I could do something like capitalFirst.charAt(0) while iteratting through it?
kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:23
@MCTwoDigitZero Was just example for difference between ++ and ++. don't worry, it will come in later challenges (basically, it allows you to get a portion of original string)
Manish Giri
@Manish-Giri
Jun 23 2017 05:24
no
CallMeOrange
@EgnaroDev
Jun 23 2017 05:24
@kumquatfelafel alright, so I used count = count++ where do I keep string?
Manish Giri
@Manish-Giri
Jun 23 2017 05:24
charAt is a string function
CallMeOrange
@EgnaroDev
Jun 23 2017 05:24
Like "Bet"
Manish Giri
@Manish-Giri
Jun 23 2017 05:24
so you don't need to split the word into an array of letters
you can use it directly
Kenneth
@recypher-zz
Jun 23 2017 05:25
could you possibly use it in like an example?
like how it should be set up
CallMeOrange
@EgnaroDev
Jun 23 2017 05:26
@kumquatfelafel can I use this? count += "Bet";
Markus Ivancsics
@ivancsicsmarkus
Jun 23 2017 05:26
@MCTwoDigitZero Yes, of course.
abraham anak agung
@padunk
Jun 23 2017 05:26
@MCTwoDigitZero you can combine the result of your count with word, bet, or hold
Kenneth
@recypher-zz
Jun 23 2017 05:26
@Manish-Giri So if I split the words into seperate sections of the array
CallMeOrange
@EgnaroDev
Jun 23 2017 05:26
@padunk so that way works?
Kenneth
@recypher-zz
Jun 23 2017 05:27
I can access the first character with .charAt(0) ?
Manish Giri
@Manish-Giri
Jun 23 2017 05:27
CallMeOrange
@EgnaroDev
Jun 23 2017 05:28
var count = 0;

function cc(card) {
  if (card >= 2 && card <= 6) { 
    count += "Bet";
  }
 else if (card >= 7 && card <= 9) {
   count = "Hold";
 } else {
  return "-5 Hold";
 }
return count;
}


cc(2); cc(3); cc(7); cc(2); cc('J');
Kenneth
@recypher-zz
Jun 23 2017 05:28
yeah that's what I was getting at
kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:28
@MCTwoDigitZero small warning. They want there to be a space between number and word. But more or less.
Kenneth
@recypher-zz
Jun 23 2017 05:28
I just didn't know how to put it in the proper terms
kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:28
@MCTwoDigitZero wait. actually no
CallMeOrange
@EgnaroDev
Jun 23 2017 05:28
What is it?
abraham anak agung
@padunk
Jun 23 2017 05:28
@MCTwoDigitZero so if count result is 5 return 5 Bet if -5 return -5 Hold
CallMeOrange
@EgnaroDev
Jun 23 2017 05:28
So add if statement for that?
abraham anak agung
@padunk
Jun 23 2017 05:29
you have to count it first than later return the result
CallMeOrange
@EgnaroDev
Jun 23 2017 05:29
I dont understand
Arindam Biswas
@Arindam0507
Jun 23 2017 05:29

// Declare your variable here


function fun1() {
  // Assign 5 to oopsGlobal Here

}

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
Can someone please help me
CallMeOrange
@EgnaroDev
Jun 23 2017 05:29
Didnt I count it then return in last bracket?
@Arindam0507 do what comments say
Manish Giri
@Manish-Giri
Jun 23 2017 05:30
@Arindam0507 problem?
Arindam Biswas
@Arindam0507
Jun 23 2017 05:30
javascript
Global Scope and Functions
@Manish-Giri
abraham anak agung
@padunk
Jun 23 2017 05:31
@MCTwoDigitZero no. i told you count the card with number first. than later combine it with word
Manish Giri
@Manish-Giri
Jun 23 2017 05:31
I meant what's the problem?
@Arindam0507
abraham anak agung
@padunk
Jun 23 2017 05:31
@Arindam0507 what is your goal
Matthew
@muzcmancoder91
Jun 23 2017 05:31
Can anyone help me get started? I've tried a few things but I think my exhaustion is getting to me.
Arindam Biswas
@Arindam0507
Jun 23 2017 05:31
i dont know what the challange is asking me to do
Matthew
@muzcmancoder91
Jun 23 2017 05:31

You will need to use string operators to build a new string, result, using the provided variables: myNoun, myAdjective, myVerb, and myAdverb.

You will also need to use additional strings, which will not change, and must be in between all of the provided words. The output should be a complete sentence.

Arindam Biswas
@Arindam0507
Jun 23 2017 05:31
@padunk @Manish-Giri
Matthew
@muzcmancoder91
Jun 23 2017 05:32
wordBlanks("dog", "big", "ran", "quickly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
wordBlanks("cat", "little", "hit", "slowly") should contain all of the passed in words separated by non-word characters (and any additional words in your madlib).
Manish Giri
@Manish-Giri
Jun 23 2017 05:32
@Arindam0507 challenge url?
abraham anak agung
@padunk
Jun 23 2017 05:32
@Arindam0507 well, i think you need to declare your variable first in global scope.
Matthew
@muzcmancoder91
Jun 23 2017 05:33
I think I am getting confused on the addtional strings
CallMeOrange
@EgnaroDev
Jun 23 2017 05:33
@padunk sorry I think Im too tired for this but at least you got me this far, thanks
CamperBot
@camperbot
Jun 23 2017 05:33
mctwodigitzero sends brownie points to @padunk :sparkles: :thumbsup: :sparkles:
Manish Giri
@Manish-Giri
Jun 23 2017 05:33

@Arindam0507

Using var, declare a global variable myGlobal outside of any function. Initialize it with a value of 10.

CamperBot
@camperbot
Jun 23 2017 05:33
:cookie: 358 | @padunk |http://www.freecodecamp.com/padunk
Manish Giri
@Manish-Giri
Jun 23 2017 05:33
first is this
kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:34
@MCTwoDigitZero remember, count is global variable. When you say count += "Bet", here is what happens. Say first time we get 4... so count would become 1 Bet. Then we call function again... say card is 2. Remember, count is, at moment, 1 Bet. Then when we say count += "Bet", this becomes 1 Bet Bet. Actually looking at your code, you aren't really incrementing count at all. count is a number, and only a number. The second you make this variable something else, it will break your code.
Manish Giri
@Manish-Giri
Jun 23 2017 05:36
@muzcmancoder91 you need to form a string, and assign it to result, using string concatenation (+). The string has to be formed by concatenating the four parameters in your function - myNoun, myAdjective, etc, along with spaces and (optionally) some words of your own - to form a coherent sentence.
Matthew
@muzcmancoder91
Jun 23 2017 05:36
Thank you @Manish-Giri
CamperBot
@camperbot
Jun 23 2017 05:36
muzcmancoder91 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6094 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jun 23 2017 05:37
:+1:
Innocent Tauzeni
@Telthem89
Jun 23 2017 05:37

<p data-height="265" data-theme-id="0" data-slug-hash="rwMwrp" data-default-tab="css,result" data-user="Telthem92" data-embed-version="2" data-pen-title="rwMwrp" class="codepen">See the Pen <a href="https://codepen.io/Telthem92/pen/rwMwrp/">rwMwrp</a> by Innocent Tauzeni (<a href="https://codepen.io/Telthem92">@Telthem92</a>) on <a href="https://codepen.io">CodePen</a>.</p>

<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>

Arindam Biswas
@Arindam0507
Jun 23 2017 05:37

// Declare your variable here

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

// Only change code above this line
function fun2() {
  var output = "";
  if (typeof myGlobal != "undefined") {
    output += "myGlobal: " + myGlobal;
  }
  if (typeof oopsGlobal != "undefined") {
    output += " oopsGlobal: " + oopsGlobal;
  }
  console.log(output);
}
@Manish-Giri
javascript is damn hard :worried:
Manish Giri
@Manish-Giri
Jun 23 2017 05:38
@Arindam0507 if you put quotes around numbers
it becomes strings
Arindam Biswas
@Arindam0507
Jun 23 2017 05:38
oops sorry,
Thanks, man I was doing it correct all the time just silly mistakes. @Manish-Giri
CamperBot
@camperbot
Jun 23 2017 05:39
arindam0507 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6095 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Jun 23 2017 05:39
np
Innocent Tauzeni
@Telthem89
Jun 23 2017 05:39

if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(position){
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;

   //alert(lon +"  "+ lat );

   var api = "https://api.openweathermap.org/data/2.5/weather?lat="+latitude+"&lon="+longitude+"&appid=044f4a71b5947dbcfcd90c4c3aa5a4b9";
   $.getJSON(api, function(data){

       //show current temperature
       var inno = Math.round(data.main.temp-273);

       //console.log(inno);
       $('#location').html(data.name+","+data.sys.country);
       $('#imgr').html('<img src=' +"https://api.openweathermap.org/img/w/"+ data.weather[0].icon+".png" +'>'+data.weather[0].description);
    $('#temp').html("Temperature" + inno + 'C');
    $('#hum').html("Humidity"  +" "+ data.main.humidity+ "%");

    //change  celsus to fahrenhheit

    $('#fah').click(function(){
        $('#clad').removeClass('dat');
        $('this').addClass('dat');
        $('#temp').html(Math.round(inno*1.8+32));
    });
 });

   //show the current date and time
   var current = $.now();
   var innoDate = new Date(current);
   var currentDate = innoDate.toString();
   $('#date').html(currentDate);

});

} help guys this code is kicking me out on codepen but on my localhost is working and it shows my local wheather bt here is not why help

kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:39

@MCTwoDigitZero You can add two variables in a return statement by the way.
e.g.

var str1 = "blah";
var str2 = "blah"; 
return str1 + str2; //returns "blahblah"

In this case, it's two strings, but it doesn't have to be.

Note that neither str1 nor str2 is actually being assigned a new value here.

Manish Giri
@Manish-Giri
Jun 23 2017 05:39
@Arindam0507 you bengali?
Arindam Biswas
@Arindam0507
Jun 23 2017 05:40
Yup
@Manish-Giri
Manish Giri
@Manish-Giri
Jun 23 2017 05:40
nice
me too
@Arindam0507
Arindam Biswas
@Arindam0507
Jun 23 2017 05:40
That's cool @Manish-Giri
Kelechi Chinaka
@ke1echi
Jun 23 2017 05:43
@Manish-Giri i need "Sam Harris" to be S.H
do i need split before i use charAt
Manish Giri
@Manish-Giri
Jun 23 2017 05:44
you don't need split
Manoj kumar
@Manojkumarjala
Jun 23 2017 05:44
can any one help me out with the challenge "Escape sequence in Strings" plzzz
Manish Giri
@Manish-Giri
Jun 23 2017 05:44
you can just build out a string with the first letters
using charAt
@kelechichinaka
Ogundele Olumide
@Lumexralph
Jun 23 2017 05:45
@Manojkumarjala what do you have?
Innocent Tauzeni
@Telthem89
Jun 23 2017 05:45
help me guys
Ogundele Olumide
@Lumexralph
Jun 23 2017 05:45
@Manish-Giri :smiling_imp:
Manish Giri
@Manish-Giri
Jun 23 2017 05:45
@Lumexralph ggggmmm :smiling_imp:
Ogundele Olumide
@Lumexralph
Jun 23 2017 05:45
@kelechichinaka bro!
@Telthem89 with what?
Innocent Tauzeni
@Telthem89
Jun 23 2017 05:45
help please may you go through my code above
Ogundele Olumide
@Lumexralph
Jun 23 2017 05:45
@Manish-Giri how're you?
Innocent Tauzeni
@Telthem89
Jun 23 2017 05:46

if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(position){
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;

   //alert(lon +"  "+ lat );

   var api = "https://api.openweathermap.org/data/2.5/weather?lat="+latitude+"&lon="+longitude+"&appid=044f4a71b5947dbcfcd90c4c3aa5a4b9";
   $.getJSON(api, function(data){

       //show current temperature
       var inno = Math.round(data.main.temp-273);

       //console.log(inno);
       $('#location').html(data.name+","+data.sys.country);
       $('#imgr').html('<img src=' +"https://api.openweathermap.org/img/w/"+ data.weather[0].icon+".png" +'>'+data.weather[0].description);
    $('#temp').html("Temperature" + inno + 'C');
    $('#hum').html("Humidity"  +" "+ data.main.humidity+ "%");

    //change  celsus to fahrenhheit

    $('#fah').click(function(){
        $('#clad').removeClass('dat');
        $('this').addClass('dat');
        $('#temp').html(Math.round(inno*1.8+32));
    });
 });

   //show the current date and time
   var current = $.now();
   var innoDate = new Date(current);
   var currentDate = innoDate.toString();
   $('#date').html(currentDate);

});

}

Manoj kumar
@Manojkumarjala
Jun 23 2017 05:46
@Lumexralph var myStr="Firstline\n\Secondline\rThirdline"; not working bro
Kelechi Chinaka
@ke1echi
Jun 23 2017 05:46
:wave: @Lumexralph
Manish Giri
@Manish-Giri
Jun 23 2017 05:46
@Lumexralph solving some codewars challenges
exhausting
kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:46
@Manojkumarjala backslash = \\, second new line is not \n but \r. This was written preemptively... I see you have the \r fine. But you need to capital L. And your backslash is wrong. \\ not \ You need two to let it know, "treat this backslash as a backslash, not an escape character"
Ogundele Olumide
@Lumexralph
Jun 23 2017 05:46
@Manojkumarjala ThirdLine
@Manojkumarjala change the l to L in all the strings
@Manish-Giri very, some you'll just let go
Innocent Tauzeni
@Telthem89
Jun 23 2017 05:48
help
Kelechi Chinaka
@ke1echi
Jun 23 2017 05:51
how's work @Lumexralph
kumquatfelafel
@kumquatfelafel
Jun 23 2017 05:51
that's it for me. g'night
abraham anak agung
@padunk
Jun 23 2017 05:56
@Telthem89 did openweathermap have https api now?
Arindam Biswas
@Arindam0507
Jun 23 2017 05:56

function myLocalScope() {
  'use strict';

  var myVar="a";
  console.log(myVar);
}
myLocalScope();
var myVar = "abc";
// 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
help
Innocent Tauzeni
@Telthem89
Jun 23 2017 05:57
@padunk yeah
danskeerththana
@danskeerththana
Jun 23 2017 05:58
help ?
Do not change code above the line
a should have a value of 7
b should have a value of 7
a should be assigned to b with =
Manish Giri
@Manish-Giri
Jun 23 2017 05:59
@danskeerththana code?
danskeerththana
@danskeerththana
Jun 23 2017 06:00
// Setup
var a = 7;
var b = 7;
var a = var b;
// Only change code below this line
Manish Giri
@Manish-Giri
Jun 23 2017 06:00
var a = var b;
this assigns b to a
you need to assign a to b
the opposite
and var is only used to declare a variable, the first time
Ogundele Olumide
@Lumexralph
Jun 23 2017 06:01
@kelechichinaka work is good, thanks
CamperBot
@camperbot
Jun 23 2017 06:01
lumexralph sends brownie points to @kelechichinaka :sparkles: :thumbsup: :sparkles:
:cookie: 284 | @kelechichinaka |http://www.freecodecamp.com/kelechichinaka
Manish Giri
@Manish-Giri
Jun 23 2017 06:01
so after this
var b = 7;
you just do a = b
Naveed Patel
@leographics1983
Jun 23 2017 06:02
\
\
Varun Wilson
@vrnwlsn
Jun 23 2017 06:02
hi can someone help me with javascript?
Arindam Biswas
@Arindam0507
Jun 23 2017 06:02
@Manish-Giri help
Naveed Patel
@leographics1983
Jun 23 2017 06:03
@vrnwlyes
@vrnwlsn yess
Arindam Biswas
@Arindam0507
Jun 23 2017 06:03
@leographics1983 help
Manish Giri
@Manish-Giri
Jun 23 2017 06:03
@Arindam0507 link the URL
Arindam Biswas
@Arindam0507
Jun 23 2017 06:03

```

function myLocalScope() {
'use strict';

var myVar="a";
console.log(myVar);
}
myLocalScope();
var myVar = "abc";
// 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

```
help

Naveed Patel
@leographics1983
Jun 23 2017 06:05
read the text Arindam
its about local and global varibles
Arindam Biswas
@Arindam0507
Jun 23 2017 06:05
I don't get javascript
abraham anak agung
@padunk
Jun 23 2017 06:06
@Arindam0507 just delete console.log
Naveed Patel
@leographics1983
Jun 23 2017 06:06
dont start random than
Arindam Biswas
@Arindam0507
Jun 23 2017 06:06
should i learn javascript first and then continue fcc
Naveed Patel
@leographics1983
Jun 23 2017 06:06
start from the begining
what is fcc
Manish Giri
@Manish-Giri
Jun 23 2017 06:06
@Arindam0507 try doing the JS lessons on codeacademy first
Arindam Biswas
@Arindam0507
Jun 23 2017 06:06
@padunk i did that it doesn't help
@leographics1983 I did it from the start.
Ian V.
@jansolote
Jun 23 2017 06:07
hmm really need help with this one please
abraham anak agung
@padunk
Jun 23 2017 06:07
@Arindam0507 it did. don't declare your variable outside the function
Sanket Chaudhari
@sanket143
Jun 23 2017 06:07

I am asked to find factorial of a number and I've done this rightly but did not accepted ... I did it like this

var i;
var fast =[];
product=1;

function factorialize(num) {
  if(num>0){
  var ghr= num;
  for(i=1;i<=ghr;i++){
    fast.push(i);
  }
  for(i=0;i<fast.length;i++){
    product=product*fast[i];
    num = product;
 }
  return num;
  }
  else if(num=='0') {
    return '1';
    }
  else {
    return "Factorial not possible";
  }
}

factorialize(20);// to gives var i;
var fast =[];
product=1;

function factorialize(num) {
  if(num>0){
  var ghr= num;
  for(i=1;i<=ghr;i++){
    fast.push(i);
  }
  for(i=0;i<fast.length;i++){
    product=product*fast[i];
    num = product;
 }
  return num;
  }
  else if(num=='0') {
    return '1';
    }
  else {
    return "Factorial not possible";
  }
}

factorialize(20); //to give 2432902008176640000 (as shown)
factorialize(5);//120
factorialize(10);//3628800
factorialize(0);//1

what's wrong in my code ... why am not accepted

Naveed Patel
@leographics1983
Jun 23 2017 06:07
ya realy
Arindam Biswas
@Arindam0507
Jun 23 2017 06:07
@Manish-Giri What about w3schools.com @Manish-Giri
Manish Giri
@Manish-Giri
Jun 23 2017 06:08
@Arindam0507 never really used it
Naveed Patel
@leographics1983
Jun 23 2017 06:08
w3schools is also good
Manish Giri
@Manish-Giri
Jun 23 2017 06:08
I hear it's outdated
Ogundele Olumide
@Lumexralph
Jun 23 2017 06:08
@sanket143 make all your variables local to your function.
Naveed Patel
@leographics1983
Jun 23 2017 06:08
so what, it will give a better understanding
Grigor Minasyan
@gogminsam
Jun 23 2017 06:08
Guys i need help in this if statement function confirmEnding(str, target) { // "Never give up and good luck will find you." // -- Falcor if(str.substr(str.length-target.length, target.length) == target) { return true; } else { return false; } } confirmEnding("Bastian", "n");
Arindam Biswas
@Arindam0507
Jun 23 2017 06:08
@Manish-Giri codeacademy is it good.
Claudio Restifo