These are chat archives for FreeCodeCamp/HelpJavaScript

10th
May 2017
Vamp
@the-vampiire
May 10 2017 00:00
my function returns 0, -6
says its failing
you_cant_explain_that_Oreilly.jpg
john94
@lpy1994
May 10 2017 00:01
@the-vampiire yours return -6,0
dyon3334
@dyon3334
May 10 2017 00:02
@Blauelf thank!!!
CamperBot
@camperbot
May 10 2017 00:02
dyon3334 sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4097 | @blauelf |http://www.freecodecamp.com/blauelf
Vamp
@the-vampiire
May 10 2017 00:02
...
HeebieGeeBee
@HeebieGeeBee
May 10 2017 00:04

@lpy1994

var sum_pairs = function (ints, s) {
    //your code here
    var arr = [];
    for (var i = 0; i < ints.length; i++) {
        for (var j = i + 1; j < ints.length; j++) {
            ints[i] + ints[j] == s ? arr.push([j,ints[i],ints[j]]): undefined;
        }
    }


    return Array.isArray(arr[0]) ? arr.sort((a,b)=> a[0] - b[0])[0].slice(1): arr[0];

}

did it in a dirty way

Stephen James
@sjames1958gm
May 10 2017 00:05
I would do it with ints.indexOf(s - ints[i]);
To avoid the second loop.
HeebieGeeBee
@HeebieGeeBee
May 10 2017 00:05
passes the sample tests, but doesnt pass the long test
john94
@lpy1994
May 10 2017 00:05
@HeebieGeeBee lol, if you got the answer, you can go ahead and see solutions from somebody else
@HeebieGeeBee they thumbs up on those solutions.
HeebieGeeBee
@HeebieGeeBee
May 10 2017 00:06
@lpy1994 it didnt pass that long test thing
it times out
john94
@lpy1994
May 10 2017 00:06
@HeebieGeeBee ok.
John Edwards
@javajohnHub
May 10 2017 00:07
anyone familiar with smooth scrolling?
Aizaz Shahid
@aizazshahid
May 10 2017 00:08
@javajohnHub ask that in https://gitter.im/FreeCodeCamp/HelpFrontEnd, hopefully someone help you there!
but just for a hint you should to control on the scroll speed !
you can manipulate it easily. @javajohnHub
john94
@lpy1994
May 10 2017 00:12
@HeebieGeeBee @the-vampiire thx for the effort bros, gotta go back to work, come back at night. cheers
CamperBot
@camperbot
May 10 2017 00:12
lpy1994 sends brownie points to @heebiegeebee and @the-vampiire :sparkles: :thumbsup: :sparkles:
:star2: 1607 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
:cookie: 381 | @the-vampiire |http://www.freecodecamp.com/the-vampiire
David Amanze
@GodKingShogun
May 10 2017 00:15
can anyone enlighten me on why my code keeps throwing an error
$("#getW").click(function () {
  on = true;
  axios.get(coord).then((data) => {
    if (data.status != "success") {
      throw new Error("Unable to get latitude and longitude");
    }
    var lat = data.lat;
    var lon = data.lon;
    var weatherMap = `http://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&units=metric&APPID=${id}`;
    return axios.get(weatherMap);
  })
  .then((response) => {
     temp = response.main.temp;
     $("#celsius").html(temp);
  })
  .catch((e) => {
    if (e.cod !== 200) {
$("#celsius").html("Unable to connect with weather ap")
} else {
 $("#celsius").html(e.message);
  }
  });
});
Brittany Rutherford
@brittanyrutherford
May 10 2017 00:15
hi
any good references for ES2015?
telepylus
@telepylus
May 10 2017 00:17
@forwebtech thanks! I solved it, phew :)
CamperBot
@camperbot
May 10 2017 00:17
telepylus sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 468 | @forwebtech |http://www.freecodecamp.com/forwebtech
Aizaz Shahid
@aizazshahid
May 10 2017 00:18
@telepylus :+1:
@brittanyrutherford es6-features.org
telepylus
@telepylus
May 10 2017 00:19
I am moving onto the card counting test now. I tried to work on it, but it is late here now so I will come back to it tomorrow. Any recommendations for reading so that I can solve it by myself?
Stephen James
@sjames1958gm
May 10 2017 00:19
@brittanyrutherford This guy's videos are good - if you can take the boston accent
https://www.youtube.com/playlist?list=PLillGF-RfqbZ7s3t6ZInY3NjEOOX7hsBv
@GodKingShogun What error?
Aizaz Shahid
@aizazshahid
May 10 2017 00:19
@telepylus do you about switch()
telepylus
@telepylus
May 10 2017 00:20
It is mostly switch() yeah?
I was going to use conditionals.
Brittany Rutherford
@brittanyrutherford
May 10 2017 00:20
Thank you @forwebtech @sjames1958gm
CamperBot
@camperbot
May 10 2017 00:20
brittanyrutherford sends brownie points to @forwebtech and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7213 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 469 | @forwebtech |http://www.freecodecamp.com/forwebtech
David Amanze
@GodKingShogun
May 10 2017 00:21
@sjames1958gm @sjames1958gm its not giving me back the temperature
Stephen James
@sjames1958gm
May 10 2017 00:22
@GodKingShogun I think that you need to call response.json() to do json parsing?
David Amanze
@GodKingShogun
May 10 2017 00:24
@sjames1958gm can you show me an example
Aizaz Shahid
@aizazshahid
May 10 2017 00:28
@telepylus there is nothing new regarding codes you just need conditional statements to solve that !
so come tomorrow and try it.
Corey Johnson
@crojohnson
May 10 2017 00:31

anyone familiar with fromCharCode weirdness? I'm trying to return:

return String.fromCharCode(tempArr.join());

where tempArr is an array of Unicode values, and it gives me the red dot in the console. But when I view the values of tempArr and return that instead:

return String.fromCharCode(70,82,69,69,32,67,79,68,69,32,67,65,77,80);

...it works just fine

Stephen James
@sjames1958gm
May 10 2017 00:31
@GodKingShogun
var url = "https://api.github.com/users/sjames1958gm";

fetch(url)
.then(function(response) {return response.json();})
.then(function(user) {
    console.log(user.name);
});
Aizaz Shahid
@aizazshahid
May 10 2017 00:32
@crojohnson did you know what .join() works ?
Stephen James
@sjames1958gm
May 10 2017 00:32
@crojohnson You can use String.fromCharCode.apply(tempArr);
@crojohnson this will take the array and spread it across the parameters.
Corey Johnson
@crojohnson
May 10 2017 00:33
@forwebtech as I undertand it, .join() returns a string of the array's values with commas separating them as the default
Aizaz Shahid
@aizazshahid
May 10 2017 00:33
@crojohnson to sepearte it with commas you need to put .join(",")
but if you don't pass any argument then it will just join all the elements without any space!
Corey Johnson
@crojohnson
May 10 2017 00:35
@forwebtech the documentation says "If [separator is] omitted, the array elements are separated with a comma."
Aizaz Shahid
@aizazshahid
May 10 2017 00:35
@crojohnson let me check ? then !
@crojohnson yes, you are right. So you want to pass the string to .fromCharCode() ?
Corey Johnson
@crojohnson
May 10 2017 00:37
@forwebtech yes, I have an array of unicode values, and I'm trying to pass it as a comma-separated string as the arguments for .fromCharCode()
Yonaton Rose
@yonatonrose
May 10 2017 00:37
I'm confused on how I'm supposed to link the words in the wordBlanks thing at the bottom to my variables in the Word Blanks challenge
Aizaz Shahid
@aizazshahid
May 10 2017 00:37
@crojohnson but the problem is with join(), it makes that array a string. so you can't pass the string to that function, it should be a unicode
Corey Johnson
@crojohnson
May 10 2017 00:38

@sjames1958gm interesting, I hadn't heard of "apply"

but that did not seem to work, either using join or just the array

Aizaz Shahid
@aizazshahid
May 10 2017 00:38
@crojohnson did you try this format ? String.fromCharCode(65, 66, 67); // returns "ABC"
Corey Johnson
@crojohnson
May 10 2017 00:38
@forwebtech sorry, what do you mean by a "code?"
Stephen James
@sjames1958gm
May 10 2017 00:38
@crojohnson You don't want join that gives a string which is not correct.
Aizaz Shahid
@aizazshahid
May 10 2017 00:38
@crojohnson sorry, unicode value.
David Amanze
@GodKingShogun
May 10 2017 00:39
@sjames1958gm @sjames1958gm i need information from the first url's json and then i need to pass it on to the next url to get information to that url's json
Stephen James
@sjames1958gm
May 10 2017 00:39
@crojohnson I always forget the null String.fromCharCode.apply(null, tempArr);
Corey Johnson
@crojohnson
May 10 2017 00:40
@sjames1958gm ah thanks, adding in the null fixed it
CamperBot
@camperbot
May 10 2017 00:40
crojohnson sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 7214 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
May 10 2017 00:40
@GodKingShogun In that second .then you can call axios again
@crojohnson So apply takes an array ([1, 2, 3, 4, 5]) and spreads the values to make (1, 2, 3, 4, 5)
You need null because the first parameter is the context object
Corey Johnson
@crojohnson
May 10 2017 00:41
@forwebtech I did try that format - Stephen James' solution worked though: String.fromCharCode.apply(null, tempArr);
@sjames1958gm that is a neat trick, pretty weird workaround though
HeebieGeeBee
@HeebieGeeBee
May 10 2017 00:42
@sjames1958gm you not a fan of the spread operator?
Aizaz Shahid
@aizazshahid
May 10 2017 00:43
@crojohnson know that !
Nick Forlivio
@whackdev
May 10 2017 00:50
Any ideas why my reverse geoloaction isn't pulling through? I've tested the API url in my browser and can read the data but its not coming through to my variables
var geoLoc = {};

if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(success,error);
}
else {
alert('Geolocation is not supported');
}
function error() {
alert("That's weird! We couldn't find you!");
}
function success(position) {
      geoLoc.lat = position.coords.latitude;
      geoLoc.lng = position.coords.longitude;
      getWeather(geoLoc.lat, geoLoc.lng);
}
function getWeather(lat, long) {
var key = '67453fda965fa980028f86adc86cb485';
var Weather = "https://api.darksky.net/forecast/" + key + "/" + lat + "," + long;

$.ajax({url: Weather, dataType: "jsonp",
success: function(data) {
  changeDOM(data);
}
  });
}
function changeDOM(data) {
  var tempF = data['currently']['temperature'];
  var conditions = data['currently']['summary'];
  var Lat = data['latitude'];
  var Long = data['longitude'];
  var location = getGeo(Lat, Long);

  // Make changes
  $('#location').html(location);
  $('#temp').html(tempF);
  $('#conditions').html(conditions);
}
function getGeo(Lat, Long) {
  var geoKey = 'AIzaSyCnzVX-lvkhHwnZNFz7aB7YBi9nsKfAfpE'
  var geoReq = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' + Lat + ',' + Long + '&key=' + geoKey;
  console.log(geoReq);
  $.ajax({url: geoReq, dataType: "json",
    success: function(data) {
      var status = data['status'];
      var city = data['results']['address_components'][2]['short_name'] + ', ';
      var state = data['results']['address_components'][5]['short_name'];
      var location = city + state;
      console.log(status);
      console.log(city);
      console.log(state);
      console.log(location);
      return location; 
    }
   });
}
Joseph
@Aerofils
May 10 2017 00:51
Hey guys im on the celsisus to fahrenheit converter and I dont understand anything
Like absolutely 0. im trying to write the formula in but keep failing for some reason
Nick Forlivio
@whackdev
May 10 2017 00:51
@Aerofils try writing it out in psuedocode, the steps are in the explanation
Joseph
@Aerofils
May 10 2017 00:54
pseudocode?
Aizaz Shahid
@aizazshahid
May 10 2017 00:54
@Aerofils show the code ?
HeebieGeeBee
@HeebieGeeBee
May 10 2017 00:54
@whackdev you got this in a codepen?
Joseph
@Aerofils
May 10 2017 00:54
Im actually truly lost
no idea what im doing
Aizaz Shahid
@aizazshahid
May 10 2017 00:54
its better to paste the code here.
Joseph
@Aerofils
May 10 2017 00:54

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

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

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

Aizaz Shahid
@aizazshahid
May 10 2017 00:55
@Aerofils you need to do celsius multiply by (9/5) then add 32 to it
Yonaton Rose
@yonatonrose
May 10 2017 00:55
Screen Shot 2017-05-09 at 8.54.51 PM.png
Screen Shot 2017-05-09 at 8.54.51 PM.png
Aizaz Shahid
@aizazshahid
May 10 2017 00:56
@Aerofils in programming % modulus operator is used to get the remainder.
Yonaton Rose
@yonatonrose
May 10 2017 00:56
How do I link the wordBlanks() to the variables to get it to work without just inserting the words into the strings?
sorry i did that twice
Aizaz Shahid
@aizazshahid
May 10 2017 00:56
@yonatonrose use the parameters myNoun, ...
Joseph
@Aerofils
May 10 2017 00:56
@forwebtech thanks a lot man
CamperBot
@camperbot
May 10 2017 00:56
aerofils sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 470 | @forwebtech |http://www.freecodecamp.com/forwebtech
Aizaz Shahid
@aizazshahid
May 10 2017 00:56
@yonatonrose those parameters are already defined in your function parenthesis ()
@Aerofils :+1:
Yonaton Rose
@yonatonrose
May 10 2017 00:57
oh wow ur right thanks @forwebtech lol
CamperBot
@camperbot
May 10 2017 00:57
yonatonrose sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 471 | @forwebtech |http://www.freecodecamp.com/forwebtech
Aizaz Shahid
@aizazshahid
May 10 2017 00:57
@yonatonrose :+1:
Joseph
@revisualize
May 10 2017 00:57
Hello.
@yonatonrose Don't overwrite your parameters
Moisés Man
@moigithub
May 10 2017 00:59
@whackdev console.log(data) should help
results is an array of objects
'address_components' is a property of that object element (which also is an array)
Landon Benell
@LandonBenell
May 10 2017 01:01
Hey I'm in the JavaScript section and I'm stuck on the converting Fahrenheit part if anyone has time to assist. I don't= really know where to start really.
Long Nguyen
@longnt80
May 10 2017 01:01

@whackdev

var Lat = data['latitude'];
var Long = data['longitude'];

are you trying to use these variables with the function getGeo(Lat, Long)?

Aizaz Shahid
@aizazshahid
May 10 2017 01:02
@LandonBenell there is a formula written for you in the instructions !
TayCodes
@TayCodes
May 10 2017 01:02

Hello could someone tell me why my function is not returning name please var name = prompt("Ur name?");
var yob = prompt ("Ur year of birth");

//function ytire (name, yob) {
//var ret = parseInt(yob)+ 65;
// return ret;
//}document.write("U were born in "+ yob+". U wil retire in "+ ytire (name, yob));

function ytir (name, yob) {
var age = cal(yob);
var ret = 65-age;

return ret + name;

}
document.write(name + " retires in" +ret);
ytir ("Jane", 1970);

Aizaz Shahid
@aizazshahid
May 10 2017 01:03

@TayCodes
:bulb: To format your code, please follow:

Code Formatting

More details..

:bulb: To get more commands:

ctrl + shift + m

@TayCodes first format your code, edit it !
Christopher McCormack
@cmccormack
May 10 2017 01:04

@forwebtech curious - why use image?

```
put your code here
```

tech-tron
@tech-tron
May 10 2017 01:04
i have an object with two properties ball = {shape: "round", color: "red"} but its saying ball.keys() is not a function
Yonaton Rose
@yonatonrose
May 10 2017 01:04
alright, so although my statement comes out fine, im still not passing the challenge. How do I solve the Word Blanks challenge?
Aizaz Shahid
@aizazshahid
May 10 2017 01:05
@cmccormack because ``` backticks won't show if i type like that :)
Christopher McCormack
@cmccormack
May 10 2017 01:05
@forwebtech are mine not showing?
Aizaz Shahid
@aizazshahid
May 10 2017 01:06
hmm how ?
Christopher McCormack
@cmccormack
May 10 2017 01:06
\```
Landon Benell
@LandonBenell
May 10 2017 01:06
@forwebtech I know, but I'm having trouble putting it to use, I just started javascript today
Long Nguyen
@longnt80
May 10 2017 01:06
@yonatonrose are you sure there's no error?
Aizaz Shahid
@aizazshahid
May 10 2017 01:06
@cmccormack exactly i thinking about escaping it :D but thanks !
CamperBot
@camperbot
May 10 2017 01:06
:cookie: 546 | @cmccormack |http://www.freecodecamp.com/cmccormack
forwebtech sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
Yonaton Rose
@yonatonrose
May 10 2017 01:06
no error shows up im just not completing the challenges
Screen Shot 2017-05-09 at 9.06.15 PM.png
Long Nguyen
@longnt80
May 10 2017 01:07
@yonatonrose what do you meant not completing? some requirements are not met?
Aizaz Shahid
@aizazshahid
May 10 2017 01:07
@LandonBenell find the backtick key on your keyboard
TayCodes
@TayCodes
May 10 2017 01:07
https://codepen.io/dev999/pen/zwRoKL Why is my function not returning name please?
Yonaton Rose
@yonatonrose
May 10 2017 01:08
Screen Shot 2017-05-09 at 9.07.45 PM.png
yes two of the requirements are not met
sorry for my confusing language
Aizaz Shahid
@aizazshahid
May 10 2017 01:09
@yonatonrose space needed between those parameters.
Yonaton Rose
@yonatonrose
May 10 2017 01:10
how do I do that?
Moisés Man
@moigithub
May 10 2017 01:10
WHAT is cal ??
var age = cal(yob); @TayCodes
Christopher McCormack
@cmccormack
May 10 2017 01:10
@TayCodes you defined your variables in a function but then try to use them outside the function, which causes an error
Aizaz Shahid
@aizazshahid
May 10 2017 01:11
@yonatonrose " " + var + " "
Long Nguyen
@longnt80
May 10 2017 01:11
@yonatonrose " "
Joseph
@revisualize
May 10 2017 01:11
@yonatonrose You need spaces between your works and parameters.
HeebieGeeBee
@HeebieGeeBee
May 10 2017 01:11
@whackdev
var city = data['results'][0]['address_components'][2]['short_name'] + ', ';
      var state = data['results'][0]['address_components'][5]['short_name'];
Nick Forlivio
@whackdev
May 10 2017 01:11
@longnt80 I'm trying to send the coordinates to the reverse geoloction function to get the city and state
Landon Benell
@LandonBenell
May 10 2017 01:11
@forwebtech I haven't even learned how a backtick is used so I don't think that's it? But I was meaning more figuratively than the literal starting point....
Yonaton Rose
@yonatonrose
May 10 2017 01:11
Ooooooh
Joseph
@revisualize
May 10 2017 01:11
@yonatonrose Peopledon'twritelikethis. People write like this.
Yonaton Rose
@yonatonrose
May 10 2017 01:11
thanks @forwebtech @longnt80 @revisualize
CamperBot
@camperbot
May 10 2017 01:11
:cookie: 221 | @longnt80 |http://www.freecodecamp.com/longnt80
:warning: yonatonrose already gave forwebtech points
yonatonrose sends brownie points to @forwebtech and @longnt80 and @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3924 | @revisualize |http://www.freecodecamp.com/revisualize
Aizaz Shahid
@aizazshahid
May 10 2017 01:11
@LandonBenell didn't understand what are you trying to say ?
Nick Forlivio
@whackdev
May 10 2017 01:12
@HeebieGeeBee ok so I didn't access the JSON properly?
HeebieGeeBee
@HeebieGeeBee
May 10 2017 01:12
@whackdev thats one big object lol but yeah its results[0]......
TayCodes
@TayCodes
May 10 2017 01:12
@cmccormack Actually the variable ret is returned alone but do you know how I can also return name please?
Nick Forlivio
@whackdev
May 10 2017 01:12
@HeebieGeeBee thanks!
CamperBot
@camperbot
May 10 2017 01:13
whackdev sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1608 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Moisés Man
@moigithub
May 10 2017 01:13
@TayCodes u didnt answer the above question.. also ret variable is defined on different scopes...
Long Nguyen
@longnt80
May 10 2017 01:13
@whackdev I meant those variables are declared locally, they cannot be accessed by another function, right?
Yonaton Rose
@yonatonrose
May 10 2017 01:13
wait you cant get more than one brownie point from the same person thats stupid
sorry @forwebtech
Christopher McCormack
@cmccormack
May 10 2017 01:14
@TayCodes That isn't how it works. You need to assign your return to a variable, which is not what is done in your code. do something like var retname = ytir("Jane", 1970);, then you can use retname to display something. Maybe make your return value an array so you can break that up into multiple variables
Yonaton Rose
@yonatonrose
May 10 2017 01:14
thanks for the help anyway
Nick Forlivio
@whackdev
May 10 2017 01:14
@longnt80 yeah but I passed them through
Aizaz Shahid
@aizazshahid
May 10 2017 01:14
@yonatonrose well that's how FCC rules made, that's why.
Landon Benell
@LandonBenell
May 10 2017 01:14
@forwebtech I've tried things such as fahrenheit = fahrenheit * 9/5 + 32; and that didn't work, looking back they just showed how to use addition, subtraction, etc, but I don't know how to use that and the formula to make it work
HeebieGeeBee
@HeebieGeeBee
May 10 2017 01:14
im also a little freaked out that that api new my exact address
Nick Forlivio
@whackdev
May 10 2017 01:14
@HeebieGeeBee that made them get the right values now to see why the DOM isn't updating, appreciate the help
Aizaz Shahid
@aizazshahid
May 10 2017 01:14
but i think they are not worth anything , just a numbers !
@LandonBenell hmm fahrenheit ?? you need to convert celsius to farhenheit !
so use celsius parameter
@LandonBenell the function accepts the celsius and convert it to Fahrenheit.
Landon Benell
@LandonBenell
May 10 2017 01:17
@forwebtech Thanks! I just got messed up with the wording and when I typed Celsius the first time it was with a var so it threw me off.
CamperBot
@camperbot
May 10 2017 01:17
landonbenell sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 472 | @forwebtech |http://www.freecodecamp.com/forwebtech
Aizaz Shahid
@aizazshahid
May 10 2017 01:17
:+1:
Landon Benell
@LandonBenell
May 10 2017 01:18
@forwebtech Thanks again!
CamperBot
@camperbot
May 10 2017 01:18
landonbenell sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:warning: landonbenell already gave forwebtech points
Aizaz Shahid
@aizazshahid
May 10 2017 01:18
@LandonBenell :+1:
Flo
@Flothus
May 10 2017 01:18
Hi guys!
Can I post here code for reviewing an assignment?
HeebieGeeBee
@HeebieGeeBee
May 10 2017 01:19
@whackdev your return location in your get geo function is only being returned in teh ajax callback function
Aizaz Shahid
@aizazshahid
May 10 2017 01:19
@Flothus no :)
Long Nguyen
@longnt80
May 10 2017 01:20
@whackdev ok I found it
Flo
@Flothus
May 10 2017 01:20
Thx Aut
Aizaz*!
Long Nguyen
@longnt80
May 10 2017 01:21
@whackdev
because that function is under the function changeDOM so you cannot get the result with changeDOM
just replace return location inside the function function getGeo(Lat, Long) with $('#location').html(location);
FelixHakaraia
@FelixHakaraia
May 10 2017 01:23
Hey guys, can anyone tell me why this isn't working?
var myMusic = [
{[
"artist": "Billy Joel",
"title": "Piano Man",
"release_year": 1973,
"formats": [
"CS",
"8T",
"LP"
],
"gold": true,
]
[
"artist": "Kanye",
"title": "Yeezus",
"release_year": "2013",
"formats": [
"CS",
"mp3",
"Itunes"]
]
}
];
HeebieGeeBee
@HeebieGeeBee
May 10 2017 01:24
@FelixHakaraia each record is meant to be an object
and you seperate elements in arrays with commas
sumeetghosh
@sumeetghosh
May 10 2017 01:24

var myStr = "FirstLine\n \Second\tLine\ \rThird\tLine";

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

please help me with this

Joseph
@revisualize
May 10 2017 01:25
@sumeetghosh Why have you escaped tabs in the middle of your text?
Jon
@supremeplatypus
May 10 2017 01:26
function abTest(a, b) {
// Only change code below this line
if (a||b<0);
return undefined;
} else {
return Math.round(Math.pow(Math.sqrt(a) + Math.sqrt(b), 2));
}
TayCodes
@TayCodes
May 10 2017 01:26
@cmccormack https://codepen.io/dev999/pen/zwRoKL I did what you said and it's not working not sure why
Jon
@supremeplatypus
May 10 2017 01:27
need help with this, else gives an error
Joseph
@revisualize
May 10 2017 01:27
@supremeplatypus You're not writing your if condition correctly.
FelixHakaraia
@FelixHakaraia
May 10 2017 01:27
@HeebieGeeBee Ah cool once i replaced [] with {} and seperated with a comma it worked thanks!
CamperBot
@camperbot
May 10 2017 01:27
felixhakaraia sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1609 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
HeebieGeeBee
@HeebieGeeBee
May 10 2017 01:27
@FelixHakaraia cool well done
sumeetghosh
@sumeetghosh
May 10 2017 01:27

@revisualize var myStr = "FirstLine\n \SecondLine\ \rThirdLine";

you want me to write like this way

Joseph
@revisualize
May 10 2017 01:28

@supremeplatypus How to write an if conditional statements with OR and AND operators:
I am seeing a large number of people writing if conditions using OR and AND operators incorrectly.
Here is an example of what I'm seeing:

if (param1 == "a" || "c" || "e") { // incorrect
   var output = "Odd lowercase alpha character"; 
}

What I think people think is that it will compare param1 to "a" then compare param1 to "c" then compare param1 to "e"
However, that's not actually what the computer is processing.

if conditions need to be evaluated to true for the if statement to run:

if ((condition1) || (condition2) || (condition3) {
    // true statement
}

And how we would code that up from our example above where we're trying to get the odd character from a parameter (param1):

if (param1 == "a" || param1 == "c" || param1 == "e") {
   var output = "Odd lowercase alpha character"; 
}

I'm also seeing people writing and statements like this:

if (param1 == "a" && param1 == "e") {
}

The problem with this is the fact that a variable can't really be two strings or two different numbers at the same time.

@sumeetghosh You still have spaces in your string.
@sumeetghosh myStr should have encoded text with the proper escape sequences and no spacing.
Christopher McCormack
@cmccormack
May 10 2017 01:28

@TayCodes ytir ("Jane", 1970); is your function call, but unless you assign the return value to something, it's not going to do anything for you. try something like this:

var response = ytir ("Jane", 1970);`
document.write(response[1] + " retires in " + response[0]);

Notice how we assigned the return value of the function to response then used those values afterward in your document.write

sumeetghosh
@sumeetghosh
May 10 2017 01:29
@revisualize thank you
CamperBot
@camperbot
May 10 2017 01:29
sumeetghosh sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3925 | @revisualize |http://www.freecodecamp.com/revisualize
Tyler Johnson
@tylerjj17
May 10 2017 01:29
i need help with factorializing a number
function factorialize(num) {
return num * (i < 5);
}
var i = num < 5;
factorialize(5);
im just not getting it
Joseph
@revisualize
May 10 2017 01:30
@tylerjj17 Can you tell me how to factorial a number not with JS but, in Math.
Christopher McCormack
@cmccormack
May 10 2017 01:30
@tylerjj17 in return num * (i < 5);, (i < 5) would return a boolean value of true or false, I"m not sure that's what you wanted
@tylerjj17 that also is in no way how you factorialize a number
@tylerjj17 var i = num < 5; is outside your function but tries to use a function parameter num that's out of scope, and again num<5 is going to give you a true/false value
Flo
@Flothus
May 10 2017 01:32

One question:
is it ok to nest methods, or is it considered too messy to follow later?

For instance creating an array with letters and digits from a mixed str:

var cleanStrArray = str.toLowerCase().match(/[A-Za-z0-9]/gi).join("").split("");

Christopher McCormack
@cmccormack
May 10 2017 01:32
@Flothus nope that's fine
Nick Forlivio
@whackdev
May 10 2017 01:32
@longnt80 @HeebieGeeBee I got it!
https://codepen.io/whackdev/full/oWomYN/
Christopher McCormack
@cmccormack
May 10 2017 01:32
@Flothus although I think you're order is off
Joseph
@revisualize
May 10 2017 01:32
@Flothus What you're talking about is method chaining.
Flo
@Flothus
May 10 2017 01:33
@chris thx!
CamperBot
@camperbot
May 10 2017 01:33
flothus sends brownie points to @chris :sparkles: :thumbsup: :sparkles:
:cookie: 147 | @chris |http://www.freecodecamp.com/chris
HeebieGeeBee
@HeebieGeeBee
May 10 2017 01:33
@whackdev sweet well done
Joseph
@revisualize
May 10 2017 01:33
@Flothus It is fine to do method chaining. However, you need to look at what the previous method returns.
Long Nguyen
@longnt80
May 10 2017 01:33
@whackdev :+1:
one last thing, change the font man :smile:
Joseph
@revisualize
May 10 2017 01:33
@Flothus Your method chain is actually incorrect.
TayCodes
@TayCodes
May 10 2017 01:33
@cmccormack I'll try again tomorrow, its late not getting anywhere
Nick Forlivio
@whackdev
May 10 2017 01:33
@longnt80 yeah I will not sure what to but it needs it
Christopher McCormack
@cmccormack
May 10 2017 01:33
@longnt80 why, do you think his font is Whack?
Flo
@Flothus
May 10 2017 01:34
Is it? The result seemed fine
Nick Forlivio
@whackdev
May 10 2017 01:34
@HeebieGeeBee now I just need to gett the button function and the background matching the decsription but that stuff is easier
Joseph
@revisualize
May 10 2017 01:34
@Flothus Do you want the result to be an array?
Nick Forlivio
@whackdev
May 10 2017 01:34
@cmccormack I see what you did there
Christopher McCormack
@cmccormack
May 10 2017 01:34
haha
Long Nguyen
@longnt80
May 10 2017 01:34
nice
Jon
@supremeplatypus
May 10 2017 01:35

@revisualize changed to this, still doesn't work

if (a<0||b<0)

Joseph
@revisualize
May 10 2017 01:35
@Flothus because you're doing .join() then .split()
@supremeplatypus Show full code.
Jon
@supremeplatypus
May 10 2017 01:36

function abTest(a, b) {
// Only change code below this line
if (a<0||b<0);
return undefined;
} else {
// Only change code above this line

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

Joseph
@revisualize
May 10 2017 01:36
@supremeplatypus THat's your problem. You replaces the { with a ;
@supremeplatypus The ; is a statement terminator.
Flo
@Flothus
May 10 2017 01:36
@revisualize should be an array
Joseph
@revisualize
May 10 2017 01:37
@Flothus Then why do you have a join before the split?
Flo
@Flothus
May 10 2017 01:38
@Flothus I wanted to compare two arrays but all the letters should be stored in the first index. But I guess you´re right I could save a step by just comparing the strings
Joseph
@revisualize
May 10 2017 01:43
cbot
CamperBot
@camperbot
May 10 2017 01:43
you called?
Flo
@Flothus
May 10 2017 01:47

@revisualize ah, it had to be an array to use the reverse() method (checking for palindroms).Match() resulted in an array with elements for every word in the string, so I had to join it to have only one element in the array.
I guess it´s overly complicated but couldn´t find a better way?

function palindrome(str) {
// Good luck!

var cleanStrArray = str.toLowerCase().match(/[A-Za-z0-9]/gi).join("").split("");
str = str.toLowerCase().match(/[A-Za-z0-9]/gi).join("");
var revStr = cleanStrArray.reverse().join("");

if (str === revStr) {
return true;
}
else
return false;
}

Joseph
@revisualize
May 10 2017 01:48
@Flothus I don't think match() is doing what you want it to do.
Damien
@DubbDevs
May 10 2017 01:49
can I get some assistance with my code. I need this.setGear to set the private gear value
  // Only change code below this line.
  var gear;

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

  this.setGear = function(){
    gear = 0;                //I'm doing soemthing wrong here
  };
};
seems simple but something is wrong
Flo
@Flothus
May 10 2017 01:51
@revisualize I guess so )))
But the code went through.
Joseph
@revisualize
May 10 2017 01:51
@Flothus hmmm.
Maybe .match() doesn't do what I think it does.
Ethan Hartman
@elhartman
May 10 2017 01:53
@DubbDevs Are you trying to declare your gear variable within the this.setGear function?
@DubbDevs Privately (or locally)?
Flo
@Flothus
May 10 2017 01:54
@revisualize I actually don´t understand why it would store letters separated by spaces in different elements.
Damien
@DubbDevs
May 10 2017 01:54
If i understand correctly the 2 methods are public and the gear variable is private
@elhartman so that public setgear should change the private gear
Mike
@MikeJSchorah
May 10 2017 01:55
Hello
Christopher McCormack
@cmccormack
May 10 2017 01:56
Anyone good with React or maybe just CSS know how I can get my i element on the second line? http://codepen.io/cmccormack/pen/JNpGxZ?editors=1010
Damien
@DubbDevs
May 10 2017 01:57
ohhhh wait I I got it had to add the value for the function
@elhartman thank you!
CamperBot
@camperbot
May 10 2017 01:57
dubbdevs sends brownie points to @elhartman :sparkles: :thumbsup: :sparkles:
:cookie: 174 | @elhartman |http://www.freecodecamp.com/elhartman
Aizaz Shahid
@aizazshahid
May 10 2017 02:01
@cmccormack ?
what's up ?
Christopher McCormack
@cmccormack
May 10 2017 02:01
@forwebtech trying to get the fontawesome icon on the second line below the text, but I think flexbox may be preventing it
Aizaz Shahid
@aizazshahid
May 10 2017 02:02
well try <br>
Christopher McCormack
@cmccormack
May 10 2017 02:02
yeah it's in there
Aizaz Shahid
@aizazshahid
May 10 2017 02:03
@cmccormack are you using BS ?
Christopher McCormack
@cmccormack
May 10 2017 02:03
if I remove the flexbox it seems to behave correctly at least as far as block elements but centering in a div is such a pain
yeah
Aizaz Shahid
@aizazshahid
May 10 2017 02:04
to center you have a class text-center in BS
@cmccormack well you have a syntax problem i think!
<i class="..."></i> should be like that.
Christopher McCormack
@cmccormack
May 10 2017 02:05
that's for horizontal, I'm also trying to align vertical. I'm not really using bs for this div I guess
@forwebtech not in React :)
Aizaz Shahid
@aizazshahid
May 10 2017 02:05
ok !
Christopher McCormack
@cmccormack
May 10 2017 02:05
no closing tags if no inner elements, class becomes className, etc...
Aizaz Shahid
@aizazshahid
May 10 2017 02:07
well if you need both in new lines why don't you make them block with display property
still, don't know React. so am not getting it, actually !
Christopher McCormack
@cmccormack
May 10 2017 02:09
@forwebtech with display: flex changing the display of the children elements doesn't change anything. if I remove display: flex, I can't seem to get it to line up vertically
I can probably change it to regular html
Aizaz Shahid
@aizazshahid
May 10 2017 02:09
@cmccormack you just using flex for vertical alignment ??
Christopher McCormack
@cmccormack
May 10 2017 02:10
yeah
Aizaz Shahid
@aizazshahid
May 10 2017 02:10
well wait let me try some examples without flex to center it.
Christopher McCormack
@cmccormack
May 10 2017 02:14
thanks - converted it all to standard html/css
David Miller
@DavidMillerFL
May 10 2017 02:14
Hi guys. Do I need a loop or something? I’m doing Chunky Monkey
function chunkArrayInGroups(arr, size) {
  var firstHalf = arr.slice(0, size);
  var secondHalf = arr.slice(-size);
  var combo = [firstHalf, secondHalf];
  return combo;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
doh
I got the first 2 check marks to go green. The rest are red.
jmariomejiap
@jmariomejiap
May 10 2017 02:16
hey guys. I thought I knew how to create an object but now Im realising, no so much. basically, what i what do is to loop through an array [1,2,3,4,5,6,4,3,4,5,4,3] and create an object base on those numbers as keys and as values count the times each number is inside the array. i want to get somethis like this. {1: 1, 2: 1, 3: 3, 4:4, 5:2}.
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:16
@DavidMillerFL youre going to need a loop yes
what if the array is 50 elements in length?
jmariomejiap
@jmariomejiap
May 10 2017 02:16
I get that i could use array.reduce() but how can i do this without using reduce.
David Miller
@DavidMillerFL
May 10 2017 02:17
@HeebieGeeBee I thought so… I was just hoping for somebody to tell me there’s a better way, I hate making them lol
jmariomejiap
@jmariomejiap
May 10 2017 02:17
can I get some help. thanks
Christopher McCormack
@cmccormack
May 10 2017 02:18
@jmariomejiap just use a for loop to iterate over the array and use the hasOwnProperty method to determine if the number is already in the new object and increment the value if so.
Aizaz Shahid
@aizazshahid
May 10 2017 02:18
@cmccormack for one line that is the best solution: http://jsfiddle.net/d4zGF/
Christopher McCormack
@cmccormack
May 10 2017 02:19
@forwebtech hmm I guess I could use line-height, the height of each recipe should be the same very time. Thanks
CamperBot
@camperbot
May 10 2017 02:19
cmccormack sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:cookie: 473 | @forwebtech |http://www.freecodecamp.com/forwebtech
Aizaz Shahid
@aizazshahid
May 10 2017 02:19

@cmccormack

If the inner element can have a fixed height, you can make its position absolute and specify its height, margin-top and top position, http://jsfiddle.net/YFncP/2/

Christopher McCormack
@cmccormack
May 10 2017 02:19
it's not as dynamic though
Aizaz Shahid
@aizazshahid
May 10 2017 02:19
try that
@cmccormack but if you need a dynamic way then i can make you with JS like i am doing it in my portfolio site !
as if the browser gets resize it will adjust its dimensions !
Csaba Balogh
@JasonCorp84
May 10 2017 02:21
Hello everyone
Aizaz Shahid
@aizazshahid
May 10 2017 02:21
Welcome !
Csaba Balogh
@JasonCorp84
May 10 2017 02:21
do you know why is it returns only the first char ?
arr = arr[i].charAt(0).toUpperCase();

this is the whole code :smile: function titleCase(str) {
var arr = str.toLowerCase().split(' ');

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

titleCase("I'm a little tea pot");

all I got back is "I"
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:23
@JasonCorp84 becuase thats all youve assigned to arr
Aizaz Shahid
@aizazshahid
May 10 2017 02:24
@cmccormack that one is perfect for you check it out :
div.ext-box { 
    display: table; 
    width:100%;
    height: 200px;
    border: 1px solid red;
}
div.int-box {
    display: table-cell;
    vertical-align: middle;
}

<div class="ext-box">
    <div class="int-box">
        <h2>Some txt</h2>
        <p>bla bla bla</p>
    </div>
</div>
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:24
and after your first iteration arr is only 1 in length so the loop stops
Christopher McCormack
@cmccormack
May 10 2017 02:24
@forwebtech one day I dream of easy vertical alignment hahah
Csaba Balogh
@JasonCorp84
May 10 2017 02:25
@HeebieGeeBee thank you
CamperBot
@camperbot
May 10 2017 02:25
jasoncorp84 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1610 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
Aizaz Shahid
@aizazshahid
May 10 2017 02:25
@cmccormack that one is easy :point_up: May 10, 2017 7:24 AM
Christopher McCormack
@cmccormack
May 10 2017 02:26
@forwebtech yup and it looks to be working well, I'll go with that one. I've tried table-cell in the past with other designs but it never worked out, finally a good use!
Mohamed Derhalli
@derhallim
May 10 2017 02:26
back!
Christopher McCormack
@cmccormack
May 10 2017 02:26
@forwebtech thanks again
CamperBot
@camperbot
May 10 2017 02:26
cmccormack sends brownie points to @forwebtech :sparkles: :thumbsup: :sparkles:
:warning: cmccormack already gave forwebtech points
Aizaz Shahid
@aizazshahid
May 10 2017 02:26
@cmccormack :+1:
Mohamed Derhalli
@derhallim
May 10 2017 02:26
@HeebieGeeBee @cmccormack :v:
Christopher McCormack
@cmccormack
May 10 2017 02:27
@derhallim hello
Mohamed Derhalli
@derhallim
May 10 2017 02:27
wazzaap
David Miller
@DavidMillerFL
May 10 2017 02:27

Ok so I’m a bit lost. Shocker right? So the requirements for the Chunky Monkey challenge include things like this

chunkArrayInGroups([0, 1, 2, 3, 4, 5], 4) should return [[0, 1, 2, 3], [4, 5]]

But why? Why would a parameter size set to an argument 4 return [[0, 1, 2, 3], [4, 5]] ???

HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:27
@derhallim yo
David Miller
@DavidMillerFL
May 10 2017 02:28
There’s nothing 4’ish about what’s being returned.
Mohamed Derhalli
@derhallim
May 10 2017 02:28
the first array has 4 items ..
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:28
@DavidMillerFL theres only 6 elements
Mohamed Derhalli
@derhallim
May 10 2017 02:28
then the rest returns
Jason Luboff
@JLuboff
May 10 2017 02:28
Because it can only return what's in the array, it's not going to return additional nonexistent values
Aizaz Shahid
@aizazshahid
May 10 2017 02:28
@DavidMillerFL chunky monkey ?
David Miller
@DavidMillerFL
May 10 2017 02:28
Oh so it slices at size
Mohamed Derhalli
@derhallim
May 10 2017 02:28
if the original array had 8 items, it would be [array of 4] then [array of 4] @DavidMillerFL
Aizaz Shahid
@aizazshahid
May 10 2017 02:29
yes !
David Miller
@DavidMillerFL
May 10 2017 02:29
@forwebtech Yes
Mohamed Derhalli
@derhallim
May 10 2017 02:29
but it had 6, so [array of 4] .. then [array 2]
Aizaz Shahid
@aizazshahid
May 10 2017 02:29
the array should be divided into the parts (second argument)
David Miller
@DavidMillerFL
May 10 2017 02:29
I thought size determines the size of each array. instead size seems to be determining where the slice() occurs
Mohamed Derhalli
@derhallim
May 10 2017 02:30
which is the size of each array
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:30
@DavidMillerFL nope
Aizaz Shahid
@aizazshahid
May 10 2017 02:30
@DavidMillerFL size => not actually size but you can say groups :D
Jason Luboff
@JLuboff
May 10 2017 02:30
Size matters
Mohamed Derhalli
@derhallim
May 10 2017 02:30
^
:joy:
David Miller
@DavidMillerFL
May 10 2017 02:32
lol… ok… so loop through the entire array.length, … slice each element in the array[i] to slice(size) ...
no?
David Amanze
@GodKingShogun
May 10 2017 02:35
so i finally figured out what was wrong with my weather app and it is returning status 400400 Bad Request which is this
400 Bad Request
The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing)
the problem is i dont understand what that means. someone enlighten men
Christopher McCormack
@cmccormack
May 10 2017 02:35
@DavidMillerFL not quite, if you iterate one at a time, you'll end up with a bunch of extra arrays. You'll also want to change the step on your for loop or multiply your index values by size to ensure you only get what you need
@GodKingShogun probably a bad url - can you share your code?
Jason Luboff
@JLuboff
May 10 2017 02:36
@GodKingShogun if you try just your URL, do you get data back?
David Amanze
@GodKingShogun
May 10 2017 02:37
$(document).ready(function () {
  var temp = null;
  var on = false;

$("#getW").click(function () {
  const coord = `http://ip-api.com/json`;
  axios.get(coord).then((response) => {
    const id = "6b5216c389dc27fe53457d96bc7aae93";
    var lat = response.lat;
    var lon = response.lon;
    var weatherMap = `http://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&units=metric&APPID=${id}`;
    return axios.get(weatherMap);
  }).then((response) => {
     temp = response.main.temp;
     $("#celsius").html(temp);
  }).catch((e) => {
   $("#celsius").html(e.message);
  });
});
David Miller
@DavidMillerFL
May 10 2017 02:37
Ok let me meditate on that and I’ll try it out once I get it - Thanks guys @HeebieGeeBee @JLuboff @derhallim @forwebtech @cmccormack
CamperBot
@camperbot
May 10 2017 02:37
davidmillerfl sends brownie points to @heebiegeebee and @jluboff and @derhallim and @forwebtech and @cmccormack :sparkles: :thumbsup: :sparkles:
:cookie: 474 | @forwebtech |http://www.freecodecamp.com/forwebtech
:star2: 1611 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
:cookie: 547 | @cmccormack |http://www.freecodecamp.com/cmccormack
:cookie: 321 | @derhallim |http://www.freecodecamp.com/derhallim
:star2: 1719 | @jluboff |http://www.freecodecamp.com/jluboff
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:38
whats an axios?
Jason Luboff
@JLuboff
May 10 2017 02:38
@HeebieGeeBee it's a promise library
David Amanze
@GodKingShogun
May 10 2017 02:39
@HeebieGeeBee what @JLuboff said
Jason Luboff
@JLuboff
May 10 2017 02:39
Mainly used for Node, but I guess it can be used for front end as well
Christopher McCormack
@cmccormack
May 10 2017 02:40
@GodKingShogun where are you replacing your variables in your openweathermap url?
David Amanze
@GodKingShogun
May 10 2017 02:41
in the ${}
@cmccormack
Christopher McCormack
@cmccormack
May 10 2017 02:41
does axios do that?
Jason Luboff
@JLuboff
May 10 2017 02:41
No, it's ES6 template strings
David Amanze
@GodKingShogun
May 10 2017 02:42
@cmccormack im using template strings. does same thing as concatenation
Christopher McCormack
@cmccormack
May 10 2017 02:42
ah
Jason Luboff
@JLuboff
May 10 2017 02:43
They're awesome lol
David Amanze
@GodKingShogun
May 10 2017 02:43
@JLuboff i concur
Jason Luboff
@JLuboff
May 10 2017 02:43
You don't have to use quotes and + and all that
Vicky Lai
@vickylai
May 10 2017 02:44
Halloooo wonderful people
Long Nguyen
@longnt80
May 10 2017 02:44
can someone explain to me what is DNA pairing?
Christopher McCormack
@cmccormack
May 10 2017 02:44
so I tested both urls out fine with fake lat lon in the latter... @GodKingShogun are you using codepen?
@vickylaiio hello
Vicky Lai
@vickylai
May 10 2017 02:45
Why's my switch statement not printing the console log?

function convertToRoman(num) {
  var remainder = num % 10;
  var tens = num-remainder;
  switch(tens){
    case < 100:
        console.log(Math.floor(tens/10));
        break;
    default: console.log('default');

  }
// return num;
}

convertToRoman(36);
@cmccormack :wave:
David Amanze
@GodKingShogun
May 10 2017 02:45
@cmccormack no i am running my app from my local machine. i am running it from atom
Jason Luboff
@JLuboff
May 10 2017 02:46
@GodKingShogun if you try logging your lat/Lon does it show?
David Amanze
@GodKingShogun
May 10 2017 02:46
@JLuboff no it does not show
Christopher McCormack
@cmccormack
May 10 2017 02:46
@vickylaiio you don't want to do comparisons if you're using a value in the switch parameter
@vickylaiio if you want to put conditional cases, you'd have to do something like switch(true), and even then you can't just do case < 100, you'd have to do something like case tens < 100:
jmariomejiap
@jmariomejiap
May 10 2017 02:47
@cmccormack Im trying to implement what you told me. now I also realised I dont know how to add 1 more a given key. to increment its value.
for (var i =0; i < na.length; i++) {
    console.log(na);
    if (newOb.hasOwnProperty(na[i]).toString()) {
      console.log("has p")
      newOb[na[i]] ++ ;
    }
    newOb[na[i]] = 1  
  }

  return newOb
Christopher McCormack
@cmccormack
May 10 2017 02:48
@jmariomejiap can you put both sets of ``` on their own line for readability?
Benjamin
@XenoCoding
May 10 2017 02:48
Why does my code work for arr(1, 5) for the Least Common Multiple algorithm but not arr(1, 13) ? When I try to run arr(1, 13) the console says it detects a potential infinite loop.

function smallestCommons(arr) {

  var lcm = arr[0];
  var test = true;
  arr = arr.sort();

  while(true){

    lcm = 60;
    for(var j = arr[0]; j < arr[1]; j++){
      if(lcm % j !== 0){
        test = false;
      }
    }

    if(test === false){
      lcm += arr[1];
    }
    else{
      break;
    }

  }

  return lcm;
}


smallestCommons([1, 13]);
David Amanze
@GodKingShogun
May 10 2017 02:48
again the status code is 400

Vicky Lai
@vickylai
May 10 2017 02:49
@cmccormack Ahhhh gotcha. I have my uses mixed up. I guess if else would be more straightforward
jmariomejiap
@jmariomejiap
May 10 2017 02:49
sorry
Christopher McCormack
@cmccormack
May 10 2017 02:50
@vickylaiio usually they are
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:50
@XenoCoding why are you dividing 60 by 13?
David Amanze
@GodKingShogun
May 10 2017 02:50
i guess i just wont include my weather app as part of my portfolio :cry:
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:51
i mean why are you using 60 in general
Christopher McCormack
@cmccormack
May 10 2017 02:51
@jmariomejiap don't convert your hasOwnProperty call to a string, an if conditional is only looking for a true/false value
Benjamin
@XenoCoding
May 10 2017 02:51
@HeebieGeeBee Whoops, I forgot to remove that after I finished testing something else. xD
Long Nguyen
@longnt80
May 10 2017 02:51
can someone explain what is DNA pairing?
Benjamin
@XenoCoding
May 10 2017 02:51
Now my code doesn't even work for arr[1,5].
*after removing that line
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:52
@longnt80 if you get g or summin pair it with its pair letter
put in a array
something like that
it seemed surprisingly easy
for an advanced algorithm
havent really looked at it since
Christopher McCormack
@cmccormack
May 10 2017 02:53
@GodKingShogun like @JLuboff said if your lat lon are not showing then your weather api call won't work. Where did you log the lat lon, prior to var weatherMap = ...?
Long Nguyen
@longnt80
May 10 2017 02:53
@HeebieGeeBee
the problem is I don't understand the pairing part
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:53
oh it was intermediate
jmariomejiap
@jmariomejiap
May 10 2017 02:53
@cmccormack ok, I removed .toString(). but i still can add one more once to the count
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:54
@longnt80 it gives you a link to what the base pairs are
g's go with c's
c;s go with g's
a's go with t's
t's go with a'
Benjamin
@XenoCoding
May 10 2017 02:55
@HeebieGeeBee Ignoring the lcm = 60, why isn't my code working?
Long Nguyen
@longnt80
May 10 2017 02:55
@HeebieGeeBee ok let me see
Jason Luboff
@JLuboff
May 10 2017 02:55
@HeebieGeeBee I didn't get the pairing part at first then someone explained it and it was stupid easy as you mentioned lol
Christopher McCormack
@cmccormack
May 10 2017 02:55
@jmariomejiap did you delcare newOb somewhere?
Benjamin
@XenoCoding
May 10 2017 02:55
The DNA Pairing was a nice break from the rest of the algorithms
jmariomejiap
@jmariomejiap
May 10 2017 02:55
yes chris
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:56
@JLuboff yeah it almost seems like its a trick question when its too easy
Long Nguyen
@longnt80
May 10 2017 02:56
@HeebieGeeBee ok I got it, thank you
CamperBot
@camperbot
May 10 2017 02:56
longnt80 sends brownie points to @heebiegeebee :sparkles: :thumbsup: :sparkles:
:star2: 1612 | @heebiegeebee |http://www.freecodecamp.com/heebiegeebee
David Amanze
@GodKingShogun
May 10 2017 02:56
@cmccormack im running the weather app from my terminal but nothing is showing up
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:56
@XenoCoding what do are you trying to do ?
David Amanze
@GodKingShogun
May 10 2017 02:56
in my terminal
jmariomejiap
@jmariomejiap
May 10 2017 02:56
@cmccormack I guess my question is newOb[na[i]] ++ ;
Christopher McCormack
@cmccormack
May 10 2017 02:57
@jmariomejiap you'll need an else in there or you're going to overwrite your value every time with 1
@jmariomejiap otherwise you're looking pretty good so far
Benjamin
@XenoCoding
May 10 2017 02:57
@HeebieGeeBee *Find the smallest common multiple of the provided parameters that can be evenly divided by both, as well as by all sequential numbers in the range between these parameters.
Basically finding the least common multiple of every number between the parameters (including the parameters themselves)
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:58
@XenoCoding if you have a challenge called smallest common multiple, dont you think you should be multiplying something
jmariomejiap
@jmariomejiap
May 10 2017 02:58
@cmccormack ohhhhhhhh, the ELSE. it works now. thanks soo much for helping me.
CamperBot
@camperbot
May 10 2017 02:58
jmariomejiap sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:cookie: 548 | @cmccormack |http://www.freecodecamp.com/cmccormack
Christopher McCormack
@cmccormack
May 10 2017 02:58
@jmariomejiap np, glad it's working!
HeebieGeeBee
@HeebieGeeBee
May 10 2017 02:59
@XenoCoding do you understand what the smallest common multiple is?
Benjamin
@XenoCoding
May 10 2017 02:59
@HeebieGeeBee Multiplying or addition works. lcm += arr[1];
If I have arr[1, 5], it will keep adding the least common multiple by 5.
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:00
oh right i see
@XenoCoding well i would have lcm as at least the biggest number to start
Benjamin
@XenoCoding
May 10 2017 03:01
@HeebieGeeBee Yea, true, I don't know why I set it equal to the first parameter.
I also stuck it underneath arr.sort() so that the second parameter will always be the biggest.
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:03
@XenoCoding but also what happens on the next iteration
of the while loop
if test has been set to false, its still going to be false for the next loop isnt it
theres nothing changing it back to true again
Benjamin
@XenoCoding
May 10 2017 03:04
@HeebieGeeBee Ah! Good catch.
I put test = true at the top of the while loop.
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:06
@XenoCoding what does your code look like now?
Benjamin
@XenoCoding
May 10 2017 03:06
Now the algorithm works for all cases except smallestCommons([23, 18]). The unique part about this one is that neither of the parameters are 1...
function smallestCommons(arr) {

  var test;
  arr = arr.sort();
  var lcm = arr[1];

  while(true){
    test = true;

    for(var j = arr[0]; j < arr[1]; j++){
      if(lcm % j !== 0){
        test = false;
      }
    }

    if(test === false){
      lcm += arr[1];
    }
    else{
      break;
    }

  }

  return lcm;
}


smallestCommons([1, 5]);
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:07
@XenoCoding what do you mean?
why would that matter?
Benjamin
@XenoCoding
May 10 2017 03:07
That's what I want to know. It should work, but for some reason it isn't. I just noticed that it's the only case that doesn't have the number 1 for either of its parameters.
If you run smallestCommons([23, 18]), it detects a potential infinite loop.
One thing I changed to make it faster, instead of lcm += arr[1] I used lcm += arr[0] * arr[1]
David Amanze
@GodKingShogun
May 10 2017 03:11
im going to take out my weather app from my portfolio in 30 mins so if anyone has a solution let me know
Christopher McCormack
@cmccormack
May 10 2017 03:11
@GodKingShogun can you translate it into a codepen real quick? Hard to help without being able to see the behaviour first hand
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:12
@XenoCoding why would that make it faster?
Christopher McCormack
@cmccormack
May 10 2017 03:13
@XenoCoding I'm looking at your for loop and I'm dumbfounded as to how that's supposed to find an lcm. Can you maybe put some comments in that walk through your process?
Benjamin
@XenoCoding
May 10 2017 03:13
@HeebieGeeBee If I have smallestCommons([23,18]), instead of adding 23 to the least common multiple, it will add 414 (23 * 18) to the least common multiple, essentially saving me 18 iterations per pass.
Joseph
@revisualize
May 10 2017 03:13
Hey hey.
Benjamin
@XenoCoding
May 10 2017 03:13
@cmccormack allright, hang tight
Christopher McCormack
@cmccormack
May 10 2017 03:14
@revisualize yo
Joseph
@revisualize
May 10 2017 03:14
I need to do that Smallest Commons challenge.
Christopher McCormack
@cmccormack
May 10 2017 03:15
dang now I"m looking at my own smallestCommons code, dumbfounded how it works haha

ah I forgot this requirement:

e.g. for 1 and 3 - find the smallest common multiple of both 1 and 3 that is evenly divisible by all numbers between 1 and 3.

David Amanze
@GodKingShogun
May 10 2017 03:17
@cmccormack okay give me a sec
Christopher McCormack
@cmccormack
May 10 2017 03:19
I like this axios, I may have to start using it and remove jquery
Benjamin
@XenoCoding
May 10 2017 03:22
Allright, here we go. This will be a doozy.
function smallestCommons(arr) {

  var test;

  //sort the parameters and then set the least common multiple (lcm) to the larger one
  arr = arr.sort();
  var lcm = arr[1];

  // we want to keep running this loop until we find the lcm
  while(true){

    // our test is initially set to true at the beginning of each iteration
    test = true;

    // we want to check for the lcm for each number between our two parameters, including the parameters themselves. we start at the lower parameter, and work our way up to the higher parameter.
    for(var j = arr[0]; j <= arr[1]; j++){

      // we use the modulus operator to see if the number we are checking is a factor of our least common multiple. Example: lcm = 20 and j = 2; 20 % 2 will return a remainder of 0, so we know that 2 is a facor of 20, and test will not be set to false.
      if(lcm % j !== 0){
        test = false;
      }

    }

    // if, after iterating through each number, our test is set to false, that means at one point in the loop we discovered a number that was not a factor.
    if(test === false){

      // before we begin our next iteration, we increment our least common multiple by the product of the two parameters (that we know that both of our parameters will be factors). on our next iteration, we will test our new lcm
      lcm += arr[0] * arr[1];

    }

    // if our test is still equal to true, then all of the numbers are factors, and we have found our least common multiple. we can break from our loop now
    else{
      break;
    }

  }

  // return the least common multiple
  return lcm;
}


smallestCommons([23, 18]);
tuanha816
@tuanha816
May 10 2017 03:22
hey guys im stucks on excersise "understanding case sensitivity in variables"
David Amanze
@GodKingShogun
May 10 2017 03:23
Christopher McCormack
@cmccormack
May 10 2017 03:24
@GodKingShogun yup your problem is your lat and lon are not being added to your weatherMap var url
now let's see why
Benjamin
@XenoCoding
May 10 2017 03:24
@tuanha816 Camel case is how we capitalize our variables. The first word is not capitalized, and following words are. Example: myCamelCase. "my" is not capitalized, but "Camel" and "Case" are.
David Amanze
@GodKingShogun
May 10 2017 03:25
@cmccormack @cmccormack okay
tuanha816
@tuanha816
May 10 2017 03:25
@XenoCoding I undersstand that and did what it ask
Christopher McCormack
@cmccormack
May 10 2017 03:25
@GodKingShogun
    var lat = response.data.lat;
    var lon = response.data.lon;
Joseph
@revisualize
May 10 2017 03:25
@XenoCoding Why aren't you using Math.max() and Math.min() ?
tuanha816
@tuanha816
May 10 2017 03:25
but its not working

// Declarations
var studlyCapvar;
var properCamelcase;
var titleCaseover;

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

Benjamin
@XenoCoding
May 10 2017 03:26
@tuanha816 STUDLYCAPVAR should be studlyCapVar
Joseph
@revisualize
May 10 2017 03:26
@tuanha816 Your declarations are not correct.
Nicole Lama
@nicolenlama
May 10 2017 03:26

Hey guys, I can't get my output to show the count plus the word bet or hold. I can't figure out why?!?!?

``` 

function cc(card) {
// Only change code below this line
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
return (count+=1);
case 7:
case 8:
case 9:
return (count+=0);
case 10:
case "J":
case "Q":
case "K":
case "A":
return (count-=1);

}
if (count>=1){
return (count.concat(" Bet"));
}
else {
return(count + " Hold");
}
```

Christopher McCormack
@cmccormack
May 10 2017 03:26
Joseph
@revisualize
May 10 2017 03:26
@tuanha816 THen you didn't modify the variable assignment names.
Benjamin
@XenoCoding
May 10 2017 03:26
@XenoCoding Also, properCamelCase and titleCaseOver
David Amanze
@GodKingShogun
May 10 2017 03:26
@cmccormack ill go jump off a building now
Joseph
@revisualize
May 10 2017 03:26
@nicolenlama You're returning too early.
Christopher McCormack
@cmccormack
May 10 2017 03:26
@GodKingShogun Haha NOOO
Na-Ya
@Na-Ya
May 10 2017 03:27
Hi , can anyone give me a tip or point me in the right direction with checking for Palindromes ?
Joseph
@revisualize
May 10 2017 03:27
@nicolenlama Counting Cards is a challenge where your function will receive a card parameter. You're supposed to increment or decrement the global count variable according to the card's value
If the value of the card parameter is 2, 3, 4, 5 or 6 you need to increment the global variable count.
If the value of the card parameter is 10, 'J', 'Q', 'K' or 'A' you need to decrement the global variable count.
...
Then the function will return a string with the current count and the string "Bet" if the count is positive, or "Hold" if the count is zero or negative.
The current count and the player's decision ("Bet" or "Hold") should be separated by a single space.
...
...
Things to note: You should NOT be returning based on the value of the card. The value of card should only be adding or subtracting 1 from the global variable count.
The value of the global variable count is used to determine the return statement.
Benjamin
@XenoCoding
May 10 2017 03:27
@revisualize How should I use these?
Jason Luboff
@JLuboff
May 10 2017 03:27
@cmccormack axios is just a promise library, wouldn't be a jquery replacement
Joseph
@revisualize
May 10 2017 03:27
@XenoCoding It shows you on the MDN pages.
Benjamin
@XenoCoding
May 10 2017 03:27
@revisualize I'm looking now.
Christopher McCormack
@cmccormack
May 10 2017 03:27
@JLuboff right, but I don't really want to use jquery anywhere but ajax calls usually
David Amanze
@GodKingShogun
May 10 2017 03:27
@cmccormack what part am i suppose to be looking at in the url
Christopher McCormack
@cmccormack
May 10 2017 03:28
@GodKingShogun in which url?
Nicole Lama
@nicolenlama
May 10 2017 03:28
@revisualize Thanks
CamperBot
@camperbot
May 10 2017 03:28
nicolenlama sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3926 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
May 10 2017 03:28
@nicolenlama The return statement in you Switch Cases is causing your function to halt early.
David Amanze
@GodKingShogun
May 10 2017 03:29
Na-Ya
@Na-Ya
May 10 2017 03:29
Screen Shot 2017-05-09 at 11.28.26 PM.png
David Amanze
@GodKingShogun
May 10 2017 03:29
@cmccormack that one
Na-Ya
@Na-Ya
May 10 2017 03:29
Any tips on what I am doing wrong here?
tuanha816
@tuanha816
May 10 2017 03:29

@revisualize // Declarations
var studlyCapvar;
var properCamelcase;
var titleCaseover;

// Assignments
studlyCapvar = 10;
properCamelcase = "A String";
titleCaseover = 9000;

its still not working
Joseph
@revisualize
May 10 2017 03:29
@Na-Ya You're trying to compare a string to an array.
@tuanha816 studlyCapVar
@tuanha816 The instructions tell you how to name variables.
Christopher McCormack
@cmccormack
May 10 2017 03:30
@GodKingShogun oh I wanted to show you the response schema - you aren't appending data property to your response so you aren't working with your data yet in most places
Joseph
@revisualize
May 10 2017 03:30
properCamelCase
tuanha816
@tuanha816
May 10 2017 03:30
ohhhh
Joseph
@revisualize
May 10 2017 03:30
titleCaseOver
tuanha816
@tuanha816
May 10 2017 03:30
I see sorry
@revisualize thanks
CamperBot
@camperbot
May 10 2017 03:30
tuanha816 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3927 | @revisualize |http://www.freecodecamp.com/revisualize
Joseph
@revisualize
May 10 2017 03:30
S'all good.
Na-Ya
@Na-Ya
May 10 2017 03:30
@revisualize Thanks for responding. I thought I converted the string to an array and was comparing the array to the reverse of the array?
CamperBot
@camperbot
May 10 2017 03:30
na-ya sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3928 | @revisualize |http://www.freecodecamp.com/revisualize
David Amanze
@GodKingShogun
May 10 2017 03:30
@cmccormack i thought response was the data
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:31
@XenoCoding it does work, if you run it anyway
Christopher McCormack
@cmccormack
May 10 2017 03:31
@GodKingShogun you're response named response in your .then callback parameter, but you need to use response.data to access the information you need
Benjamin
@XenoCoding
May 10 2017 03:31
@revisualize These functions don't help me with least common multiples.
@HeebieGeeBee ??
David Amanze
@GodKingShogun
May 10 2017 03:32
@cmccormack okay thanks
CamperBot
@camperbot
May 10 2017 03:32
godkingshogun sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:cookie: 549 | @cmccormack |http://www.freecodecamp.com/cmccormack
Christopher McCormack
@cmccormack
May 10 2017 03:32
@GodKingShogun so where you have response.main.temp you need response.data.main.temp
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:32
if you override the infinite loop warning
Christopher McCormack
@cmccormack
May 10 2017 03:32
and wherever else
@GodKingShogun np
David Amanze
@GodKingShogun
May 10 2017 03:32
@cmccormack yea i figured :cry:
Christopher McCormack
@cmccormack
May 10 2017 03:32
@GodKingShogun you can also use response.data in your callback instead
David Amanze
@GodKingShogun
May 10 2017 03:32
that was literally a 2 day headache
fml
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:33
@XenoCoding but obviously the test isnt going to do that
Christopher McCormack
@cmccormack
May 10 2017 03:33
@GodKingShogun that's where console.log comes in - all I did was do a console.log(response) right after your .then... line and saw the object properties didn't match
sbechtold13
@sbechtold13
May 10 2017 03:33
ayo, anyone available to help with my chaining if else code?
Jason Luboff
@JLuboff
May 10 2017 03:34
@cmccormack ah, fair enough :+1:
Benjamin
@XenoCoding
May 10 2017 03:34
@HeebieGeeBee So if I override the infinite loop, the algorithm will work?
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:34
https://repl.it/Hpqm it did here yeah
Benjamin
@XenoCoding
May 10 2017 03:37
@HeebieGeeBee It's possible to override the infinite loop protection in FCC by writing // noprotect at the top of your code, but it just crashed my browser...
nsonhouse
@nsonhouse
May 10 2017 03:38
Any SQLers in the house?
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:38
@XenoCoding yeah but still wont pass test anyways
Benjamin
@XenoCoding
May 10 2017 03:38
@HeebieGeeBee poo
I think it's time to turn to youtube
Na-Ya
@Na-Ya
May 10 2017 03:39
I'm still stuck on this palindrome thing :/
David Amanze
@GodKingShogun
May 10 2017 03:39
@cmccormack like this
  axios.get(coord).then((response) => {
    console.log(response);
Christopher McCormack
@cmccormack
May 10 2017 03:40
@GodKingShogun yessir - in the browser console you should be able to expand the response and see all the properties and sub properties
Na-Ya
@Na-Ya
May 10 2017 03:40
Any other tips?
nsonhouse
@nsonhouse
May 10 2017 03:40
Does anyone understand connection.query('UPDATE table SET ... ?
Na-Ya
@Na-Ya
May 10 2017 03:40
Screen Shot 2017-05-09 at 11.28.26 PM.png
David Amanze
@GodKingShogun
May 10 2017 03:40
@cmccormack i tried to debug my code using my command line but when ever it got to jquery it crashed
Christopher McCormack
@cmccormack
May 10 2017 03:40
@GodKingShogun you'll see at the highest level are the properties in https://github.com/mzabriskie/axios#response-schema
Na-Ya
@Na-Ya
May 10 2017 03:40
Did I not convert the string to an array properly ?
Christopher McCormack
@cmccormack
May 10 2017 03:41
@GodKingShogun command line in what exactly?
David Amanze
@GodKingShogun
May 10 2017 03:41
@cmccormack my machine command line
Christopher McCormack
@cmccormack
May 10 2017 03:41
@GodKingShogun you're better off doing it in the browser when you can, it's very descriptive
@GodKingShogun what are you using in your console to interpret the code? node?
Jason Luboff
@JLuboff
May 10 2017 03:42
@nsonhouse I'd say that would be used to update a record in the table
nsonhouse
@nsonhouse
May 10 2017 03:42
@JLuboff WSUP man. You live here.
@JLuboff I got an error in the syntax
connection.query('UPDATE products SET item_quantity = item_quantity - ' + qty + 'WHERE item_id = ' + itemid, function(err, res){
if (err) throw err;
printInventory();
});
Claudio Restifo
@Marmiz
May 10 2017 03:45
@Na-Ya in your code you are comparing two arrays with a === operation
David Amanze
@GodKingShogun
May 10 2017 03:45
@cmccormack yes
Na-Ya
@Na-Ya
May 10 2017 03:47
@Marmiz I forgot I can't do that, thanks!
CamperBot
@camperbot
May 10 2017 03:47
na-ya sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:cookie: 856 | @marmiz |http://www.freecodecamp.com/marmiz
Long Nguyen
@longnt80
May 10 2017 03:50
I have a question in the challenge https://www.freecodecamp.com/challenges/boo-who
if the parameter is NaN, the console.log show Boolean(the value) as "false" but the if statement still take it as a true case. Why is that?
http://codepen.io/longnt80/pen/PmJOzx
David Amanze
@GodKingShogun
May 10 2017 03:52
im officially a failure :worried:
Christopher McCormack
@cmccormack
May 10 2017 03:54
@GodKingShogun with every failure lies wisdom
Benjamin
@XenoCoding
May 10 2017 03:55
@HeebieGeeBee Gotta be a bug in FCC. I watched somebody solve it on YouTube, and their solution was essentially the same as mine, but FreeCodeCamp accepted it. And, as you showed with this link, https://repl.it/Hpqm, my code is working fine. :( Should I report the bug?
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:56
@XenoCoding i dont think its a bug
Benjamin
@XenoCoding
May 10 2017 03:56
@HeebieGeeBee Would could it be?
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:56
it wouldnt crash your browser if it was a bug
but i dont know
Benjamin
@XenoCoding
May 10 2017 03:57
@HeebieGeeBee It was a bug. I followed FCC's advice and did a hard refresh on the page. Then the code worked!
Christopher McCormack
@cmccormack
May 10 2017 03:57
@longnt80 it's your own code - you're logging true:
else {
    console.log(true);
    return true;
  }
will
@uhohtrouble
May 10 2017 03:57
hello everyone
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:57
so you passed all the tests with it?
Benjamin
@XenoCoding
May 10 2017 03:57
@HeebieGeeBee yep
Christopher McCormack
@cmccormack
May 10 2017 03:57
@uhohtrouble hello
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:58
ok cool
Benjamin
@XenoCoding
May 10 2017 03:58
So frustrating. I probably spent over a half hour trying to fix code that wasn't broken...
HeebieGeeBee
@HeebieGeeBee
May 10 2017 03:58
@XenoCoding but i dunno
theres stilla reason it gives an infinite loop warning
it shouldnt
Long Nguyen
@longnt80
May 10 2017 03:58
@cmccormack
yeah I kinda get it now but why
booWho(false) should return true. and
booWho(NaN) should return false.
is NaN not a primitive?
eddy000
@eddy000
May 10 2017 04:00
hey all, i'm working on the profile lookup challenge and getting this error:function lookUp( firstName, prop ){
any suggestions?
Markus Ivancsics
@ivancsicsmarkus
May 10 2017 04:01
@eddy000 Hey!
heroiczero
@heroiczero
May 10 2017 04:01
@eddy000 could u paste your code with ''' :point_down:
CamperBot
@camperbot
May 10 2017 04:01
:bulb: to format code use backticks! ``` more info
tuanha816
@tuanha816
May 10 2017 04:02
can someone help me with this
"var quotient = 0.0 / 2.0;"
Markus Ivancsics
@ivancsicsmarkus
May 10 2017 04:02
@eddy000
  • Use a for loop to cycle through the contacts list.
  • Use a nested if statement to first check if the firstName matches, and then checks if the prop matches.
  • Leave your return "No such contact" out of the for loop as a final catch-all.
tuanha816
@tuanha816
May 10 2017 04:02
quotient must = 2.2
Christopher McCormack
@cmccormack
May 10 2017 04:02

@longnt80 should read the documentation linked in the exercise:

The value passed as the first parameter is converted to a boolean value, if necessary. If the value is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (""), the object has an initial value of false. If the DOM object document.all is passed as a parameter, the new boolean object also has an initial value of false. All other values, including any object or the string "false", create an object with an initial value of true.

Markus Ivancsics
@ivancsicsmarkus
May 10 2017 04:02
tuanha816
@tuanha816
May 10 2017 04:03
@ivancsicsmarkus im just trying to figure out the division
Jason Luboff
@JLuboff
May 10 2017 04:03
@nsonhouse man, I don't live here...I'm just on a lot..lol but I'd have to look at some notes I have but won't have access until the morning...if you're still have trouble later, send me a PM and I'll get back to you in the morning here. I will say...are your item quantity a number or is it something like "item_quantity - 55"?
tuanha816
@tuanha816
May 10 2017 04:03
it wants to know what x/2.0 would equal 2.2
Christopher McCormack
@cmccormack
May 10 2017 04:03
@longnt80 that said, using typeof may be a lot easier
eddy000
@eddy000
May 10 2017 04:04

@ivancsicsmarkus ```function lookUp( firstName, prop ){

for (var i = 0; i < contacts.length; i++){
if (contacts[i].firstName === firstName) {
if (contacts[i].hasOwnProperty(prop)) {
return contacts[i] [prop];
} else {
return "No such property";
}
}
}
return "No such contact";
```

Long Nguyen
@longnt80
May 10 2017 04:05
@cmccormack
yeah, I read it. Boolean(NaN) should return false.
I just did a google search and NaN is not considered a primitive, hence the return false is required.
Let me try typeof. Thank you.
CamperBot
@camperbot
May 10 2017 04:05
longnt80 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:cookie: 550 | @cmccormack |http://www.freecodecamp.com/cmccormack
eddy000
@eddy000
May 10 2017 04:05
nevermind, had the fucntion name wrong
thanks!
nsonhouse
@nsonhouse
May 10 2017 04:06
@JLuboff item_quantity is a column in my table
Ken Haduch
@khaduch
May 10 2017 04:06
@eddy000 - you need to have the ``` on a line all by itself at the top and bottom of the code. and you can edit the post that you just made for a few minutes after you posted it. Just FYI
tuanha816
@tuanha816
May 10 2017 04:06
Change the 0.0 so that quotient will equal to 2.2.
var quotient = 0.0 / 2.0;
can someone help me
Markus Ivancsics
@ivancsicsmarkus
May 10 2017 04:07
@tuanha816 4.4
@tuanha816 Because 2.2 * 2 is 4.4
tuanha816
@tuanha816
May 10 2017 04:08
@ivancsicsmarkus thanks
CamperBot
@camperbot
May 10 2017 04:08
:cookie: 438 | @ivancsicsmarkus |http://www.freecodecamp.com/ivancsicsmarkus
tuanha816 sends brownie points to @ivancsicsmarkus :sparkles: :thumbsup: :sparkles:
tuanha816
@tuanha816
May 10 2017 04:08
im pretty dumb when it comes to math
lol
Jason Luboff
@JLuboff
May 10 2017 04:09
@nsonhouse so shouldn't it be SET item_quantity = ' + qty + ??
nsonhouse
@nsonhouse
May 10 2017 04:09
@JLuboff I want to subtract the qty from item_quantity
Long Nguyen
@longnt80
May 10 2017 04:10
Capture.JPG
@cmccormack
I tried typeof and all the requirements are met but FCC said boolean is not defined.
Christopher McCormack
@cmccormack
May 10 2017 04:12
@longnt80 typeof(bool) === "boolean"
Markus Ivancsics
@ivancsicsmarkus
May 10 2017 04:12
typeof boolean === "boolean"
@longnt80 typeof returns a string
Jason Luboff
@JLuboff
May 10 2017 04:12
@nsonhouse ah. Hmmm ya I'd have to check my notes on that
Long Nguyen
@longnt80
May 10 2017 04:13
@cmccormack @ivancsicsmarkus
I see, thanks guys :+1:
CamperBot
@camperbot
May 10 2017 04:13
longnt80 sends brownie points to @cmccormack and @ivancsicsmarkus :sparkles: :thumbsup: :sparkles:
:warning: longnt80 already gave cmccormack points
:cookie: 441 | @ivancsicsmarkus |http://www.freecodecamp.com/ivancsicsmarkus
nsonhouse
@nsonhouse
May 10 2017 04:13
@JLuboff OK Thanks
CamperBot
@camperbot
May 10 2017 04:13
nsonhouse sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 1720 | @jluboff |http://www.freecodecamp.com/jluboff
grfraser
@grfraser
May 10 2017 04:18
how do i access the property for this code(my code is wrong) i need to grab 16 for playerNumber
// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;
var playerNumber = testObj[playerNumber];  // Change this Line
var player = testObj[16];   // Change this Line
playerNumber should be a number
The variable player should be a string
The value of player should be "Montana"
You should use bracket notation to access testObj
You should be using the variable playerNumber in your bracket notation
everything is good except "playerNumber should be a number"
i feel like the instructions arent explaining it?
Long Nguyen
@longnt80
May 10 2017 04:21
@grfraser Object.keys
grfraser
@grfraser
May 10 2017 04:22
isnt that what i am doing?
@longnt80
object[value] i suppose. but it says i need the variable playerNumber in brackets
Peter Kay
@deuscode
May 10 2017 04:25
Hey Campers... I'm trying to figure out a way to create a back-end to service my API keys. I cannot seem to find real hard documentation on how to create this.
Can someone point me in the right direction?
I get a lot of brief explanation, but I need something more thorough
grfraser
@grfraser
May 10 2017 04:25
@deuscode do you happen to know the answer to my issue? ^ :worried:
node.js though?
Ken Haduch
@khaduch
May 10 2017 04:27
@grfraser - see that the keys in the object are numbers. You want to set playerNumber to be the number of the item they are looking for, and then testObj[playerNumber] is how you would access it.
Long Nguyen
@longnt80
May 10 2017 04:27
@grfraser
you should assign a number to var playerNumber
remove testObj[playerNumber]
@deuscode
Peter Kay
@deuscode
May 10 2017 04:29
What others said, you need to store the number into your variable playerNumber @grfraser
grfraser
@grfraser
May 10 2017 04:30

what about

You should be using the variable playerNumber in your bracket notation

?

@longnt80 @deuscode
var playerNumber = testObj[1];
doesnt work. i know this has to be simple. im just missing something.
Peter Kay
@deuscode
May 10 2017 04:31
@grfraser you assign the required integer to the variable playerNumber
Long Nguyen
@longnt80
May 10 2017 04:32
@grfraser
that meant after assign a number to playerNumber variable, you use that variable in the variable below which is var player
Peter Kay
@deuscode
May 10 2017 04:32
@grfraser then you return player with the testObj[playerNumber]
grfraser
@grfraser
May 10 2017 04:32
var playerNumber = testObj[1]; 
var playerNumber = testObj[playerNumber];  // Change this Line
var player = testObj[16];
doesnt seem to work, what am i missing?
Peter Kay
@deuscode
May 10 2017 04:33
var playerNumber = 16;
Vamp
@the-vampiire
May 10 2017 04:33
testObj is not an array
its an object
you can not access it using an array index like you are tying with testObj[1]
what is the player number for player “Montana”?
grfraser
@grfraser
May 10 2017 04:34
but i would need to set playerNumber = 16 above the object?
Peter Kay
@deuscode
May 10 2017 04:34
@the-vampiire that is correct, it is an object
@grfraser please disregard my suggestion
@grfraser I am wrong on that part
grfraser
@grfraser
May 10 2017 04:34
it says only change code below the object
@deuscode no worries, im wrong too hahaha
Vamp
@the-vampiire
May 10 2017 04:34
@grfraser answer this question: what is the player number for the player “Montana”?
grfraser
@grfraser
May 10 2017 04:35
16
Vamp
@the-vampiire
May 10 2017 04:35
var playerNumber =
grfraser
@grfraser
May 10 2017 04:35
16
Vamp
@the-vampiire
May 10 2017 04:35
done
next line
playerNumber is now holding the value 16
how will you access the player “Montana” in the testObj?
grfraser
@grfraser
May 10 2017 04:35
var playerNumber = testObj[playerNumber]
Vamp
@the-vampiire
May 10 2017 04:35
no
grfraser
@grfraser
May 10 2017 04:35
but it isnt in the test Obj
Vamp
@the-vampiire
May 10 2017 04:35
we are done with that line
var playerNumber = 16
done
grfraser
@grfraser
May 10 2017 04:36
hmm
Vamp
@the-vampiire
May 10 2017 04:36
dont touch this line anymore
next line
var player = testObj[ ]
whats going in the box
grfraser
@grfraser
May 10 2017 04:36
oh wowww
Vamp
@the-vampiire
May 10 2017 04:36
;)
grfraser
@grfraser
May 10 2017 04:36
i totally misunderstood the assignment
Vamp
@the-vampiire
May 10 2017 04:36
ya
Peter Kay
@deuscode
May 10 2017 04:36
it's accessing the property which is 16
grfraser
@grfraser
May 10 2017 04:37
hahaha thank you so much i knew it was so simple
Long Nguyen
@longnt80
May 10 2017 04:37
yeah the initial code just make it confusing
grfraser
@grfraser
May 10 2017 04:37
@the-vampiire thank you @deuscode @longnt80
CamperBot
@camperbot
May 10 2017 04:37
grfraser sends brownie points to @the-vampiire and @deuscode and @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 278 | @deuscode |http://www.freecodecamp.com/deuscode
:cookie: 382 | @the-vampiire |http://www.freecodecamp.com/the-vampiire
:cookie: 225 | @longnt80 |http://www.freecodecamp.com/longnt80
Peter Kay
@deuscode
May 10 2017 04:37
@the-vampiire do you have any documentation on creating a backend to service API calls by any chance? So that we can hide our API keys from the front end
Vamp
@the-vampiire
May 10 2017 04:37
you could manually put in player = testObj[16] but the point was to assign it to the, aptly named, playerNumber variable
grfraser
@grfraser
May 10 2017 04:38
yeah it made it seem like i should access all variables via object.key or like object.value. is it possible to get object.keys?
Vamp
@the-vampiire
May 10 2017 04:38
then pass this variable into testObj
now the reason they were forcing you to use bracket notation, do you know why?
you cant pass a variable using dot notation
grfraser
@grfraser
May 10 2017 04:38
ohhhh
i didnt know that. they should explain that as well! maybe it will be in the next lesson
Vamp
@the-vampiire
May 10 2017 04:39
for the same reason you can not pass a key that has a space in it
@deuscode no idea
dot notation is a shorthand that converts a string for you when accessing an object property
but it cant convert “two words"
grfraser
@grfraser
May 10 2017 04:39
@deuscode does node not work?
Vamp
@the-vampiire
May 10 2017 04:39
so you use [“two words”] instead
and a variable can not be converted using dot notation because it isnt a string
so you use [variable]
thas the lesson
grfraser
@grfraser
May 10 2017 04:40
i feel like you explained it way better lmao
FelixHakaraia
@FelixHakaraia
May 10 2017 04:40
Hey guys, Im having a little trouble with this one, just lost on multiplying them ha
grfraser
@grfraser
May 10 2017 04:40
some of the instructions are weak
FelixHakaraia
@FelixHakaraia
May 10 2017 04:40

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
for (var i =0; i < arr.length; i++) {
for (var j =0; j < arr[i].length; j++) {
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]]);

Vamp
@the-vampiire
May 10 2017 04:41
function multiplyAll(arr) {
  var product = 1;
  // Only change code below this line
    for (var i =0; i < arr.length; i++) {
      for (var j =0; j < arr[i].length; j++) {
        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]]);
grfraser
@grfraser
May 10 2017 04:41
is it posssible to access a key in a key with certain notation @the-vampiire ?
Joseph
@revisualize
May 10 2017 04:41
@FelixHakaraia product * arr[i][j]); you're just doing math.. You're not assigning the new value to anything.
Vamp
@the-vampiire
May 10 2017 04:41
@grfraser I dont understand the question
FelixHakaraia
@FelixHakaraia
May 10 2017 04:41
ooooooh
Joseph
@revisualize
May 10 2017 04:41
@FelixHakaraia Also, what's the ) for?
Long Nguyen
@longnt80
May 10 2017 04:41
@grfraser
you meant access the key in a property?
FelixHakaraia
@FelixHakaraia
May 10 2017 04:41
@revisualize That was just a remnant from the last thing i tried
grfraser
@grfraser
May 10 2017 04:42
like how we accessed the value of the key of the object. can you access the key of a certain value of an object? @longnt80 @the-vampiire
FelixHakaraia
@FelixHakaraia
May 10 2017 04:42
@revisualize Awesome once I assigned the result to the product variable it worked, thanks!
CamperBot
@camperbot
May 10 2017 04:42
felixhakaraia sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 3929 | @revisualize |http://www.freecodecamp.com/revisualize
grfraser
@grfraser
May 10 2017 04:42
like using notation to grab that 16
Vamp
@the-vampiire
May 10 2017 04:42
easiest way to access (view) all the property keys is to pass them as an array using the Object.keys() method
var keys = Object.keys(testObj); // keys = [ array of keys ]
well not exactly
grfraser
@grfraser
May 10 2017 04:43
good ol mdn
well not exactly/ ? is there an easier way?
Vamp
@the-vampiire
May 10 2017 04:44
you have to make your own function
there is no built in method that does this
grfraser
@grfraser
May 10 2017 04:45
oh okay thats all i was wondering thank you @the-vampiire
CamperBot
@camperbot
May 10 2017 04:45
grfraser sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:warning: grfraser already gave the-vampiire points
Vamp
@the-vampiire
May 10 2017 04:47
function getKey(obj, value){
    for(var prop in obj){
        if(obj.hasOwnProperty(prop)){
            if(obj[prop] === value){
                return prop;
            }
        }
    }
}
i think this works...
grfraser
@grfraser
May 10 2017 04:47
@deuscode did you ever get your answer
?
Peter Kay
@deuscode
May 10 2017 04:47
@grfraser nope but thanks
CamperBot
@camperbot
May 10 2017 04:47
deuscode sends brownie points to @grfraser :sparkles: :thumbsup: :sparkles:
:cookie: 213 | @grfraser |http://www.freecodecamp.com/grfraser
Vamp
@the-vampiire
May 10 2017 04:47
so you would pass it the object and the value you want the property for
grfraser
@grfraser
May 10 2017 04:47
does node not work
?
i am a noob to js
Vamp
@the-vampiire
May 10 2017 04:48
var prop = getKey(obj, value); 
console.log(prop); // property?
Peter Kay
@deuscode
May 10 2017 04:48
I'm sure it does, but I need documentation on how to implement it on the back-end
grfraser
@grfraser
May 10 2017 04:48
yeah @the-vampiire youd have to make it work. funny there isn’t a method for that
Vamp
@the-vampiire
May 10 2017 04:48
kinda curious if it works now
grfraser
@grfraser
May 10 2017 04:48
learnnode.com
Peter Kay
@deuscode
May 10 2017 04:48
@grfraser that cost money
grfraser
@grfraser
May 10 2017 04:48
yeah but hes a boss
check udemy
there may be free courses on it
like django, flask, meteor!, node
Peter Kay
@deuscode
May 10 2017 04:50
need to create an API that holds API Keys that in turn my webapp needs to make an AJAX call
Vamp
@the-vampiire
May 10 2017 04:50
hah
it worked
var testObj = {
    'grfraser':'test1',
    'vampiire':'test2'
};

function getKey(obj, value){
    for(var prop in obj){
        if(obj.hasOwnProperty(prop)){
            if(obj[prop] === value){
                return prop;
            }
        }
    }
}

var prop = getKey(testObj, 'test1');

console.log(prop); // grfaser
grfraser
@grfraser
May 10 2017 04:50
thats above my head, i really wish i could help you man
@the-vampiire hahaaa thats sick! im amazed there isnt a simple built in method for that
Vamp
@the-vampiire
May 10 2017 04:51
i wrote that in the chat here and it actually worked lol
what a surprise
usually have some bs to work out that i messed up typing it
ya im surprised too
FelixHakaraia
@FelixHakaraia
May 10 2017 04:51
How do i copy and paste code so that it shows up in chat right? I have another question hahah
Vamp
@the-vampiire
May 10 2017 04:51
probably some deeper reason for that
@FelixHakaraia
```js
new line
past code here
new line
```
FelixHakaraia
@FelixHakaraia
May 10 2017 04:52
@the-vampiire thanks
CamperBot
@camperbot
May 10 2017 04:52
felixhakaraia sends brownie points to @the-vampiire :sparkles: :thumbsup: :sparkles:
:cookie: 383 | @the-vampiire |http://www.freecodecamp.com/the-vampiire
Vamp
@the-vampiire
May 10 2017 04:52
where js is whatever language the code is in
FelixHakaraia
@FelixHakaraia
May 10 2017 04:52
'''js
CamperBot
@camperbot
May 10 2017 04:52
:bulb: to format code use backticks! ``` more info
Long Nguyen
@longnt80
May 10 2017 04:52
@the-vampiire
can you explain for(var prop in obj)
Vamp
@the-vampiire
May 10 2017 04:52
@FelixHakaraia not single quote, its a backtick. key up by the esc key
grfraser
@grfraser
May 10 2017 04:52
@the-vampiire we are learning es5 js correct?
Vamp
@the-vampiire
May 10 2017 04:52
@longnt80 sure its a shorthand way of iterating through an object
FelixHakaraia
@FelixHakaraia
May 10 2017 04:53

//Setup
var contacts = [
    {
        "firstName": "Akira",
        "lastName": "Laine",
        "number": "0543236543",
        "likes": ["Pizza", "Coding", "Brownie Points"]
    },
    {
        "firstName": "Harry",
        "lastName": "Potter",
        "number": "0994372684",
        "likes": ["Hogwarts", "Magic", "Hagrid"]
    },
    {
        "firstName": "Sherlock",
        "lastName": "Holmes",
        "number": "0487345643",
        "likes": ["Intriguing Cases", "Violin"]
    },
    {
        "firstName": "Kristian",
        "lastName": "Vos",
        "number": "unknown",
        "likes": ["Javascript", "Gaming", "Foxes"]
    }
];


function lookUpProfile(firstName, prop){
// Only change code below this line
    for (var i =0; i < contacts.length; i++) {
      if (firstName == contacts[i] && contacts[i].hasOwnProperty(prop)) {
           return contacts[i];
      }
    }
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Akira", "likes");
I think I'm missing a for loop?
Elijah White
@elijahwhite97
May 10 2017 04:53
hey guys, I'm at the bit in the js course where you make "Golf Code", needing to create a function taking the arguments par and stroketo output golf scores in strings, and my function is basically a bunch of if else if statements. But i keep getting RangeError: Maximum call stack exceeded, What should i do? any ideas for a different function?
grfraser
@grfraser
May 10 2017 04:54
@the-vampiire also what did you use to test your code?
Vamp
@the-vampiire
May 10 2017 04:54
webstorm
@FelixHakaraia no your loop is fine, its the contents in it that are a bit off
grfraser
@grfraser
May 10 2017 04:55
and we learn es5 true?
@the-vampiire
Vamp
@the-vampiire
May 10 2017 04:55
i dont know what you mean
I have only learned es5, ya
grfraser
@grfraser
May 10 2017 04:56
oh you used your own ide to check it
Vamp
@the-vampiire
May 10 2017 04:56
ya
grfraser
@grfraser
May 10 2017 04:56
sweet, im pretty new to js started out with python
Vamp
@the-vampiire
May 10 2017 04:56
its called webstorm
grfraser
@grfraser
May 10 2017 04:56
dont you have to pay
Vamp
@the-vampiire
May 10 2017 04:56
I did too with python
grfraser
@grfraser
May 10 2017 04:56
it sasys 30 day free trial
lol thats funny
Vamp
@the-vampiire
May 10 2017 04:56
did 1 month of python as my first language then joined FCC
I miss python
so powerful
grfraser
@grfraser
May 10 2017 04:56
5 months here, we will get back to it after we conquer the web lmao
Vamp
@the-vampiire
May 10 2017 04:57
I taught myself enough python to do algorithm challenges. thats what got me sucked into coding
i like solving problems
grfraser
@grfraser
May 10 2017 04:57
yeah i like building things
lol :smile:
Vamp
@the-vampiire
May 10 2017 04:57
webstorm is free for one year if you have student email address
luckily I still ad mine even though I graduated already lol
grfraser
@grfraser
May 10 2017 04:57
is it the best, i guess?
FelixHakaraia
@FelixHakaraia
May 10 2017 04:57
@the-vampiire Do I need to fix what I'm returning?
Vamp
@the-vampiire
May 10 2017 04:57
they didnt say im a current student!
grfraser
@grfraser
May 10 2017 04:57
haha yeah i got mine ready to go just graduated last year
Vamp
@the-vampiire
May 10 2017 04:57
well idk if its the best but I like it very much. i will buy it when the year is up
i used pycharm too
grfraser
@grfraser
May 10 2017 04:58
in a completely unrelated field
Vamp
@the-vampiire
May 10 2017 04:58
you get the whole intelliJ suite free for a year with student id
email*
grfraser
@grfraser
May 10 2017 04:58
i used to used that
pycharm
still do when i do python its great\
Vamp
@the-vampiire
May 10 2017 04:58
@FelixHakaraia unfortunately you need to fix quite a few things my man
grfraser
@grfraser
May 10 2017 04:58
heard netbeans was good, seems crappy
Vamp
@the-vampiire
May 10 2017 04:58
i tried that and eclipse
so convoluted
I like to just get to the point. those two were so clunky and confusing
FelixHakaraia
@FelixHakaraia
May 10 2017 04:59
@the-vampiire Aw man, ahah I'll have another few tries and come back
Vamp
@the-vampiire
May 10 2017 04:59
lol
for starters
you must consider wht contacts[i] is
contacts[i] is the contact array within your contacts object
Peter Kay
@deuscode
May 10 2017 04:59
@FelixHakaraia so you're going to need to use nested loops for this
Vamp
@the-vampiire
May 10 2017 04:59
think of it like contacts object is a roledex and each contact “card” is contacts[i]
@deuscode nah one loop will do
nested if statmenet though
Peter Kay
@deuscode
May 10 2017 05:00
I'm sorry not 2 loops
Vamp
@the-vampiire
May 10 2017 05:00
statements*
Peter Kay
@deuscode
May 10 2017 05:00
but nested statements
grfraser
@grfraser
May 10 2017 05:00
i got intellij idea ce ready to install @the-vampiire
same with eclipse but if it isnt good.. lol
Peter Kay
@deuscode
May 10 2017 05:00
one for the first name and then the other to go through if the contact has the property
Vamp
@the-vampiire
May 10 2017 05:00
idea isnt that for java?
Peter Kay
@deuscode
May 10 2017 05:01
if both return true, then you should return the contact's name and property
Vamp
@the-vampiire
May 10 2017 05:01
well let the man think lol
teach him to fish dont hold the rod
abraham anak agung
@padunk
May 10 2017 05:02
Hi guys, could someone check my code here? https://repl.it/Hpuk/1
why the same word aab return different boolean? one is true, one is false?
grfraser
@grfraser
May 10 2017 05:03
yes idea is for java apparently, thats what i actually just read lol @deuscode
Peter Kay
@deuscode
May 10 2017 05:03
hahah he has the answer
grfraser
@grfraser
May 10 2017 05:03
source: jetbrains.com lmao
Peter Kay
@deuscode
May 10 2017 05:03
he's just getting mixed up on the conditional statements
FelixHakaraia
@FelixHakaraia
May 10 2017 05:06
function lookUpProfile(firstName, prop){
// Only change code below this line
    for (var i =0; i < contacts.length; i++) {
      if (firstName == contacts[i].firstName) {
        if (contacts[i][prop]) {
          return contacts[prop];
        } else { 
          return "No such contact";
        } else {
          return "No such property";
        }
      }
Is this closer?
tuanha816
@tuanha816
May 10 2017 05:06
im confused
Peter Kay
@deuscode
May 10 2017 05:06
@FelixHakaraia you have an incomplete if statement on the second one
tuanha816
@tuanha816
May 10 2017 05:07
whats the difference between var farenheight; vs farenheight = 23
FelixHakaraia
@FelixHakaraia
May 10 2017 05:07
@deuscode Missed a } yup haha
Vamp
@the-vampiire
May 10 2017 05:07
@padunk i have no idea tha’ts very strange
looks correct to me
Peter Kay
@deuscode
May 10 2017 05:08
@FelixHakaraia negative, your if(contacts[i][prop]) is not stating anything
Vamp
@the-vampiire
May 10 2017 05:08
@padunk something wrong with that website. i run this same code in my IDE and it works as expected
FelixHakaraia
@FelixHakaraia
May 10 2017 05:08
@deuscode ooooh hmmmm
Peter Kay
@deuscode