13th
Jul 2017
kumquatfelafel
@kumquatfelafel
Jul 13 2017 00:01
@MCTwoDigitZero something along these lines? https://api.jquery.com/keypress/
may have to modify depending on what you're trying to do
awwsoclose
@awwsoclose
Jul 13 2017 00:02
i currently have the first letter of each word capitalize in another array. so what i'm thinking is making another array containing the rest of the letters uncapitalized and then somehow joining them
kumquatfelafel
@kumquatfelafel
Jul 13 2017 00:02
@Chasls sorry for delay
Jul 13 2017 00:03
@awwsoclose - you should take your code and try to run it on http://pythontutor.com/javascript.html - see what's happening with it! A great way to learn and debug.... paste your code in there and hit the "Visualize Execution" button...
Chasls
@Chasls
Jul 13 2017 00:03
@kumquatfelafel its okay
So I had some give me the answer to it which doesn't help me understand it..
Nefton
@neftonjin
Jul 13 2017 00:03

var oldArray = [1,2,3,4,5];

// Only change code below this line.

var newArray = oldArray.map(function(val){ return val + 3;  }    );
Hi can anyone explain me the logic behind this . How is Val conectet with the itemes in the array ?
Chasls
@Chasls
Jul 13 2017 00:04
@kumquatfelafel
return count + (count > 0 ? " Bet" : " Hold");
kumquatfelafel
@kumquatfelafel
Jul 13 2017 00:11

@Chasls okay. So when you say return count + (count > 0), what you are saying is logically similar to

if (count > 0)
return count + 1;
else
return count + 0;

The first part of understanding this is to know that count > 0 has a value of either true or false depending whether the condition, count > 0, is true. The next aspect of this is that when you say count + true; or count + false;, and count is a number... you might think, "well, addition here doesn't make sense... it can't be done". But javascript doesn't see it this way. When it comes to numeric addition, true is treated as 1, and false is treated as 0. Thus, the above.

This is not what you want.

What you want is for it to say the count, then depending on the value of count you will say whether they should bet or hold.

Jul 13 2017 00:12
@neftonjin - the operation of the .map() (and the other higher-order array functions) is to pass each element of the array in succession to the callback function. So val will assume the value of each array element in turn.
dylantelson
@dylantelson
Jul 13 2017 00:13
Hey guys, quick really easy question
Jul 13 2017 00:13
dylantelson
@dylantelson
Jul 13 2017 00:13
so I'm trying to build the weather website, and I'm using an API from darksky which is working well
the JSON is like {
"latitude": 47.20296790272209,
"longitude": -123.41670367098749,
"timezone": "America/Los_Angeles",
"currently": {
"time": 1453402675,
"summary": "Rain",
"icon": "rain",
CallMeOrange
@EgnaroDev
Jul 13 2017 00:13
so?
dylantelson
@dylantelson
Jul 13 2017 00:13
so I grab the timezone, which works, BUT
kumquatfelafel
@kumquatfelafel
Jul 13 2017 00:14
@Chasls ? is what's known as the conditional/ternary operator. It's a bit like it looks at the condition you provided, and instead of returning true or false it returns the specified values (in this case, "Bet" or "Hold")
dylantelson
@dylantelson
Jul 13 2017 00:14
it doesnt say the country name sometimes while sometimes saying it, so I gotta find another way to get the country name
CallMeOrange
@EgnaroDev
Jul 13 2017 00:14
@dylantelson No they are just timezone
Use this instead https://ipinfo.io/json for location
dylantelson
@dylantelson
Jul 13 2017 00:14
I tried that, but got confused
lemme see if I can do it real quick
CallMeOrange
@EgnaroDev
Jul 13 2017 00:14
Use another $.getJSON dylantelson @dylantelson Jul 13 2017 00:15 yup, that's what I tried I'll try again, didn't give it much of a shot tbh Chasls @Chasls Jul 13 2017 00:15 ohhh @kumquatfelafel That makes way way more since! Seriously. and you even knew the questions mark was throwing me off. CallMeOrange @EgnaroDev Jul 13 2017 00:15 $.getJSON...{

});

$.getJSON...{ }); dylantelson @dylantelson Jul 13 2017 00:15 mostly it's that I want it to be able to grab the country name based on coordinates because I don't want to limit it to just the person's location I want to make it so the person can put in another location CallMeOrange @EgnaroDev Jul 13 2017 00:16 That... I cant help you :/ dylantelson @dylantelson Jul 13 2017 00:16 so if I'm living in NY, USA but put in Warsaw, Poland I want to be able to get the country name Chasls @Chasls Jul 13 2017 00:16 @kumquatfelafel Okay Im going to redo it from scratch to see if I can get a practical understanding. That makes a lot of since. Thank you! (re-writing helps me retain) CamperBot @camperbot Jul 13 2017 00:16 chasls sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles: :cookie: 460 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel CallMeOrange @EgnaroDev Jul 13 2017 00:16 @dylantelson I understand dylantelson @dylantelson Jul 13 2017 00:16 which work s fine if I'm using coordinates for the timezone but doesnt say country yeah, I guess I'll keep on searching thanks though :) CallMeOrange @EgnaroDev Jul 13 2017 00:16 No problem awwsoclose @awwsoclose Jul 13 2017 00:16 i just cannot seem to slice off the first letter of each word in an array...can someone point me to a website or something that explains it to me? CallMeOrange @EgnaroDev Jul 13 2017 00:17 so you want to get word from an array with first letter of that word removed? dylantelson @dylantelson Jul 13 2017 00:17 have you been reading about slice() on mdn and w3schools and shit? eyesore- @eyesore- Jul 13 2017 00:18 @dylantelson You can use the geocode API from Google. CallMeOrange @EgnaroDev Jul 13 2017 00:18 @eyesore- nice name lol Ken Haduch @khaduch Jul 13 2017 00:18 @awwsoclose - you can access individual characters in a string with array indexing to read them, but you cannot write them that way. So you could to array[i][0] to get the first character of a word at array index i CallMeOrange @EgnaroDev Jul 13 2017 00:18 Your name sure is eyesore dylantelson @dylantelson Jul 13 2017 00:18 this? eyesore- @eyesore- Jul 13 2017 00:18 @dylantelson Thank you haha yeah CamperBot @camperbot Jul 13 2017 00:18 eyesore- sends brownie points to @dylantelson :sparkles: :thumbsup: :sparkles: :warning: @dylantelson's account is not linked with freeCodeCamp. Please visit the settings and link your GitHub account. eyesore- @eyesore- Jul 13 2017 00:19 @dylantelson It has reverse coordinate lookup awwsoclose @awwsoclose Jul 13 2017 00:19 I'm trying to do the title case a sentence challenge. So what I did is I have an array that has the first letter of each word capitalize. so now my thought process is to somehow slice off the first letter and replace those letters with the capital letters if that's even possible Ken Haduch @khaduch Jul 13 2017 00:19 @khaduch - then you could use .slice() to get the remainder of the word and append it to the first character (after uppercasing the first character.) and then store that concatenated word back into the array. dylantelson @dylantelson Jul 13 2017 00:19 I'll try it and brb @eyesore- so with this for example https://jsfiddle.net/dqL6hn2t/ Ken Haduch @khaduch Jul 13 2017 00:23 @awwsoclose - look at how .slice() works - with it you can extract part of an array (which a string is an array of letters. hint, hint) you are actually slicing a string, there is a String.slice() method. Slice off the last part of the word, append it to the first uppercased letter, and put that back in your array of words. awwsoclose @awwsoclose Jul 13 2017 00:24 learn javascript they said....IT'LL BE FUN THEY SAID dylantelson @dylantelson Jul 13 2017 00:24 that is what I'm getJSONing, how should I get the actual name of the country? (data is the function element) data.results.address_components[6].long_name? awwsoclose @awwsoclose Jul 13 2017 00:24 can i somehow shove it all into a for loop? eyesore- @eyesore- Jul 13 2017 00:25 @dylantelson Yeah, just like that @dylantelson I actually think its data.results[0].adress_components so and so dylantelson @dylantelson Jul 13 2017 00:28 yeah, it isnt working rn, ill try that why would you do data.results[0]? isnt results just data[0]? nooo i mean isnt address_components just results[0] eyesore- @eyesore- Jul 13 2017 00:30 @dylantelson Results is an array of objects. dylantelson @dylantelson Jul 13 2017 00:30 country = data.results[0].address_components[5].long_name; so you think it should be like this? just returns undefined eyesore- @eyesore- Jul 13 2017 00:31 Show me your code. This is a small example in ES6 const URI = { geolocate: 'https://www.googleapis.com/geolocation/v1/geolocate?key=', geocode: 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' } let getGeocode = (lat, lng) => ( fetch(${URI.geocode}${lat},${lng}&key=${API_KEY}, {method: 'GET'}) .then(res => res.json()) ) const geoLocate = () => { return fetch(${URI.geolocate}${API_KEY}, {method: 'POST'}) .then(res => res.json()) .then(data => getGeocode(data.location.lat, data.location.lng)) } console.log(geoLocate().then(data => console.log(data))) dylantelson @dylantelson Jul 13 2017 00:31 aight, it's a reaaaaal mess tho eyesore- @eyesore- Jul 13 2017 00:31 It's cool. I just used the geolocate to grab the lat and lng dylantelson @dylantelson Jul 13 2017 00:32 Mike @MikeJSchorah Jul 13 2017 00:33 Do I need to be able to understand JavaScript algorithms in order to use AngularJS? awwsoclose @awwsoclose Jul 13 2017 00:33 should i use a substring somewhere? dylantelson @dylantelson Jul 13 2017 00:33 Please don't judge tidiness, i am not a current master of minimizing code length :D awwsoclose, what challenge are you doing again? replace 1st letter with cpaital? capitalize 1st letter of each word in array rather awwsoclose @awwsoclose Jul 13 2017 00:34 yeah dylantelson @dylantelson Jul 13 2017 00:34 or is it titlecase a sentence? awwsoclose @awwsoclose Jul 13 2017 00:34 titlecase a sentence Mike @MikeJSchorah Jul 13 2017 00:35 Does anyone know anything about AngularJS? awwsoclose @awwsoclose Jul 13 2017 00:36 oh jeebus christmas i figured it out i think i didn't splice anything though dylantelson @dylantelson Jul 13 2017 00:37 you odnt have to splice awwsoclose @awwsoclose Jul 13 2017 00:37 is this legit function titleCase(str) { str = str.toLowerCase(); var arrayOne = str.split(" "); for (i=0; i<arrayOne.length; i++){ arrayOne[i]=arrayOne[i].charAt(0).toUpperCase() + arrayOne[i].substring(1); } str = arrayOne.join(" "); return str; } dylantelson @dylantelson Jul 13 2017 00:37 does it work? Mike @MikeJSchorah Jul 13 2017 00:38 No AngularJS using folk in here? :/ dylantelson @dylantelson Jul 13 2017 00:38 nope :( kumquatfelafel @kumquatfelafel Jul 13 2017 00:38 @awwsoclose if you add js after first set of back ticks, like js it won't do that weird thing where it makes it look like you've commented out most of your function. (i.e. more properly formatted) eyesore- @eyesore- Jul 13 2017 00:39 @MikeJSchorah I know Angular. Just give me a bit dylantelson @dylantelson Jul 13 2017 00:39 yo eyesore, did you see the jsfiddle Mike @MikeJSchorah Jul 13 2017 00:39 @eyesore Do you need to know JavaScript algorithms in order to use AngularJS? eyesore- @eyesore- Jul 13 2017 00:40 @dylantelson Sorry man, I moved it to a jsbin because I didnt know how to bring out the console in jsfiddle /: @dylantelson Give me like 2 minutes. dylantelson @dylantelson Jul 13 2017 00:40 all g, i dont know anything about jsfiddle/bin etc. other than using it to show code without crowding the chat eyesore- @eyesore- Jul 13 2017 00:40 @MikeJSchorah What do you mean? Mike @MikeJSchorah Jul 13 2017 00:41 @eyesore Which is more important for front end development: AngularJS or JavaScript algorithms? eyesore- @eyesore- Jul 13 2017 00:42 @MikeJSchorah Well Angular is a framework to help make web apps. I guess what I'm trying to ask is what do you mean by javascript algorithms? Like knowing recursion and different data structures? Mike @MikeJSchorah Jul 13 2017 00:44 @eyesore Yes. I have mastered HTML/CSS. I have learned a great deal about JavaScript. I have also learned other technologies. I have received compliments on my portfolio. I have even dabbled in NodeJS with MongoDB and PHP with MySQL. Before I look for a front end developer job, I would like to learn one more thing. Which of the two is more important for getting a front end job: getting good at JavaScript algorithms or learning AngularJS? Ken Haduch @khaduch Jul 13 2017 00:46 @awwsoclose @awwsoclose - it seems that your code is working for some cases? What are you failing in the tests? eyesore- @eyesore- Jul 13 2017 00:46 @dylantelson Different countries are going to give you less or more results. @dylantelson You can ask for just specific things though. Like just country. https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding Ken Haduch @khaduch Jul 13 2017 00:48 @awwsoclose - your code does work - I just pasted it into my challenge and ran it, it passes the tests? kumquatfelafel @kumquatfelafel Jul 13 2017 00:49 @MikeJSchorah Question is kind of vague. As a front-end developer, you're hardly likely to be writing a super complex AI for a program for example, if that's what your asking. That being said... :point_down: eyesore- @eyesore- Jul 13 2017 00:49 @MikeJSchorah I'm sorry, but mastering HTML/CSS is really not going to land you a job now a days /: You really need to learn the fundamentals of javascript. If you are super serious about programming and becoming a developer you should really focus on learning cs fundamentals. Then dive into libraries and frameworks like Angular, React, Vue, or whatever you want. @MikeJSchorah If you aren't familiar with high order functions or object oriented programming then that is somewhere good to start. Christopher Blakely @chrisbchrist Jul 13 2017 00:54 Trying to solve the Steamroller challenge and recursion confuses me, can someone tell me what I'm doing wrong? function steamrollArray(arr) { // I'm a steamroller, baby var notArrays = []; for (var i = 0; i < arr.length; i++) { if (Array.isArray(arr[i])) { steamrollArray(arr[i]); } else { notArrays.push(arr[i]); } } return notArrays; } kumquatfelafel @kumquatfelafel Jul 13 2017 00:54 @chrisbchrist For future: if you write it in a code block, it makes it easier to read and allows you to do some formatting. To write it in a code block... for one line:  code goes here  or for multiple lines vvv  code goes here  You can also edit your post if you make a mistake by clicking the â€¦ that appears when you hover your mouse over your comment. dylantelson @dylantelson Jul 13 2017 00:54 hmm, @eyesore- , sorry for asking so much but there's something weird goin on google = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' + latitude + ',' + longitude + '&key=AIzaSyAkcb1ZbUd2chBrO411FO4NZlhSPpWbF2I';$.getJSON(google, function(data) {
country = 5;
console.log("1");
});
console.log(country);
Mike
@MikeJSchorah
Jul 13 2017 00:54
@eyesore Sorry. I have learned the fundamentals. Thought I put that in there unless you're talking about data structures and algorithms. I understand that you are recommending a CS degree, but I've seen people become developers without a CS degree quite a few times.
@eyesore What is a high order function?
Christopher Blakely
@chrisbchrist
Jul 13 2017 00:55
@kumquatfelafel Sorry didn't know that, will do going forward :D
dylantelson
@dylantelson
Jul 13 2017 00:55
this prints first 1, then "undefined" dunno why it would be undefined considering i just set it as 5
eyesore-
@eyesore-
Jul 13 2017 00:55
@MikeJSchorah Those are the fundamentals. Oh, I'm not recommending that at all. You don't need to have a cs degree to learn cs concepts. Which is something you do need to understand.
kumquatfelafel
@kumquatfelafel
Jul 13 2017 00:55
@chrisbchrist np. No offense has been committed. :p
Mike
@MikeJSchorah
Jul 13 2017 00:56
@kumquatfelafel I thought the question was clear: Should I focus on learning more about JavaScript algorithms or AngularJS? If I'm a rookie I'm obviously not going to try to learn super complex AI.
kumquatfelafel
@kumquatfelafel
Jul 13 2017 00:56
@MikeJSchorah You don't need a CS degree to learn AngularJS or Javascript in general.
eyesore-
@eyesore-
Jul 13 2017 00:56
@MikeJSchorah A higher order function is something like .reduce or .map
Christopher Blakely
@chrisbchrist
Jul 13 2017 00:56
@kumquatfelafel Haha I always wondered how you generated it as formatting, thanks
CamperBot
@camperbot
Jul 13 2017 00:56
chrisbchrist sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
Mike
@MikeJSchorah
Jul 13 2017 00:57
@eyesore So focus on learning JavaScript data structures and algorithms before I start learning AngularJS?
Christopher Blakely
@chrisbchrist
Jul 13 2017 00:57
@dylantelson what are you trying to do with your JSON request
eyesore-
@eyesore-
Jul 13 2017 00:59
@MikeJSchorah Yes. I feel bad just saying "Go learn algorithms" because that is extremely vague, but yes you should learn about data structures, different data types. Object oriented programming. Functional programming. The different between them and so on.
@dylantelson I'm not sure why it is doing that, but add some parameters so you only get country or whatever else you are looking for.
@MikeJSchorah Also, I would suggest to start with React and then go to Angular.
Mike
@MikeJSchorah
Jul 13 2017 01:02
@eyesore Why React? It's easier? I hear Angular is more in demand
@eyesore Thanks. Are there any sorts of algorithms to learn? Will Free Code Camp's algorithms be enough?
CamperBot
@camperbot
Jul 13 2017 01:03
mikejschorah sends brownie points to @eyesore :sparkles: :thumbsup: :sparkles:
eyesore-
@eyesore-
Jul 13 2017 01:04
@MikeJSchorah React has a 1 way data binding so it is easier to follow data around in which Angular is 2 way. React is also much lighter than Angular. As far as demand goes it depends what market you are in.
CallMeOrange
@EgnaroDev
Jul 13 2017 01:05
@MikeJSchorah try www.codewars.com and www.codefights.com after you learn JS
That is where you can practice with algorithms
eyesore-
@eyesore-
Jul 13 2017 01:05
@MikeJSchorah Umm I've never actually done FCC completely.
Mike
@MikeJSchorah
Jul 13 2017 01:07
@MCTwoDigitZero @eyesore So should I learn basic algorithms/data structures or go all out and use codewars.com/codefights.com?
@eyesore and regarding what you said earlier... I've actually had MORE interviews where they asked me about my HTML/CSS skills compared to interviews where I actually need to solve an algorithm challenge ;)
eyesore-
@eyesore-
Jul 13 2017 01:08
@MikeJSchorah On a scale of 1-10 where do you think you stand in JS?
CallMeOrange
@EgnaroDev
Jul 13 2017 01:08
^ need to know too :/
But if you are new to JS, I wouldn't just use codewars/codefights
Learn JS first and try to complete some algorithms here
Mike
@MikeJSchorah
Jul 13 2017 01:09
@eyesore Do you want an honest opinion or the bullshit that people usually feed people? And exactly what are we talking about here--understanding the fundamentals or mastering JavaScript? I hear mastering JavaScript can take 5-10 years...
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:10

I am at like a 3 can someone tell me why I don't understand recursion?
'''
function steamrollArray(arr) {
// I'm a steamroller, baby
var notArrays = [];
for (var i = 0; i < arr.length; i++) {
if (Array.isArray(arr[i])) {
steamrollArray(arr[i]);
} else {
notArrays.push(arr[i]);
}
}
return notArrays;
}

steamrollArray([1, [2], [3, [[4]]]]);
'''

CamperBot
@camperbot
Jul 13 2017 01:10
:bulb: to format code use backticks!  more info
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:10
Well that didn't work. Oh. backticks
CallMeOrange
@EgnaroDev
Jul 13 2017 01:10
:+1:
eyesore-
@eyesore-
Jul 13 2017 01:10
@MikeJSchorah Yeah man, give me your honest opinion.
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:11
function steamrollArray(arr) {
// I'm a steamroller, baby
var notArrays = [];
for (var i = 0; i < arr.length; i++) {
if (Array.isArray(arr[i])) {
steamrollArray(arr[i]);
} else {
notArrays.push(arr[i]);
}
}
return notArrays;
}

steamrollArray([1, [2], [3, [[
]]]]);
eyesore-
@eyesore-
Jul 13 2017 01:11
@MikeJSchorah Languages change and evolve over time so yeah mastering is never going to happen.
CallMeOrange
@EgnaroDev
Jul 13 2017 01:11
Im doing Intermediate Front End Development Projects and on scale 1-10 of JS, I think Im at 3-4
No wait... I think 1-2...
Just saying
kumquatfelafel
@kumquatfelafel
Jul 13 2017 01:12
@eyesore Agreed. New functions, new syntax, and occasionally old stuff just... stops working :o
eyesore-
@eyesore-
Jul 13 2017 01:13
Yeah, breaking changes are the worse.
CallMeOrange
@EgnaroDev
Jul 13 2017 01:13
I agree too, mastering some languages are going to be impossible because of changing...
Even if it is not changing, I still think mastering it won't happen
Mike
@MikeJSchorah
Jul 13 2017 01:15
@eyesore- Yeah, but what scale do you want it on? If you're asking me if I could go through an entire course on JavaScript without getting lost, then I'd say an 9. If you're asking me how I'd do in a Senior JavaScript development role, then probably a 2.
eyesore-
@eyesore-
Jul 13 2017 01:16
I know you said that you mastered HTML/CSS, but when you get into programming languages I would really advice to not look to master the language. Look to solidifying cs concepts because that is what is going to help you move from language to language and keep you relevant.
@MikeJSchorah Okay, I guess it's better if I just ask small things. Like the understanding of data types, how do you feel there?
@MikeJSchorah That's too easy. Methods and method chaining, how do feel about that?
@chrisbchrist Your code works man, did you still need help on that?
Mike
@MikeJSchorah
Jul 13 2017 01:19
data types = 9, methods/method-chaining = 5
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:20
@eyesore- It won't pass the test, it only returns the first element that is not an array, not all the elements from within the existing ones
eyesore-
@eyesore-
Jul 13 2017 01:20
@chrisbchrist What is the lesson?
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:21
Flatten this array of nested arrays into a single one containing all the non-array elements @eyesore-
kumquatfelafel
@kumquatfelafel
Jul 13 2017 01:22
@chrisbchrist It's because notArrays is not the same notArrays in each function call, so you've got a return, but nothing's actually being done with it.
eyesore-
@eyesore-
Jul 13 2017 01:23
@MikeJSchorah Do you think you would be able to reimplement your own version of reduce or map? That would really solidify your understanding in methods and higher order functions.
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:24
@kumquatfelafel Ah I just need to declare it before the function
Mike
@MikeJSchorah
Jul 13 2017 01:24
@eyesore- I've never really used those methods. I've used reduce a couple of times. I don't think I've ever used .map.
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:25
@kumquatfelafel Although weirdly enough, even though it is now returning all of the correct answers, it still won't pass the challenge
kumquatfelafel
@kumquatfelafel
Jul 13 2017 01:25
@chrisbchrist Well... not quite.
@chrisbchrist I imagine you now have something like var notArrays = []; outside of your function?
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:27
@kumquatfelafel Exactly! It seems to be functioning, although maybe I've broken some cardinal rule about global variables
kumquatfelafel
@kumquatfelafel
Jul 13 2017 01:28
@chrisbchrist FCC runs multiple tests on function (though only one is shown in provided console to left). So it may appear to be working, but you are indeed running into a problem as a result of your global variable.
eyesore-
@eyesore-
Jul 13 2017 01:28
@MikeJSchorah Honestly, I think you should go through the different methods and understand what they do. Build an app without using jquery. A big thing that helped me is to not use small libraries without knowing what they are doing or being able to implement something on my own. I really don't think you are a 9 like you said. I'm sure you've heard of the imposter syndrome and how bad it can be, but the opposite is the same.
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:29
@kumquatfelafel How would I effectively store data inside a recursive function? Or should I just make the array check its own function within it
kumquatfelafel
@kumquatfelafel
Jul 13 2017 01:29
So say as result of the first function call, you have notArrays as [1,2,3,4,5]. It remains [1,2,3,4,5]. So the next time you call the function, you're pushing onto the array [1,2,3,4,5].
Mike
@MikeJSchorah
Jul 13 2017 01:29
@eyesore I have built apps without jQuery. I never really learned jQuery. I've only learned vanilla JS.
Are you telling me to learn every JavaScript library?
eyesore-
@eyesore-
Jul 13 2017 01:30
No I'm not.
Mike
@MikeJSchorah
Jul 13 2017 01:30
I've never really used jQuery because I hear that it's an unnecessary crutch.
eyesore-
@eyesore-
Jul 13 2017 01:30
That's why I say small libraries. One of those is lodash or underscore. Yeah, it certainly is a crutch.
@MikeJSchorah Do you want to try and implement .reduce and see how you do?
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:34
@kumquatfelafel I see, cause it works for the first call and not the second one. How could I clear the array after I return it? Or should I just nest the code in a function within the function and call it
kumquatfelafel
@kumquatfelafel
Jul 13 2017 01:34
@chrisbchrist Well, presumably, your steamrollArray function will either return a flattened array, or call itself. So if we've finished a recursive loop, so to speak, what does that tell us about the returned result?
Mike
@MikeJSchorah
Jul 13 2017 01:34
@eyesore- Sure. Implement it how?
In some type of algorithm?
eyesore-
@eyesore-
Jul 13 2017 01:36
@MikeJSchorah I will write up some test and you have to make then pass. You should have to make these equal the same thing
[1, 2, 3].reduce((a, b) => a + b) // 5

reduce([1, 2, 3], (a, b) => a + b) // 5
Yeah, reduce is an algorithm.
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:37
@kumquatfelafel Not sure what you're getting at. I managed to fix it by simply by just declaring the code as its own function and calling it. That feels kind of heavy handed though
kumquatfelafel
@kumquatfelafel
Jul 13 2017 01:38
@chrisbchrist post code
Christopher Blakely
@chrisbchrist
Jul 13 2017 01:39
function steamrollArray(arr) {
// I'm a steamroller, baby
var notArrays = [];
function flatten(array) {
for (var i = 0; i < array.length; i++) {
if (Array.isArray(array[i])) {
flatten(array[i]);
} else {
notArrays.push(array[i]);
}
}
}
flatten(arr);
return notArrays;
}

steamrollArray([[["a"]], [["b"]]]);
kumquatfelafel
@kumquatfelafel
Jul 13 2017 01:45
@chrisbchrist this should work I think? What problems are you getting with it?
All I know is that if this guys can get a job, I can get one...
If this guy can quit his job in 6 months, then get hired again 2 months later by the same company, I can too!
Mike
@MikeJSchorah
Jul 13 2017 02:01
Did I say something wrong?
eyesore-
@eyesore-
Jul 13 2017 02:03
Nah, but I got those tests done if you want to try it out.
John
@AnonymousLords
Jul 13 2017 02:04
@MikeJSchorah I agree with him, to prevent missing knowledge, ill spend 5 minutes writing notes on each challenge. That helped me a lot.
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:06
@eyesore- You mean like this? https://repl.it/JZfX
eyesore-
@eyesore-
Jul 13 2017 02:07
Yeah! Nice.
Except reduce takes 3 arguments.
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:08
yeah. Just checking if had general idea down though :p
Mike
@MikeJSchorah
Jul 13 2017 02:08
@eyesore Shoot
John
@AnonymousLords
Jul 13 2017 02:08
Guys, whast wrong with my code? https://www.freecodecamp.org/challenges/golf-code
Mike
@MikeJSchorah
Jul 13 2017 02:08
@AnonymousLords Was that for me?
John
@AnonymousLords
Jul 13 2017 02:08
Anyone
Who can fix this
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:09
@AnonymousLords if it's par = 5, hole in one would still be 1 stroke, not 2.
e.g.
John
@AnonymousLords
Jul 13 2017 02:09
@MikeJSchorah Idk, just saying i agreed with the article presented by you.
J-Mag Guthrie
@baseballpoetess
Jul 13 2017 02:09
CamperBot
@camperbot
Jul 13 2017 02:09
:warning: no user found for anonymouslords
J-Mag Guthrie
@baseballpoetess
Jul 13 2017 02:09
oooo, I can't give you cookies.
John
@AnonymousLords
Jul 13 2017 02:09
:)
@kumquatfelafel ?
J-Mag Guthrie
@baseballpoetess
Jul 13 2017 02:10
I guess cuz you're anonymous
Mike
@MikeJSchorah
Jul 13 2017 02:10
@AnonymousLords Oh. But, I'm saying that if he can get a Front End Developer job just knowing HTML, CSS, and animations, then I'm sure I can get one too with the 3x as much knowledge that I have.
eyesore-
@eyesore-
Jul 13 2017 02:10
@MikeJSchorah @kumquatfelafel try it out https://jsbin.com/cotegamihe/edit?js,console
John
@AnonymousLords
Jul 13 2017 02:10
@MikeJSchorah "How you ever gonna know if you never even try"
shivam gupta
@shivamg11000
Jul 13 2017 02:10
@MikeJSchorah Well situation may be different in different locations
John
@AnonymousLords
Jul 13 2017 02:10
@kumquatfelafel I thought par was 4?
Mike
@MikeJSchorah
Jul 13 2017 02:11
@AnonymousLords Are you using the onion router?
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:11
@AnonymousLords A hole-in-one is 1 stroke. A par could be 5 as well. Or 3.
John
@AnonymousLords
Jul 13 2017 02:11
@MikeJSchorah ?
@kumquatfelafel ohhh
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:11
Maybe something else as well... though probably not in this context
John
@AnonymousLords
Jul 13 2017 02:12
humm
then what should teh equation be
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:13
@AnonymousLords You're very close. I will say that. You probably won't have to revamp your entire program ;)
John
@AnonymousLords
Jul 13 2017 02:13
stroke = stroke - par
if stroke strokes <= par-2 , then it would be eagle for example
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:15
@AnonymousLords if (strokes == par -3) { Reconsider this condition. We know that a hole in one is one stroke, right?
Mike
@MikeJSchorah
Jul 13 2017 02:15
@AnonymousLords I tried alright. I came close 5 times:
1. The first time was for a job 5 hours away. I would have taken it, but it required 3 weeks of unpaid Angular training.
2. I narrowly missed the second job's coding challenge.
3. The third job was 2 hours away. I would have taken it, but it was mostly Wordpress. I'm not relocating 2 hours away for a Wordpress job.
4. I had to do an HTML/CSS mockup. I didn't finish in time.
5. I had the owner of a new company tell me he was looking for a CSS guru. Spent 2 hours with him over the phone breaking down my portfolio. Then, he offered me a paid internship, but the salary was so low and the job was an hour commute that I couldn't take it.
Keep looking and I'll find the right fit, though :)
John
@AnonymousLords
Jul 13 2017 02:15
@kumquatfelafel yes
Mike
@MikeJSchorah
Jul 13 2017 02:15
I only spent 2 months total looking which beats some bootcamp grads
John
@AnonymousLords
Jul 13 2017 02:15
@MikeJSchorah Everything happened for a reason
@kumquatfelafel would this work?
  if (strokes == strokes - par && strokes == 1) {
return "Hole-in-one";
Mike
@MikeJSchorah
Jul 13 2017 02:17
@shivamg11000 Yeah, I'm starting to believe that. I'm starting to believe that if you live in a megamassive city like Montreal or New York City, then you won't have a problem finding a job compared to a smaller city like Jacksonville or Philadelphia.
Diego Mayer
@Chrono79
Jul 13 2017 02:18
@AnonymousLords strokes == strokes - par par should be 0 for that condition to be true
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:18
@AnonymousLords If they hit it in 1, this means our strokes is 1. If we have par = 3, then 1 != 1 - 3. You're overcomplicating it. :p
If they hit it in in one stroke, regardless of the par, will it ever not be a hole-in-one?
John
@AnonymousLords
Jul 13 2017 02:19
@kumquatfelafel It will be a hole in one
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:20
@AnonymousLords Right. So when strokes is 1, what does that tell us?
John
@AnonymousLords
Jul 13 2017 02:20
its a hole in one regardeless of par
aRtoo
@artoodeeto
Jul 13 2017 02:21

hi guys. whats the other way to make a background img cover the whole page other than this because its not working.

 background-size: cover; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover;

John
@AnonymousLords
Jul 13 2017 02:22
hummm
Put your background image in teh csss
Try that
Mike
@MikeJSchorah
Jul 13 2017 02:22
I don't even know what the question is asking. I'm getting an @eyesore just looking at it. When I refer to algorithms, that's exactly what I mean.
John
@AnonymousLords
Jul 13 2017 02:23
background-size: cover;
Mike
@MikeJSchorah
Jul 13 2017 02:24
Guess I'll hit codewars/codefights... :[
John
@AnonymousLords
Jul 13 2017 02:24
so... @kumquatfelafel
Mike
@MikeJSchorah
Jul 13 2017 02:25
@eyesore How long should I spend on codewars/codefight/hackerrank/etc?
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:25
  if (strokes == 1 && strokes == strokes - par) {
So at the moment, what you're essentially saying is, it's a hole in 1 if and only if strokes is 1 *and* some other condition (which may or may not be true) is true.
But haven't we established that when strokes is 1, it's a hole in one unconditionally?
John
@AnonymousLords
Jul 13 2017 02:27
Yes
eyesore-
@eyesore-
Jul 13 2017 02:27
@MikeJSchorah As long as you want really. The challenge I sent you was just reimplementing reduce. Just think about how reduce is used and what it does.
John
@AnonymousLords
Jul 13 2017 02:27
How do i do that
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:30

Say I have at the top of if-else chain

if (strokes == 20) {
return "Are you sure this is the game for you?";
}

When strokes is not 20, will this be returned? How about when it is 20? Is this dependent upon any other condition?

John
@AnonymousLords
Jul 13 2017 02:31
Yes i think
hello
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:32
@AnonymousLords you'll have to be a little more specific as I asked three questions :p
John
@AnonymousLords
Jul 13 2017 02:32
It wont eb returned
when it is 20 it will be
It is determined upon on condition,.
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:34
@AnonymousLords Do you think you see how you might be able to apply this logic in case of hole in one?
John
@AnonymousLords
Jul 13 2017 02:34
yes
i think
if the number of strokes is = to your par - strokes
idk
How do i make it work with any number
@artoodeeto :point_up: July 12, 2017 10:22 PM
@kumquatfelafel hello?
dylantelson
@dylantelson
Jul 13 2017 02:37
hey @eyesore- I realize that the reason why it didnt work is because the JSON doesnt update quick enough, it takes a second to get the data to set country, and by that time the rest of the code is already finished running
can I make it so it doesnt continue until the get json thing is done running?
I would just make it wait a second before continuing but in case someone has really bad internet that seems like a bad idea
eyesore-
@eyesore-
Jul 13 2017 02:38
@dylantelson Yeah, it's calling things async.
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:38
@AnonymousLords Like I said, par is not relevant here. Pretend par doesn't exist. When strokes is 1, it's a hole-in-one. If strokes is not 1, then it's not a hole-in-one.
eyesore-
@eyesore-
Jul 13 2017 02:38
You can use promises.
John
@AnonymousLords
Jul 13 2017 02:39
so just say strokes == 1 then hole in one @kumquatfelafel
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:39
@AnonymousLords yup
eyesore-
@eyesore-
Jul 13 2017 02:39
@dylantelson Also, something like ajax or fetch will make calls as promises
CallMeOrange
@EgnaroDev
Jul 13 2017 02:39
so strokes == 52637843726 then hole in 52637843726?
John
@AnonymousLords
Jul 13 2017 02:40
no
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:40
@MCTwoDigitZero then "too much golf" :o
dylantelson
@dylantelson
Jul 13 2017 02:40
ajax or fetch?
CallMeOrange
@EgnaroDev
Jul 13 2017 02:40
:p
John
@AnonymousLords
Jul 13 2017 02:40
lul
dylantelson
@dylantelson
Jul 13 2017 02:41
instead of using getJSON, I'd put ajax or something? I remember reading something like that but I don't really know how to call ajax or whatever
John
@AnonymousLords
Jul 13 2017 02:41
Still not working? @kumquatfelafel @MCTwoDigitZero
eyesore-
@eyesore-
Jul 13 2017 02:41
@dylantelson fetch was added in ES6 I think. It's pretty dope. https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
kumquatfelafel
@kumquatfelafel
Jul 13 2017 02:41
@AnonymousLords All the conditions you had except for 1st one were correct before :p.
CallMeOrange
@EgnaroDev
Jul 13 2017 02:41
wow
eyesore-
@eyesore-
Jul 13 2017 02:41
@dylantelson I think jquery has $.ajax() I'm not sure though. John @AnonymousLords Jul 13 2017 02:42 @kumquatfelafel fml Ryan Williams @Ryanwfile Jul 13 2017 02:42 Can someone experienced with React please explain something to me, in the following code if I don't add the line document.body.appendChild(table) then the table is never rendered to the DOM even though I explicitly try to render it in the components render function, my question is why doesn't this code render to the DOM without that line, thank you for any help, if you would like to see the codepen I can link that. class Board extends React.Component{ constructor(props){ super(props); this.createBoard = this.createBoard.bind(this); } createBoard (rows, columns) { let i = 0; let table = document.createElement('table'); for (var r = 0; r<rows; r++){ var tr = table.appendChild(document.createElement('tr')); for (var c=0; c< columns; c++){ var cell = tr.appendChild(document.createElement('td')); cell.innerHTML = i; i++; } } document.body.appendChild(table); return table; } render(){ return( <div> {this.createBoard(10,10)} </div> ) } } kumquatfelafel @kumquatfelafel Jul 13 2017 02:42 @AnonymousLords You got the more difficult ones correct. ;) eyesore- @eyesore- Jul 13 2017 02:43 @dylantelson But yeah, overall you just want to make sure to make the changes when the call is resolved. So in your success function or whatever John @AnonymousLords Jul 13 2017 02:43 @kumquatfelafel still not working kumquatfelafel @kumquatfelafel Jul 13 2017 02:43 @AnonymousLords post code John @AnonymousLords Jul 13 2017 02:43 function golfScore(par, strokes) { if (strokes == 1) { return "Hole-in-one"; } else if (strokes <= par -2) { return "Eagle"; } else if (strokes == par -1) { return "Birde"; } else if (strokes - par == 0) { return "Par"; } else if (strokes == par +1) { return "Bogey"; } else if (strokes == par +6) { return "Double Bogey"; } else if (strokes ) { return "Go Home!"; } else return "Change Me"; } dylantelson @dylantelson Jul 13 2017 02:44 success function? kumquatfelafel @kumquatfelafel Jul 13 2017 02:44 @AnonymousLords } else if (strokes ) {? strokes what? also... } else if (strokes == par +6) { John @AnonymousLords Jul 13 2017 02:44 its not else if its just if? @kumquatfelafel You said they were correct eyesore- @eyesore- Jul 13 2017 02:45 @dylantelson Yeah, you know how when you make a call you tell it what to do when the info gets back? That is where you want to do the update dylantelson @dylantelson Jul 13 2017 02:46 something like this: .success(function()? eyesore- @eyesore- Jul 13 2017 02:47 I think so. I really haven't used jquery in a long time. dylantelson @dylantelson Jul 13 2017 02:47 .success(function() { updateWeather() ); }) aight cool, thanks, im gonna try that CallMeOrange @EgnaroDev Jul 13 2017 02:47 Hey, I've made few projects for random quote machines and weather app but do I need to know $.ajax()?
John
@AnonymousLords
Jul 13 2017 02:47
Would t just be strokes === (Required amount)? @kumquatfelafel
or ==
eyesore-
@eyesore-
Jul 13 2017 02:48
For making calls I would say it's good to learn about promises.
John
@AnonymousLords
Jul 13 2017 02:48
@MCTwoDigitZero i am still stuck on the golf project ;-;
CallMeOrange
@EgnaroDev
Jul 13 2017 02:48
6 === '6' // false
@AnonymousLords Sorry :/
@eyesore- me?
eyesore-
@eyesore-
Jul 13 2017 02:48
Anyone haha
CallMeOrange
@EgnaroDev
Jul 13 2017 02:48
lol
eyesore-
@eyesore-
Jul 13 2017 02:48
But yeah.
John
@AnonymousLords
Jul 13 2017 02:48
@MCTwoDigitZero i emant ==
CallMeOrange
@EgnaroDev
Jul 13 2017 02:49
Maybe after projects
6 === '6' // false
6 == '6' // true
John
@AnonymousLords
Jul 13 2017 02:50
ik would it be strokes == (required amount) as the else if?
CallMeOrange
@EgnaroDev
Jul 13 2017 02:50
Can I complete Wikipedia with $.getJSON? I dont know... been a while I did it :( John @AnonymousLords Jul 13 2017 02:50 Bceuase it isnt working that way :cry: CallMeOrange @EgnaroDev Jul 13 2017 02:52 Man... I have no clue what to do for Wikipedia Viewer, even it was easy for Weather app and Random quote machine.. John @AnonymousLords Jul 13 2017 02:52 @kumquatfelafel i can understand if you cant help me anymore. @MCTwoDigitZero Use pusedo CallMeOrange @EgnaroDev Jul 13 2017 02:53 How can that help :/ John @AnonymousLords Jul 13 2017 02:53 Plan it out CallMeOrange @EgnaroDev Jul 13 2017 02:53 ... dylantelson @dylantelson Jul 13 2017 02:53 got it to work! the only thing now is that the api is different for different locations, so using [#] doesn't work because sometimes itll be the city and sometimes itll be the country John @AnonymousLords Jul 13 2017 02:53 think about it dylantelson @dylantelson Jul 13 2017 02:54 so i guess i have to make a for loop to find which has the type ["country"] John @AnonymousLords Jul 13 2017 02:54 north korea kumquatfelafel @kumquatfelafel Jul 13 2017 02:54 @AnonymousLords lol That isn't what you posted originally (i don't think, but you deleted so... if was.... stand corrected). There should be a table to left in instructions that tells you when each is the case. Double bogey, e.g., is not par + 6. Use values in that table to figure out what you should be checking for in if statements. John @AnonymousLords Jul 13 2017 02:54 @kumquatfelafel i did delete it eyesore- @eyesore- Jul 13 2017 02:54 @dylantelson You can ask to just get country back CallMeOrange @EgnaroDev Jul 13 2017 02:56 Im done :angel: dylantelson @dylantelson Jul 13 2017 02:56 if it's like this, how do i just ask to get the country back? kumquatfelafel @kumquatfelafel Jul 13 2017 02:56 @AnonymousLords At moment, (what you have posted above) for bogey and above, you're checking the correct conditions. For double bogey and go home, those are incorrect. John @AnonymousLords Jul 13 2017 02:56 okay should i just reset my code, im completely lost on what to do dylantelson @dylantelson Jul 13 2017 02:57 don't I have to use a for loop and find which has the type country? (can't use results[0].address_components[6] because it'll be different with other results) eyesore- @eyesore- Jul 13 2017 02:57 @dylantelson &result_type=country something like that. It's in here https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding @dylantelson You can, John @AnonymousLords Jul 13 2017 02:57 I learn visually this is my code function golfScore(par, strokes) { if (strokes == 1) { return "Hole-in-one"; } else if (strokes <= par -2) { return "Eagle"; } else if (strokes == par -1) { return "Birde"; } else if (strokes == par) { return "Par"; } else if (par + 1) { return "Bogey"; } else if (par + 2) { return "Double Bogey"; } else if (strokes >= par + 3) { return "Go Home!"; } else return "Are u blind?"; } CallMeOrange @EgnaroDev Jul 13 2017 03:00 } else return "Are u blind?"; } That is incorrect Missing { John @AnonymousLords Jul 13 2017 03:00 okay, still mostly everything is wrong CallMeOrange @EgnaroDev Jul 13 2017 03:01 \^o^/ John @AnonymousLords Jul 13 2017 03:02 the "Hole in one" if is wrong? i am honestly stuck eyesore- @eyesore- Jul 13 2017 03:02 @dylantelson Yo man, I'm getting off. I just didn't want to leave you in the dark. Shoot me a message if you get super stuck. John @AnonymousLords Jul 13 2017 03:02 i gtg in like 30 minutes MoisÃ©s Man @moigithub Jul 13 2017 03:02 compare with the text instructions provide.. make sure u copied the EXACT text @AnonymousLords John @AnonymousLords Jul 13 2017 03:03 ? dylantelson @dylantelson Jul 13 2017 03:03 @eyesore- thanks a bunch man! CamperBot @camperbot Jul 13 2017 03:03 :cookie: 100 | @eyesore- |http://www.freecodecamp.com/eyesore- dylantelson sends brownie points to @eyesore- :sparkles: :thumbsup: :sparkles: kumquatfelafel @kumquatfelafel Jul 13 2017 03:03 @AnonymousLords The hole in one is correct, though you need to include a ! at end of string (needs to be exactly the same). Similarly, Birde should be Birdie. dylantelson @dylantelson Jul 13 2017 03:03 I don't completely understand what to do with result types so I'm going to try making a for loop, but you've mad ethis much easier :) John @AnonymousLords Jul 13 2017 03:04 @kumquatfelafel okay no mostly everything is correct Ryan Williams @Ryanwfile Jul 13 2017 03:04 Can someone experienced with React please explain something to me, in the following code if I don't add the line document.body.appendChild(table) then the table is never rendered to the DOM even though I explicitly try to render it in the components render function, really appreciate any help. https://codepen.io/Ryanwfile/pen/YQBqge class Board extends React.Component{ constructor(props){ super(props); this.createBoard = this.createBoard.bind(this); } createBoard (rows, columns) { let i = 0; let table = document.createElement('table'); for (var r = 0; r<rows; r++){ var tr = table.appendChild(document.createElement('tr')); for (var c=0; c< columns; c++){ var cell = tr.appendChild(document.createElement('td')); cell.innerHTML = i; i++; } } document.body.appendChild(table); console.log(table); return table; } render(){ return( <div> {this.createBoard(10,10)} </div> ) } } MoisÃ©s Man @moigithub Jul 13 2017 03:04 if instructions tells you to write HELLO and u just write HELL its not what fcc test expect... @AnonymousLords CallMeOrange @EgnaroDev Jul 13 2017 03:04 hm.. eyesore- @eyesore- Jul 13 2017 03:04 @dylantelson No problem! Let me know how it goes. Night everyone CallMeOrange @EgnaroDev Jul 13 2017 03:05 Night :zzz: John @AnonymousLords Jul 13 2017 03:05 lol birdie was spelled incorrectly CallMeOrange @EgnaroDev Jul 13 2017 03:05 @AnonymousLords The hole in one is correct, though you need to include a ! at end of string (needs to be exactly the same). Similarly, Birde should be Birdie. John @AnonymousLords Jul 13 2017 03:06 @MCTwoDigitZero lol i got that one golfScore(4, 6) should return "Double Bogey" That has x MoisÃ©s Man @moigithub Jul 13 2017 03:07 @AnonymousLords some cndition u need to compare strokes vs par (something) not just par like u did with others  } else if (par + 1) { ////////////////////////////////////////////////////// return "Bogey"; } else if (par + 2) { ///////////////////////////////////////////// return "Double Bogey"; John @AnonymousLords Jul 13 2017 03:08  else if (par + 2 == strokes) { return "Double Bogey"; still incorrect kumquatfelafel @kumquatfelafel Jul 13 2017 03:09 @AnonymousLords } else if (strokes == par) { Here you are making a comparison. This is what you want. What we're saying here is that if strokes and par have same value, then condition is true. Then with if statement, we're saying, if strokes == par is true, then return "Par". } else if (par + 1) { In this case, no comparison is being made (note lack of ==). Same for } else if (par + 2) { John @AnonymousLords Jul 13 2017 03:09 I GOT IT i needed to add strokes == par + 2 thanks @kumquatfelafel @moigithub @MCTwoDigitZero @AnonymousLords CamperBot @camperbot Jul 13 2017 03:10 anonymouslords sends brownie points to @kumquatfelafel and @moigithub and @mctwodigitzero :sparkles: :thumbsup: :sparkles: :cookie: 471 | @mctwodigitzero |http://www.freecodecamp.com/mctwodigitzero :cookie: 462 | @kumquatfelafel |http://www.freecodecamp.com/kumquatfelafel :star2: 3498 | @moigithub |http://www.freecodecamp.com/moigithub CallMeOrange @EgnaroDev Jul 13 2017 03:10 lol no problem kumquatfelafel @kumquatfelafel Jul 13 2017 03:13 @AnonymousLords yup. When you put an ordinary number in an if statement it actually behaves a little differently. When you have if(0), it treats the 0 the same way as it would false (does not execute code inside if statement). For any other number inside the parentheses, it treats that number the same way as it would true (executes code inside if statement). There are cases where something like this has its uses, but not really here. So if you're trying to compare two values don't forget to include the appropriate comparison operator (and the two values you're comparing) John @AnonymousLords Jul 13 2017 03:14 okay i did 7 challanges today CallMeOrange @EgnaroDev Jul 13 2017 03:15 I did 0 today... John @AnonymousLords Jul 13 2017 03:16 3 days left intill im done kumquatfelafel @kumquatfelafel Jul 13 2017 03:16 I challenged a ferret to a duel. It was glorious. CallMeOrange @EgnaroDev Jul 13 2017 03:16 lol John @AnonymousLords Jul 13 2017 03:16 is Object Oriented and Functional Programming hard? after that is 50 hours of algorithms CallMeOrange @EgnaroDev Jul 13 2017 03:17 yea John @AnonymousLords Jul 13 2017 03:17 Their sonly 13 challanges CallMeOrange @EgnaroDev Jul 13 2017 03:17 OOP is not really hard, they are like pre preparing you for Basic Algorithms John @AnonymousLords Jul 13 2017 03:17 oh what is algorithms? like math equations? CallMeOrange @EgnaroDev Jul 13 2017 03:18 Yeah you could say that You will find out John @AnonymousLords Jul 13 2017 03:18 Their is only 17 challanges 3 hours each? CallMeOrange @EgnaroDev Jul 13 2017 03:18 Does it matter :/ Oh, they are hard Sometime few days sometime few hours sometime a day.. John @AnonymousLords Jul 13 2017 03:19 dont worry, my IQ is 200 CallMeOrange @EgnaroDev Jul 13 2017 03:19 lol John @AnonymousLords Jul 13 2017 03:19 lul CallMeOrange @EgnaroDev Jul 13 2017 03:19 My friend always told me "I have 200 IQ" John @AnonymousLords Jul 13 2017 03:20 lol Math is so boring in school Its so easy CallMeOrange @EgnaroDev Jul 13 2017 03:20 Really? What level? dylantelson @dylantelson Jul 13 2017 03:20 yo guys, how would you go about checking which object types has country in it here: https://developers.google.com/maps/documentation/geocoding/intro#ReverseGeocoding CallMeOrange @EgnaroDev Jul 13 2017 03:20 Pre-algebra? John @AnonymousLords Jul 13 2017 03:21 we already did varaibles dylantelson @dylantelson Jul 13 2017 03:21 for loop checking each object? (i think its called object) CallMeOrange @EgnaroDev Jul 13 2017 03:21 so Algebra I? John @AnonymousLords Jul 13 2017 03:21 we just finished up degrees CallMeOrange @EgnaroDev Jul 13 2017 03:21 Hm.. John @AnonymousLords Jul 13 2017 03:21 like 60 degrees dylantelson @dylantelson Jul 13 2017 03:21 finished up degrees? what about degrees 60 degrees? triangles? John @AnonymousLords Jul 13 2017 03:21 /idk if i can say my grade to a strangers CallMeOrange @EgnaroDev Jul 13 2017 03:21 Oh I see, so like Algebra I/Geometry Angles Triangle etc.. John @AnonymousLords Jul 13 2017 03:21 probley like trangles and angles and finding cordinates with degrees dylantelson @dylantelson Jul 13 2017 03:22 like 45-45-90, 60-60-60-, etc. CallMeOrange @EgnaroDev Jul 13 2017 03:22 Nice John @AnonymousLords Jul 13 2017 03:22 like 60 degrees, 3 sections out What grade are you :smile: CallMeOrange @EgnaroDev Jul 13 2017 03:22 Going to be Junior dylantelson @dylantelson Jul 13 2017 03:22 yeah, so like freshman math in hs, right see if you can take advanced courses CallMeOrange @EgnaroDev Jul 13 2017 03:22 @dylantelson Yeah but most middle schooler take them John @AnonymousLords Jul 13 2017 03:23 @MCTwoDigitZero 3rd year in high school? CallMeOrange @EgnaroDev Jul 13 2017 03:23 Yea John @AnonymousLords Jul 13 2017 03:23 Okay dylantelson @dylantelson Jul 13 2017 03:23 yeah, depends on what level, usually basic stuff is taught in middle school basics of algebra 1, so if hes just learning about variables then maybe that John @AnonymousLords Jul 13 2017 03:23 I'm the only person in my grade who really codes dylantelson @dylantelson Jul 13 2017 03:23 but they still taught geometry and more advanced (but not alg 2) in freshman year of my hs CallMeOrange @EgnaroDev Jul 13 2017 03:23 Honestly I took Algebra I just last semester, taking Geometry this year then Algebra II after that... dylantelson @dylantelson Jul 13 2017 03:23 dude, as a freshman you have a great head start or well i dunno what grade youre in CallMeOrange @EgnaroDev Jul 13 2017 03:24 lol John @AnonymousLords Jul 13 2017 03:24 well im before a freshman dylantelson @dylantelson Jul 13 2017 03:24 but i assume you're 13 or so, so it's great you're already learning CallMeOrange @EgnaroDev Jul 13 2017 03:24 7-8 grader John @AnonymousLords Jul 13 2017 03:24 Yep dylantelson @dylantelson Jul 13 2017 03:24 I started programming when I was 8, but I was using Scratch and then Stencyl so I didn't learn the same type of stuff until I learned Unity and now Javascript CallMeOrange @EgnaroDev Jul 13 2017 03:24 oh dylantelson @dylantelson Jul 13 2017 03:25 so if you take this seriously you'll be great by the time you're applying to colleges John @AnonymousLords Jul 13 2017 03:25 Our school ipad offers this really crappy coding game CallMeOrange @EgnaroDev Jul 13 2017 03:25 Sigh, it was fucked up when I took Pre-Algebra in my freshman John @AnonymousLords Jul 13 2017 03:25 that teaches nothing all you had to do was move around a chacter by typing "right" or "left" CallMeOrange @EgnaroDev Jul 13 2017 03:25 I had to take Algebra I in second year but I managed to speak my advisor and I will be able to take Geometry and Algebra II in the same year but different semester @AnonymousLords Oh yeah, its actually good for beginner Tho I have never done it before fCC John @AnonymousLords Jul 13 2017 03:26 It learned me nothing CallMeOrange @EgnaroDev Jul 13 2017 03:26 :/ Same, I dont even remember how to do that game lol John @AnonymousLords Jul 13 2017 03:26 if i went on codepen i couldnt do anything with that knowledge dylantelson @dylantelson Jul 13 2017 03:26 what country are you from, John? John @AnonymousLords Jul 13 2017 03:26 Guess CallMeOrange @EgnaroDev Jul 13 2017 03:26 Hover over to his profile pic dylantelson @dylantelson Jul 13 2017 03:26 I would guess USA from the name John @AnonymousLords Jul 13 2017 03:26 yeah... kumquatfelafel @kumquatfelafel Jul 13 2017 03:27 @AnonymousLords Antarctica John @AnonymousLords Jul 13 2017 03:27 BRUH dylantelson @dylantelson Jul 13 2017 03:27 haha, but you said it learned me nothing so I thought you were from abroad for a sec John @AnonymousLords Jul 13 2017 03:27 L dylantelson @dylantelson Jul 13 2017 03:27 taught me nothin CallMeOrange @EgnaroDev Jul 13 2017 03:27 New York :p kumquatfelafel @kumquatfelafel Jul 13 2017 03:27 blast! I was incorrect! :o CallMeOrange @EgnaroDev Jul 13 2017 03:27 I already knew lol John @AnonymousLords Jul 13 2017 03:27 My school is mostly geto. dylantelson @dylantelson Jul 13 2017 03:27 I'm from NY too ;) John @AnonymousLords Jul 13 2017 03:27 so i only say yo dylantelson @dylantelson Jul 13 2017 03:28 We live in Brooklyn baby CallMeOrange @EgnaroDev Jul 13 2017 03:28 Math from middle school in Texas is pretty advanced Or at least I heard about it... John @AnonymousLords Jul 13 2017 03:28 not being racist, but its hard to be white n a school that strongly loves Hillary and hates white Republicans dylantelson @dylantelson Jul 13 2017 03:28 so MC, you're gonna take the SAT this year? CallMeOrange @EgnaroDev Jul 13 2017 03:28 They said they offer like Trig/Calc in middle school John @AnonymousLords Jul 13 2017 03:28 I live 2 hours away from YC NYC' CallMeOrange @EgnaroDev Jul 13 2017 03:28 @dylantelson oh... nah I plan to take SAT like next year But I might want to take PSAT this year dylantelson @dylantelson Jul 13 2017 03:29 what you said isnt racist, although I do dislike Republicans lol CallMeOrange @EgnaroDev Jul 13 2017 03:29 Then PSAT again next year before SAT dylantelson @dylantelson Jul 13 2017 03:29 you're starting junior year in august? CallMeOrange @EgnaroDev Jul 13 2017 03:29 Yea 2 weeks left, damn dylantelson @dylantelson Jul 13 2017 03:29 You should take the SAT late junior year for the first time CallMeOrange @EgnaroDev Jul 13 2017 03:29 Hm... dylantelson @dylantelson Jul 13 2017 03:29 most people take it June or so of their junior year CallMeOrange @EgnaroDev Jul 13 2017 03:29 They did offer like that so I'll try kumquatfelafel @kumquatfelafel Jul 13 2017 03:29 I live in a hole-in-the-wall apartment by the pet food. John @AnonymousLords Jul 13 2017 03:29 @dylantelson Its okay to dislike, but they started calling me racist for no reason i got annoyed dylantelson @dylantelson Jul 13 2017 03:29 then again fall in their senior year CallMeOrange @EgnaroDev Jul 13 2017 03:29 Good idea John @AnonymousLords Jul 13 2017 03:30 @kumquatfelafel lul CallMeOrange @EgnaroDev Jul 13 2017 03:30 I have to study hard :/ dylantelson @dylantelson Jul 13 2017 03:30 well being republican isnt racist, but sometimes they say racist things John @AnonymousLords Jul 13 2017 03:30 Sometimes liberals can to dylantelson @dylantelson Jul 13 2017 03:30 ofc it depends on what you say, I dunno if youre saying "we should deport muslims" yeah, ofc anyone can be racist John @AnonymousLords Jul 13 2017 03:30 their blowing up our towers CallMeOrange @EgnaroDev Jul 13 2017 03:30 ... dylantelson @dylantelson Jul 13 2017 03:30 that response makes me think youre racist even though you dont realize it :D CallMeOrange @EgnaroDev Jul 13 2017 03:31 Do you know my race? lol John @AnonymousLords Jul 13 2017 03:31 major terriost attacks have gone up after we let in ILLEGAL muslims dylantelson @dylantelson Jul 13 2017 03:31 hahahaha w/e but if youre spewin shit like that you're gonna get called racist John @AnonymousLords Jul 13 2017 03:31 Trumps bill only blocks muslims who were coming from countries that we are heavly in war ageasnt dylantelson @dylantelson Jul 13 2017 03:32 actually that isn't true John @AnonymousLords Jul 13 2017 03:32 The deport illegal muslims dylantelson @dylantelson Jul 13 2017 03:32 it included many countries which aren't very radical John @AnonymousLords Jul 13 2017 03:32 Yet we dont know much about' dylantelson @dylantelson Jul 13 2017 03:32 (also countries that we are heavily in war against? do you know anything about US foreign affairs? lol) and it didn't ban the Saudis because Trump has a business relationship with them well, the US in general, not just Trump John @AnonymousLords Jul 13 2017 03:33 Not all muslim countries are bad dylantelson @dylantelson Jul 13 2017 03:33 even though the Saudis should be at the top of the list should a list like that be passed into effect John @AnonymousLords Jul 13 2017 03:33 we blocked certian ones CallMeOrange @EgnaroDev Jul 13 2017 03:33 ^ dylantelson @dylantelson Jul 13 2017 03:33 dude, list the countries we blocked. without looking it up CallMeOrange @EgnaroDev Jul 13 2017 03:33 7 countries right? kumquatfelafel @kumquatfelafel Jul 13 2017 03:33 I've always held that terrorism is something of a non-threat. It's cats that you have to worry about. And rat poison. And lightning. Mike @MikeJSchorah Jul 13 2017 03:33 . John @AnonymousLords Jul 13 2017 03:33 bruh CallMeOrange @EgnaroDev Jul 13 2017 03:33 lol kumquatfelafel @kumquatfelafel Jul 13 2017 03:33 @MCTwoDigitZero No offense. :o CallMeOrange @EgnaroDev Jul 13 2017 03:33 lmao John @AnonymousLords Jul 13 2017 03:33 listing the countries isnt really important CallMeOrange @EgnaroDev Jul 13 2017 03:33 Its fine John @AnonymousLords Jul 13 2017 03:33 As you couldnt eaither CallMeOrange @EgnaroDev Jul 13 2017 03:34 But at least I know how many countries it was blocked dylantelson @dylantelson Jul 13 2017 03:34 true, listing them doesn't matter but you don't know what you're talking about John @AnonymousLords Jul 13 2017 03:34 i knew that not every country was blocked dylantelson @dylantelson Jul 13 2017 03:34 what countries are the US "heavily in war against"? John @AnonymousLords Jul 13 2017 03:34 Afghanistan CallMeOrange @EgnaroDev Jul 13 2017 03:34 ... John @AnonymousLords Jul 13 2017 03:34 We are fighting countries i mean isis in certian countries so we blocked them dylantelson @dylantelson Jul 13 2017 03:34 lmao dude, do you know what heavily in war against means CallMeOrange @EgnaroDev Jul 13 2017 03:34 Dude my friends are Afghan and live In US John @AnonymousLords Jul 13 2017 03:35 and? The whole idea behind the bill was to make everyone legal dylantelson @dylantelson Jul 13 2017 03:35 and that's 1 CallMeOrange @EgnaroDev Jul 13 2017 03:35 US only block Muslims that are not US citizens dylantelson @dylantelson Jul 13 2017 03:35 they also were blocking people with greencards and shit John @AnonymousLords Jul 13 2017 03:35 I worded that kind of badly CallMeOrange @EgnaroDev Jul 13 2017 03:35 From what I heard.. dylantelson @dylantelson Jul 13 2017 03:35 who were just out of the country at the time CallMeOrange @EgnaroDev Jul 13 2017 03:35 Yeah greencard John @AnonymousLords Jul 13 2017 03:35 I meant that we were fighting terror ggroups in certian countrys Now obama wanted to let in illegals and that caused more terror attacks CallMeOrange @EgnaroDev Jul 13 2017 03:36 And did that happen recently? John @AnonymousLords Jul 13 2017 03:36 DT wants to build a wall with a legal immigration system CallMeOrange @EgnaroDev Jul 13 2017 03:36 For mexico.. dylantelson @dylantelson Jul 13 2017 03:36 what terror attacks in the US happened because Trump let illegals in? John @AnonymousLords Jul 13 2017 03:36 i said obama dylantelson @dylantelson Jul 13 2017 03:36 I meant trump John @AnonymousLords Jul 13 2017 03:36 well dylantelson @dylantelson Jul 13 2017 03:36 obama* i meant obama CallMeOrange @EgnaroDev Jul 13 2017 03:36 lol dylantelson @dylantelson Jul 13 2017 03:36 which terror attacks happened because obama let illegals in CallMeOrange @EgnaroDev Jul 13 2017 03:37 some bomb.. John @AnonymousLords Jul 13 2017 03:37 I havent really memorized every single event that ahs happened, But if you look threw the news CallMeOrange @EgnaroDev Jul 13 2017 03:37 I don't watch news tho John @AnonymousLords Jul 13 2017 03:37 threw the past couple years kumquatfelafel @kumquatfelafel Jul 13 2017 03:37 Soo.... anybody got any coding questions? :o CallMeOrange @EgnaroDev Jul 13 2017 03:37 Not really John @AnonymousLords Jul 13 2017 03:38 You will see more terror attacks Ginger @GingerChew Jul 13 2017 03:38 I do @kumquatfelafel John @AnonymousLords Jul 13 2017 03:38 For instance that night club shootings CallMeOrange @EgnaroDev Jul 13 2017 03:38 5% completed... dylantelson @dylantelson Jul 13 2017 03:38 "i havent really memorized all of them" can you name one or two and I do but nobody has answers lol John @AnonymousLords Jul 13 2017 03:38 Night club shooting Ginger @GingerChew Jul 13 2017 03:38 I can't get my jquery to change the text on my random quote generator John @AnonymousLords Jul 13 2017 03:38 i orlando dylantelson @dylantelson Jul 13 2017 03:38 I said that happened because Obama let illegals in John @AnonymousLords Jul 13 2017 03:39 Honstely dude, i dont really memorize everything isee on teh news okay kumquatfelafel @kumquatfelafel Jul 13 2017 03:39 @GingerChew Whatcha got? :o dylantelson @dylantelson Jul 13 2017 03:39 the person from Orlando was American John @AnonymousLords Jul 13 2017 03:39 Name every fire in history Ginger @GingerChew Jul 13 2017 03:39 John @AnonymousLords Jul 13 2017 03:39 You know nothing about fires CallMeOrange @EgnaroDev Jul 13 2017 03:39 Name every person on Earth John @AnonymousLords Jul 13 2017 03:39 see dylantelson @dylantelson Jul 13 2017 03:39 theres a difference between that and you saying Obama led to a bunch of terror attacks from illegals and then not being able to name a single one John @AnonymousLords Jul 13 2017 03:39 He is letting illegals in the brain forgets stuff that he hasn't used in a while it decomposes connections dylantelson @dylantelson Jul 13 2017 03:40 then inform yourself before you make dumb claims Alexander KÃ¸pke @alexanderkopke Jul 13 2017 03:40 I have a question. So I created a user on a digital ocean server. I am able to login to it on the sites console. However, I can't access it through the terminal with ssh. Although I can ssh into root just fine. It denies access to public key. Weird when root will allow it John @AnonymousLords Jul 13 2017 03:40 "Dumb claims" how? dylantelson @dylantelson Jul 13 2017 03:40 if you forget the content, why are you debating on it? John @AnonymousLords Jul 13 2017 03:40 Look at our ecaomney Ginger @GingerChew Jul 13 2017 03:41 @kumquatfelafel I'm trying to get the sample quote text speech to change to a random quote from the constant I set up in the java section, and then use that to also replace the author as well dylantelson @dylantelson Jul 13 2017 03:41 because you said that the illegal muslims are making a bunch of terrorist attacks in the US then can't name a single one... John @AnonymousLords Jul 13 2017 03:41 Were paying tons of money to support illegals and druggies healthcare dylantelson @dylantelson Jul 13 2017 03:41 anyways, this is useless and a waste of the chat's space hahahah druggies healthcare Ginger @GingerChew Jul 13 2017 03:41 I think I'm using the wrong jquery methods but I'm not finding much info online John @AnonymousLords Jul 13 2017 03:41 Deporting muslims isnt racist Alexander KÃ¸pke @alexanderkopke Jul 13 2017 03:42 @GingerChew which ones are you using? John @AnonymousLords Jul 13 2017 03:42 @dylantelson i dont really memorize things, just keep a note in my mind. Heres a list of all those terror attacks though. https://en.wikipedia.org/wiki/List_of_Islamist_terrorist_attacks dylantelson @dylantelson Jul 13 2017 03:43 Ginger, you aren't using an API? Ginger @GingerChew Jul 13 2017 03:43 @alexanderkopke  John @AnonymousLords Jul 13 2017 03:43 @dylantelson You can see why we want to stop the illegals Ginger @GingerChew Jul 13 2017 03:43 $("document").getElementsById("#clickMe").click(function(){
$("#quoteBody").text(randomQuote()){ return randomQuote() } dylantelson @dylantelson Jul 13 2017 03:43 99% of those aren't in the US, and if you look at the US ones a bunch of them are by white supremacists, including the recent stabbing and Dylan Roof John @AnonymousLords Jul 13 2017 03:43 @dylantelson Memorizing terror attacks doesnt prove anything Its the fact that i can gather proof Ginger @GingerChew Jul 13 2017 03:44 With a document ready starter too kumquatfelafel @kumquatfelafel Jul 13 2017 03:44 Great news gais, I created a room just for you. :o https://gitter.im/UnnecessaryPoliticalDiscussion/Lobby# Alexander KÃ¸pke @alexanderkopke Jul 13 2017 03:44 @GingerChew getElementById not Elements John @AnonymousLords Jul 13 2017 03:44 @dylantelson They show what illegal muslims can do dylantelson @dylantelson Jul 13 2017 03:44 we'll stop anyways, Ginger, you're supposed to use an API for the quote project John @AnonymousLords Jul 13 2017 03:45 remember france? dylantelson @dylantelson Jul 13 2017 03:45 if I understand correctly, instead of using an API you made your own list of quotes? John @AnonymousLords Jul 13 2017 03:45 dead 20,698Â± injured52,032Â± anyways i gtg dylantelson @dylantelson Jul 13 2017 03:45 seeya John, study hard my man John @AnonymousLords Jul 13 2017 03:46 I'm the type of person who needs a reminder to remember things. Ginger @GingerChew Jul 13 2017 03:46 @dylantelson which api? dylantelson @dylantelson Jul 13 2017 03:46 you can find any online Alexander KÃ¸pke @alexanderkopke Jul 13 2017 03:46 @GingerChew wait. getElementById is vanilla js. Not sure you can mix it with jQuery like that...$("#clickMe").click(function(){ should do it
dylantelson
@dylantelson
Jul 13 2017 03:46
but the main point is for you to use an API
John
@AnonymousLords
Jul 13 2017 03:46
also iraq is where we are fighting bye
dylantelson
@dylantelson
Jul 13 2017 03:47
this is how I made it, using an API
this link will get you a random quote and author
click on it, it'll be plaintext and just show you the random one it selected along with the author
using that link, I used the getJSON jquery function and replaced the quote and author HTML IDs with the text from there
Ginger
@GingerChew
Jul 13 2017 03:48
@dylantelson okay, cool, I'll take a look at that!
dylantelson
@dylantelson
Jul 13 2017 03:48
if you don't understand, I can help, I was confused when I was making it too
because I had forgotten most of the JSON and JQuery stuff
basically, open the link and you'll see it says quoteText: (quote) quoteAuthor: (author)
Ginger
@GingerChew
Jul 13 2017 03:49
well your pen is really something! I'll try and reverse engineer it and if I run into any trouble, you'll hear from me
dylantelson
@dylantelson
Jul 13 2017 03:50
then, in the code, in your getJSON, you'll use jquery to replace your html quote and author <p>s or <span>s (whatever youre using)
Ginger
@GingerChew
Jul 13 2017 03:50
I just started coding like 3 months ago so this is all super new to me
kumquatfelafel
@kumquatfelafel
Jul 13 2017 03:51
we've all been there ;)
dylantelson
@dylantelson
Jul 13 2017 03:52
so under getJSON you'll have a function with a call or whatever it's called, I called mine data. give your quote and author HTML things an ID, then in the javascript/jquery part use \$("#insertquoteID").html(data.quoteText);
well, I assume that you already know what getJSON is, but if you don't, I can explain that first
Alexander KÃ¸pke
@alexanderkopke
Jul 13 2017 03:52
@GingerChew you don't have to use an api if you want to create a function that generates the quotes that is fine too. However, later apis are required and it would be a good idea to get aquanted with them. Quote apis is a good intro to apis
dylantelson
@dylantelson
Jul 13 2017 03:53
well this project wants you to use APIs which is why it's a good idea to do so now
Ginger
@GingerChew
Jul 13 2017 03:53
@alexanderkopke thanks for the tip!
CamperBot
@camperbot
Jul 13 2017 03:53
gingerchew sends brownie points to @alexanderkopke :sparkles: :thumbsup: :sparkles:
:star2: 1617 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
dylantelson
@dylantelson
Jul 13 2017 03:53
and you'll have to use way more API stuff in the next project, which is what I'm doing now (weather)
Ginger
@GingerChew
Jul 13 2017 03:53
@dylantelson Thanks for all the insight, I think I'm getting what you have in the pen
CamperBot
@camperbot
Jul 13 2017 03:53
gingerchew sends brownie points to @dylantelson :sparkles: :thumbsup: :sparkles:
dylantelson
@dylantelson
Jul 13 2017 03:53
but it's taking me longer because I'm trying to make it way more complicated
Ginger
@GingerChew
Jul 13 2017 03:53
I'm gonna try and implement it now
dylantelson
@dylantelson
Jul 13 2017 03:54
ok so the basic idea is
use getJSON with the URL I sent you, doesnt have to be a variable even, i dunno why I used a url variable
yeah, try doing it then if you have a question ask, I'll be awake for another 15 min or so probably
or a lil more
and you can see from the commented out javascript part I initially didnt use an API like you haha
CallMeOrange
@EgnaroDev
Jul 13 2017 03:57
Ginger
@GingerChew
Jul 13 2017 03:58
Yeah, using the api has already done more than I could do in the last two hours, so this is stellar
dylantelson
@dylantelson
Jul 13 2017 03:58
did you just make this mctwo?
CallMeOrange
@EgnaroDev
Jul 13 2017 03:58
yea
dylantelson
@dylantelson
Jul 13 2017 03:58
shit I wanna go do the rest of the stuff quicker
CallMeOrange
@EgnaroDev
Jul 13 2017 03:58
lol
dylantelson
@dylantelson
Jul 13 2017 03:58
and just rush the weather thing because I have enough done to basically finish it easy
CallMeOrange
@EgnaroDev
Jul 13 2017 03:58
Its not completed tho
I see
dylantelson
@dylantelson
Jul 13 2017 03:58
but I want to actually make it cooler and shit design wise
CallMeOrange
@EgnaroDev
Jul 13 2017 03:58
@dylantelson Want to see my weather app :p
my artist and I wanna do an actual weather app to put on a portfolio and get experience actually making something try to look and feel good
and sure
heroiczero
@heroiczero
Jul 13 2017 03:59
@MCTwoDigitZero there is no ajax or getJSON?
CallMeOrange
@EgnaroDev
Jul 13 2017 03:59
@heroiczero I don't have an API yet
dylantelson
@dylantelson
Jul 13 2017 04:00
CallMeOrange
@EgnaroDev
Jul 13 2017 04:00
Was just working with input
dylantelson
@dylantelson
Jul 13 2017 04:00
so we wanna add all of this functionality
CallMeOrange
@EgnaroDev
Jul 13 2017 04:00
@dylantelson ^
heroiczero
@heroiczero
Jul 13 2017 04:00
@MCTwoDigitZero nice job with the forecast
dylantelson
@dylantelson
Jul 13 2017 04:01
yeah, this is cool, and as I already have the API giving me all of the info I could finish sometihng like this tonight
CallMeOrange
@EgnaroDev
Jul 13 2017 04:01
@heroiczero Thanks
CamperBot
@camperbot
Jul 13 2017 04:01
mctwodigitzero sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1482 | @heroiczero |http://www.freecodecamp.com/heroiczero
dylantelson
@dylantelson
Jul 13 2017 04:01
but I must resist the urge to move on
CallMeOrange
@EgnaroDev
Jul 13 2017 04:01
lol
dylantelson
@dylantelson
Jul 13 2017 04:01
and just focus on making this project more advanced
CallMeOrange
@EgnaroDev
Jul 13 2017 04:01
Don't rush :), This is third weather app
I made 4 random quote machines and 3 weather apps
dylantelson
@dylantelson
Jul 13 2017 04:01
that's cool
I'm trying to get the actual country name which is way more complicated than it should be
if I have the city name why can't it just give me the country name lol
CallMeOrange
@EgnaroDev
Jul 13 2017 04:02
yeah lol
dylantelson
@dylantelson
Jul 13 2017 04:02
yo mc
CallMeOrange
@EgnaroDev
Jul 13 2017 04:02
Sup?
dylantelson
@dylantelson
Jul 13 2017 04:02
can you think of a way of doing this
CallMeOrange
@EgnaroDev
Jul 13 2017 04:03
Sorry, I've never done it before
dylantelson
@dylantelson
Jul 13 2017 04:03
getting the long_name value of the same object
that has type country
aight, yeah it's giving me trouble
I think I can just make a for loop or a for inside a for loop
CallMeOrange
@EgnaroDev
Jul 13 2017 04:03
You want to get location like country city?
dylantelson
@dylantelson
Jul 13 2017 04:03
I already have the city, because that's given with the timezone
but it doesn't give me the country name
CallMeOrange
@EgnaroDev
Jul 13 2017 04:03
Darksky? thats just timezone
dylantelson
@dylantelson
Jul 13 2017 04:03
so I'm trying to get the country name from google api
yup
CallMeOrange
@EgnaroDev
Jul 13 2017 04:04
this is easier
dylantelson
@dylantelson
Jul 13 2017 04:04
so I'm using the google API to try to get the country name, and I successfully have that
the thing is I want it to be so you can get the weather and country and everything from other areas too
CallMeOrange
@EgnaroDev
Jul 13 2017 04:04
But using google API is good practice I guess
dylantelson
@dylantelson
Jul 13 2017 04:04
so if you live in NY
and you put Warsaw, Poland
CallMeOrange
@EgnaroDev
Jul 13 2017 04:04
oh so you can search some location
dylantelson
@dylantelson
Jul 13 2017 04:04
it should show you the weather there
CallMeOrange
@EgnaroDev
Jul 13 2017 04:04
I see
Its complicated lol, I dont think I can make it
dylantelson
@dylantelson
Jul 13 2017 04:04
yeah
I mean all I have left I think is to be able to get the country name from within that object
but I'm not experienced enough to think up how to do it in a good way
CallMeOrange
@EgnaroDev
Jul 13 2017 04:05
hm...
:(:gun:
dylantelson
@dylantelson
Jul 13 2017 04:06
I can do data.results[0].address_components[6] or something
CallMeOrange
@EgnaroDev
Jul 13 2017 04:06
wow looks complicated to me lol
dylantelson
@dylantelson
Jul 13 2017 04:06
but the thing is that depending on location, that may or maybe the country or the city
CallMeOrange
@EgnaroDev
Jul 13 2017 04:06
To get temperature, I just do like json.currently.temperature
dylantelson
@dylantelson
Jul 13 2017 04:06
because it doesnt stay the same from location to location
CallMeOrange
@EgnaroDev
Jul 13 2017 04:06
I cant even forget it
dylantelson
@dylantelson
Jul 13 2017 04:06
yeah, I have that for location too
i mean temp
darksky is great
CallMeOrange
@EgnaroDev
Jul 13 2017 04:07
Yeah
dylantelson
@dylantelson
Jul 13 2017 04:07
but it just doesnt give me the fucking country name! haha
CallMeOrange
@EgnaroDev
Jul 13 2017 04:07
But it doesn't come with
dylantelson
@dylantelson
Jul 13 2017 04:07
it pisses me off so much
CallMeOrange
@EgnaroDev
Jul 13 2017 04:07
Exactly lol
dylantelson
@dylantelson
Jul 13 2017 04:07
its something so simple
CallMeOrange
@EgnaroDev
Jul 13 2017 04:07
Thats why I used this https://ipinfo.io/json
So easy..
dylantelson
@dylantelson
Jul 13 2017 04:07
and I don't wanna be showing like, "Toronto, America"
or the person using the site's IP
CallMeOrange
@EgnaroDev
Jul 13 2017 04:08
Say you go to my site, it will show your location
dylantelson
@dylantelson
Jul 13 2017 04:08
but I mean, I can't use that if someone from the US
wants to see the weather in France
or something
CallMeOrange
@EgnaroDev
Jul 13 2017 04:08
Oh I see
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:08
@dylantelson sec.
CallMeOrange
@EgnaroDev
Jul 13 2017 04:08
Not sure if it work with https://ipinfo.io/json
heroiczero
@heroiczero
Jul 13 2017 04:08
@dylantelson you could use other api just have to use https://forum.freecodecamp.org/t/local-weather-api-for-people-stuck-because-of-the-https-request/50274/17?u=j7an because they dont accept http:// request now in codepen.io. Everything has to be in https://
CallMeOrange
@EgnaroDev
Jul 13 2017 04:09
But its IP addresses, I think it should work
dylantelson
@dylantelson
Jul 13 2017 04:09
yeah, I'm using another one too
using darksky and now the google api
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:09
@dylantelson Could you post code pen?
CallMeOrange
@EgnaroDev
Jul 13 2017 04:09
I used apixu.com first before darksky
dylantelson
@dylantelson
Jul 13 2017 04:09
and it works, im just too retarded to know how to get the value in an object
it's simple, maybe you guys can help
CallMeOrange
@EgnaroDev
Jul 13 2017 04:09
apixu had everything I needed then decided to use darksky
Jul 13 2017 04:09
I would love some feedback for my Pomodoro clock challenge
dylantelson
@dylantelson
Jul 13 2017 04:10
what I'm doing is, I get the JSON from this type of thing
CallMeOrange
@EgnaroDev
Jul 13 2017 04:10
dylantelson
@dylantelson
Jul 13 2017 04:10
(based on the coordinates, but it works fine)
heroiczero
@heroiczero
Jul 13 2017 04:10
CallMeOrange
@EgnaroDev
Jul 13 2017 04:10
I think it would be cool with border with that circle
dylantelson
@dylantelson
Jul 13 2017 04:10
THEN, I just need to be able to find which type has the value country
CallMeOrange
@EgnaroDev
Jul 13 2017 04:10
Like cyan
dylantelson
@dylantelson
Jul 13 2017 04:10
and then get the long_name from that object
am I clear or did I explain it super badly
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:11
@dylantelson Could I see codepen :laughing:
dylantelson
@dylantelson
Jul 13 2017 04:11
this is the current really messy codepen
I've just been trying to make it so it says City, Country
Jul 13 2017 04:12
@MCTwoDigitZero @dylantelson Thank you! it means a lot
CamperBot
@camperbot
Jul 13 2017 04:12
anshuladlakha sends brownie points to @mctwodigitzero and @dylantelson :sparkles: :thumbsup: :sparkles:
dylantelson
@dylantelson
Jul 13 2017 04:12
so when I getJSON for the google URL, I just need to be able to set country to the long_name of the object with the type country
but not sure how to do that, with a for loop or what, apparently I can somehow use return_type or something but I dunno how that works
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:13
@dylantelson Did you just want country selection or more precision?
CallMeOrange
@EgnaroDev
Jul 13 2017 04:13
What the hell..
dylantelson
@dylantelson
Jul 13 2017 04:13
I have the city name already
I just want the country name because darksky's API doesn't include the country
CallMeOrange
@EgnaroDev
Jul 13 2017 04:14
For input, I was trying to do something like hit enter then get result but I only needed form tags whole time.
dylantelson
@dylantelson
Jul 13 2017 04:14
just city and continent (for some cities, for some it includes country but usually not)
CallMeOrange
@EgnaroDev
Jul 13 2017 04:14
:(:gun:
dylantelson
@dylantelson
Jul 13 2017 04:17
hows the quote thing going @GingerChew ?
CallMeOrange
@EgnaroDev
Jul 13 2017 04:17
finally
Input thingy completed :/
Now I can hit enter
Jul 13 2017 04:18
@MCTwoDigitZero It's not displaying any results
CallMeOrange
@EgnaroDev
Jul 13 2017 04:19
It doesn't yet
Just type something then hit enter
dylantelson
@dylantelson
Jul 13 2017 04:19
that's gonna be fun
CallMeOrange
@EgnaroDev
Jul 13 2017 04:19
You search for... should show up
Jul 13 2017 04:19
@MCTwoDigitZero yeah it does
dylantelson
@dylantelson
Jul 13 2017 04:19
i dunno how the wikipedia api works but i assume its a big for loop
CallMeOrange
@EgnaroDev
Jul 13 2017 04:19
Yea, Thats what I was working with
@dylantelson Honestly, I have no clue where to start lol even if I made many projects for random quote machines and weather app
dylantelson
@dylantelson
Jul 13 2017 04:20
did you see if theres a wikipedia api?
Jul 13 2017 04:20
@MCTwoDigitZero here's my wiki viewer https://codepen.io/anshuladlakha/full/gWEXqo/
CallMeOrange
@EgnaroDev
Jul 13 2017 04:21
@dylantelson Yeah but its complicated
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:21
@dylantelson Okay, I think I have some idea. There's just a couple things I'm not sure about.
dylantelson
@dylantelson
Jul 13 2017 04:21
you dont need links for the wikiviewer?
and hit me, kumquatfelafel :)
Jul 13 2017 04:21
@MCTwoDigitZero you should check out the wiki api
dylantelson
@dylantelson
Jul 13 2017 04:22
yeah, I dunno about it because I haven't gotten to it but it doesn't seem all that hard
gets the title and summary/description of each of the top ones, then uses a for loop to show each of them?
cant say because I dunno the API I guess
CallMeOrange
@EgnaroDev
Jul 13 2017 04:23
@anshuladlakha Where am I supposed to get wiki api? :/ I have this /w/api.php?action=query&format=json&prop=revisions&titles=Main+Page&rvprop=content from API sandbox
@dylantelson You could understand how to use a for loop with API for weather forecast
Jul 13 2017 04:24
@MCTwoDigitZero you need to use the query api
@MCTwoDigitZero wait i'll send you a link
CallMeOrange
@EgnaroDev
Jul 13 2017 04:24
Everyone use same thing?
Okay
Jul 13 2017 04:25
CallMeOrange
@EgnaroDev
Jul 13 2017 04:26
is that the one from fCC?
url seems different
Jul 13 2017 04:26
@MCTwoDigitZero I dont know about that
CallMeOrange
@EgnaroDev
Jul 13 2017 04:26
Hint #2: Here's an entry on using Wikipedia's API: https://www.mediawiki.org/wiki/API:Main_page.
dylantelson
@dylantelson
Jul 13 2017 04:27
actually I think I just got it
Jul 13 2017 04:27
@MCTwoDigitZero Thats like the intro page to the api , i gave you a more specific link for what you need right now.
dylantelson
@dylantelson
Jul 13 2017 04:28
YEAH
CallMeOrange
@EgnaroDev
Jul 13 2017 04:28
ah I see
CamperBot
@camperbot
Jul 13 2017 04:28
mctwodigitzero sends brownie points to @anshuladlakha :sparkles: :thumbsup: :sparkles:
dylantelson
@dylantelson
Jul 13 2017 04:28
I think I just got it!
CamperBot
@camperbot
Jul 13 2017 04:28
dylantelson
@dylantelson
Jul 13 2017 04:28
at least it works with my locatoin
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:28
@dylantelson Okay. I think I more or less have it, but I actually have to code it out to see if works haha
dylantelson
@dylantelson
Jul 13 2017 04:28
CallMeOrange
@EgnaroDev
Jul 13 2017 04:28
@dylantelson Works for me
dylantelson
@dylantelson
Jul 13 2017 04:28
could someone see if it works for them? should say city, country
hahah kumquatfelafel I'm so sorry
CallMeOrange
@EgnaroDev
Jul 13 2017 04:28
But not specify location
dylantelson
@dylantelson
Jul 13 2017 04:28
but I think I just fixed it
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:28
@dylantelson np :p
dylantelson
@dylantelson
Jul 13 2017 04:28
how did you do it?
and what do you mean specify location, MCTwo?
CallMeOrange
@EgnaroDev
Jul 13 2017 04:28
It says Los Angeles, United States
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:29
I didn't yet. I'll check your code
dylantelson
@dylantelson
Jul 13 2017 04:29
oh, doesnt say state
I just added a for loop where I checked the first index for every "types"
CallMeOrange
@EgnaroDev
Jul 13 2017 04:29
At least Los Angeles is in California lol
dylantelson
@dylantelson
Jul 13 2017 04:30
oh shit, that's because I'm using Darksky for that part
where do you live, MC? Like
CallMeOrange
@EgnaroDev
Jul 13 2017 04:30
yea timezone
CA
dylantelson
@dylantelson
Jul 13 2017 04:30
you dont have to tell me exactly lol
but like, near LA?
CallMeOrange
@EgnaroDev
Jul 13 2017 04:30
Not really, LA is in CA tho
dylantelson
@dylantelson
Jul 13 2017 04:30
or in the opposite side of CA
I guess it just uses LA for all of cali or something
I'll try to fix that, should be easy
CallMeOrange
@EgnaroDev
Jul 13 2017 04:31
Hm..
But its timezone
I dont see how you can change it :/
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:31
dylantelson
@dylantelson
Jul 13 2017 04:32
using Google's API I should be able to get it way better
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:32
Keep in mind though that weather in X (from darksky) may not be same as weather in Y (from google)
...
I don't suppose dark sky has a "get weather for city"? :laughing:
dylantelson
@dylantelson
Jul 13 2017 04:33
or wait
I'm not in the US atm, on vacation in Argentina
heroiczero
@heroiczero
Jul 13 2017 04:34
@dylantelson nice job :+1:
@dylantelson says US for me
CallMeOrange
@EgnaroDev
Jul 13 2017 04:34
@dylantelson oh, at least it got my city
dylantelson
@dylantelson
Jul 13 2017 04:34
what city does it say, heroic?
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:34
^rather, is city accurate
dylantelson
@dylantelson
Jul 13 2017 04:34
I could get more specific if I wanted, could say state
CallMeOrange
@EgnaroDev
Jul 13 2017 04:35
It got my city
Right City, United States
But I think just city is good enough, just like my weather apps
Joseph
@revisualize
Jul 13 2017 04:35
Hello.
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:35
@dylantelson :+1:
CallMeOrange
@EgnaroDev
Jul 13 2017 04:35
:wave:
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:36
hi
CallMeOrange
@EgnaroDev
Jul 13 2017 04:36
dylantelson
@dylantelson
Jul 13 2017 04:36
could you try again?
I think I added the state thing
but in Argentina it just says Buenos Aires, Buenos Aires, Argentina
Joseph
@revisualize
Jul 13 2017 04:36
/collapse-all
CallMeOrange
@EgnaroDev
Jul 13 2017 04:36
Yeah
dylantelson
@dylantelson
Jul 13 2017 04:36
because the city and state name is the same here
CallMeOrange
@EgnaroDev
Jul 13 2017 04:36
Like that
City, State, United States
dylantelson
@dylantelson
Jul 13 2017 04:37
says San Diego (or whatever your city is), California, US?
awesome
CallMeOrange
@EgnaroDev
Jul 13 2017 04:37
But a bit too much dont you think?
dylantelson
@dylantelson
Jul 13 2017 04:37
I could make it so it shows the short name
of the state
CallMeOrange
@EgnaroDev
Jul 13 2017 04:37
Just City and state might be enough
dylantelson
@dylantelson
Jul 13 2017 04:37
but it might suck if it's another country
CallMeOrange
@EgnaroDev
Jul 13 2017 04:37
Yeah lol
dylantelson
@dylantelson
Jul 13 2017 04:37
nah, the point is you can check the city of another country
like Warsaw, Poland
would be weird if it didnt say the country in places other than the US
CallMeOrange
@EgnaroDev
Jul 13 2017 04:38
California = CA is good but like Washington.... or New York
Maybe create 50 if statements for US :joy:

if ('New York') {
return 'NY';
}
That is why , city is good enough for me :p
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:39
But what if it's Olde Yorke?
dylantelson
@dylantelson
Jul 13 2017 04:39
well it would be way easier than that
could just check if the country is the US
then make it short_name instead of long
for now I'll leave the state as shortened, later I'll see if I change it based on location or what
CallMeOrange
@EgnaroDev
Jul 13 2017 04:40
Alright
I wonder what you need to know to become Web Developer
I could consider myself as "Web Developer" but eh..
@abohannon
Jul 13 2017 04:45
Can anyone help me understand how the XOR and bitwise operator works? This was considered an "easy" algo, but I can't reason through it.
var getSum = function(a, b) {
if (b == 0) {
return a;
} else {
return getSum(a ^ b, (a & b) << 1)
}
};
dylantelson
@dylantelson
Jul 13 2017 04:46
as long as you are experienced enough to make websites yourself, you're a web developer
like, if you can make a portfolio website yourself, you're a web developer, even if just a novice
even if not a professional yet
CallMeOrange
@EgnaroDev
Jul 13 2017 04:47
Yeah..
I dont need to consider myself as "Web" Developer, we can even call ourselves Developer
Mike
@MikeJSchorah
Jul 13 2017 04:49
Is Hackerrank the best way to learn JavaScript algorithms?
CallMeOrange
@EgnaroDev
Jul 13 2017 04:50
I dont know but HackerRank seems interesting
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:51

@abohannon These operators start to delve into binary.

Before launching into explanation, do you get basic idea... What 1 and 0 mean, how you would represent 2, 4, 5, etc in binary and so on?

CallMeOrange
@EgnaroDev
Jul 13 2017 04:51
They work :), add a space or whatever like Hello World
@abohannon
Jul 13 2017 04:51
@kumquatfelafel yea, I understand that integers are represented by a series of binary numbers (i'd have to look up what each are).
CallMeOrange
@EgnaroDev
Jul 13 2017 04:52
Last time, searching Hello World but google result get Hello
I fixed it
@abohannon
Jul 13 2017 04:52
I'm just curious how one is supposed to use a ^ b and understand what the output is supposed to be. @kumquatfelafel
Mike
@MikeJSchorah
Jul 13 2017 04:53
I'm convinced... Hackerrank is the best way to learn JavaScript algorithms
CallMeOrange
@EgnaroDev
Jul 13 2017 04:53
Great... only one result works with a single space
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:53
So for binary, it goes by powers of 2. To keep it simple, lets assume we're only working with 4 bits (this is... certainly not true, but :p ).
CallMeOrange
@EgnaroDev
Jul 13 2017 04:54
@MikeJSchorah Yeah, I tried codefights or codewars but didnt go well for me but I want to try out HackerRank :)
@abohannon
Jul 13 2017 04:54
if i understand it correctly, it compares the binary of each integer and returns a 1 where the sequence is 1,0 or 0,1, and a 0 where it is 1, 1 or 0,0 @kumquatfelafel
danskeerththana
@danskeerththana
Jul 13 2017 04:54

Declare a constant named p1.

Set p1 equal to a JSX <p></p> element. Write the word foo in between the <p></p> tags.

kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:55

0001 = 2 ^ 0 = 1
0010 = 2 ^1 =2
0100 = 2 ^2 =4
1000 = 2^3 =8

You can also have more than one 1...
e.g.
1101 = 2^3 + 2^2 + 2^0 = 8 + 4 + 1 = 13

CallMeOrange
@EgnaroDev
Jul 13 2017 04:56
@kumquatfelafel hey if I have something like this var googleRes = value.replace(' ', '+'); how can I replace all spaces?
For me, it only replace with one space
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:56
@abohannon That is what ^ does, correct.
danskeerththana
@danskeerththana
Jul 13 2017 04:57
attributes React js

Declare a constant named p1.

Set p1 equal to a JSX <p></p> element. Write the word foo in between the <p></p> tags.

kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:57
So if I have 8 and 4, XORing it would give me
1000 ^ 0100 = 1100 ... or 12.
CallMeOrange
@EgnaroDev
Jul 13 2017 04:57
:zzz:
@abohannon
Jul 13 2017 04:58
@kumquatfelafel ok that makes sense.
Joseph
@revisualize
Jul 13 2017 04:58
Free Book of the day: Mastering Hadoop ... https://www.packtpub.com/packt/offers/free-learning
CallMeOrange
@EgnaroDev
Jul 13 2017 04:59
oh that remind me
kumquatfelafel
@kumquatfelafel
Jul 13 2017 04:59
Now, this adds all well and good when you don't get any overlap, but this isn't always the case. For example, suppose I want to add 2 and 3 If i just use ^, we get...
0010 ^ 0011 = 0001... which isn't quite right. :p
So we need to do a bit more here
Mike
@MikeJSchorah
Jul 13 2017 05:00
@MCTwoDigitZero I've only tried out Hackerrank. But, I'm basing my answer purely on Alexa rankings.
CallMeOrange
@EgnaroDev
Jul 13 2017 05:00
What happened?
Mike
@MikeJSchorah
Jul 13 2017 05:01
codewars = 13,530
hackerrank = 3,289
CallMeOrange
@EgnaroDev
Jul 13 2017 05:01
Whats that?
Mike
@MikeJSchorah
Jul 13 2017 05:01
codefights = 10,898
CallMeOrange
@EgnaroDev
Jul 13 2017 05:01
Rates?
dylantelson
@dylantelson
Jul 13 2017 05:02
alexa is a site that ranks websites from most to least popular
@abohannon
Jul 13 2017 05:02
@MikeJSchorah have you tried leetcode.com?
@kumquatfelafel so for the final part, (a & b) << 1, is it trial and error finding which configurations returns the sum of a + b?
Mike
@MikeJSchorah
Jul 13 2017 05:03
Alexa ranks websites based on traffic. I figure if it's a popular website than it must be a good website. For instance, Google is ranked #1, Facebook is ranked #3 and Free Code Camp is ranked #2393
CallMeOrange
@EgnaroDev
Jul 13 2017 05:04
oh I get it
Mike
@MikeJSchorah
Jul 13 2017 05:04
So, Hackerrank is actually ranked higher than Free Code Camp
CallMeOrange
@EgnaroDev
Jul 13 2017 05:04
So thats mean HackerRank is better than codefights/codewars?
ranked*
Mike
@MikeJSchorah
Jul 13 2017 05:04
Therefore Hackerrank is more popular than Free Code Camp
kumquatfelafel
@kumquatfelafel
Jul 13 2017 05:04

a & b Will give binary bits 1 when bit for both a and b is 1. Otherwise it will be 0.

So 2 & 3... (can help to look at vertically)
2: 0010
3: 0011

becomes 0010

Now onto <<

<< bitshifts to left. So 0010 becomes 0100 (you can also think of it like multiplying by two)

Mike
@MikeJSchorah
Jul 13 2017 05:04
@MCTwoDigitZero If people are gravitating to it, I would assume so
CallMeOrange
@EgnaroDev
Jul 13 2017 05:05
@MikeJSchorah But HackerRank rank better than Codefights/codewars?
@abohannon
Jul 13 2017 05:05
@MikeJSchorah it seems hackerrank.com is declining in popularity though
while leetcode.com, for instance is climbing faster in popularity
CallMeOrange
@EgnaroDev
Jul 13 2017 05:05
codewars = 13,530
hackerrank = 3,289
dylantelson
@dylantelson
Jul 13 2017 05:06
#1 is the #1 site
Mike
@MikeJSchorah
Jul 13 2017 05:06
@abohannon leetcode is ranked #2,387; slightly lower than Hackerrank. Does it have JavaScript exercises?
dylantelson
@dylantelson
Jul 13 2017 05:06
the lower the better
CallMeOrange
@EgnaroDev
Jul 13 2017 05:06
Im confused..
@abohannon
Jul 13 2017 05:06
@MikeJSchorah yes, @kumquatfelafel and i are discussing one right now in fact
dylantelson
@dylantelson
Jul 13 2017 05:06
the top 5 websites in the world
CallMeOrange
@EgnaroDev
Jul 13 2017 05:07
So say... 1000 is ranked better than 2000?
dylantelson
@dylantelson
Jul 13 2017 05:07
yahoo?
Mike
@MikeJSchorah
Jul 13 2017 05:07
@MCTwoDigitZero
codewars = 13,530
hackerrank = 3,289
codefights = 10,898
dylantelson
@dylantelson
Jul 13 2017 05:07
most popular website in the world is the #1 website
CallMeOrange
@EgnaroDev
Jul 13 2017 05:07
Dude Im asking if Hackerrank rank better than codewars and codefights
dylantelson
@dylantelson
Jul 13 2017 05:07
its like imagine a top 100, #1 is the best
CallMeOrange
@EgnaroDev
Jul 13 2017 05:07
or rank lower..
@abohannon
Jul 13 2017 05:07
@kumquatfelafel ok, i see how this is working now, thank you for explaining. My last question is: how does one begin to reason through this? Like, how am I supposed to know I can use these without knowing binary by heart?
CamperBot
@camperbot
Jul 13 2017 05:07
abohannon sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
kumquatfelafel
@kumquatfelafel
Jul 13 2017 05:07
@abohannon So running through this function once with 2 and 3, we now call getSum again with 1 and 4. (0001 and 0100)
dylantelson
@dylantelson
Jul 13 2017 05:07
according to the rankings, if it's a lower rnak, it's better ranked
CallMeOrange
@EgnaroDev
Jul 13 2017 05:07
Ah
dylantelson
@dylantelson
Jul 13 2017 05:08
because if its 3,000 or whatever
kumquatfelafel
@kumquatfelafel
Jul 13 2017 05:08
@abohannon So there's a certain logic to it.
Mike
@MikeJSchorah
Jul 13 2017 05:08
YouTube is #2. Kind of figured that. Kind of shocked that it's ranked higher than Facebook.
CallMeOrange
@EgnaroDev
Jul 13 2017 05:08
So that means HackerRank rank better than codewars?
dylantelson
@dylantelson
Jul 13 2017 05:08
it means it's the #3,000th most popular or something
alexa doesnt really matter though
CallMeOrange
@EgnaroDev
Jul 13 2017 05:08
alexa?
dylantelson
@dylantelson
Jul 13 2017 05:08
i forgot whether i asked this, whats a good place to get weather icons
for my weather app
alexa is the website that ranks websites
Mike
@MikeJSchorah
Jul 13 2017 05:09
@MCTwoDigitZero Google is #1... um... does that help?
dylantelson
@dylantelson
Jul 13 2017 05:09
dude it's like if I tell you to rank your 10,000 favorite movies
Mike
@MikeJSchorah
Jul 13 2017 05:09
@dylantelson You could try iconicons
CallMeOrange
@EgnaroDev
Jul 13 2017 05:09
@MikeJSchorah Yeah but nobody answered my question lol
dylantelson
@dylantelson
Jul 13 2017 05:09
i dont know what hackerranks rank is or codewars
CallMeOrange
@EgnaroDev
Jul 13 2017 05:09
ok... I get it..
dylantelson
@dylantelson
Jul 13 2017 05:09
if the rank is a lower number, it's more popular
CallMeOrange
@EgnaroDev
Jul 13 2017 05:09
@MCTwoDigitZero
codewars = 13,530
hackerrank = 3,289
codefights = 10,898
kumquatfelafel
@kumquatfelafel
Jul 13 2017 05:10
@abohannon But you do have to have a grasp of binary/bitshift operators before you'd decide "Say, I think I'll do it this way!"
That being said, one would probably just say 2+4. :p
CallMeOrange
@EgnaroDev
Jul 13 2017 05:10
@dylantelson ^
dylantelson
@dylantelson
Jul 13 2017 05:10
hackerrank is the most popular of those apparently
CallMeOrange
@EgnaroDev
Jul 13 2017 05:10
I see
@abohannon
Jul 13 2017 05:10
@dylantelson give this a try: https://cdnjs.com/libraries/weather-icons
dylantelson
@dylantelson
Jul 13 2017 05:10
far and away because of india
most people who visit that website visit it from india
Mike
@MikeJSchorah
Jul 13 2017 05:10
Aaaah. I apologize. Leetcode is actually ranked higher than Hackerrank
dylantelson
@dylantelson
Jul 13 2017 05:10
in the US, the others are probably more popular
???
my text aint sendin
oh, now it did I think
Mike
@MikeJSchorah
Jul 13 2017 05:11
Leetcode = 2,387 in the United States. Hackerrank = 3,289 in the United States. I know where I will be learning my algorithms. Thanks @abohannon
CamperBot
@camperbot
Jul 13 2017 05:11
mikejschorah sends brownie points to @abohannon :sparkles: :thumbsup: :sparkles:
kumquatfelafel
@kumquatfelafel
Jul 13 2017 05:11
@abohannon Though the idea is, because either or knocks out all "duplicates", you want to save those. & is perfect for this, since it will only apply when they're both 1 (we don't care when both bits are 0)
@abohannon
Jul 13 2017 05:12
@MikeJSchorah :+1:
dylantelson
@dylantelson
Jul 13 2017 05:12
@abohannon do I have to include this somewhere?
kumquatfelafel
@kumquatfelafel
Jul 13 2017 05:12
We multiply by 2 since 2 of a given bit is the next bit to the left
dylantelson
@dylantelson
Jul 13 2017 05:12
or do I just use its url
CallMeOrange
@EgnaroDev
Jul 13 2017 05:12
leetcode looks great I guess
Will try leetcode and hackerrank
dylantelson
@dylantelson
Jul 13 2017 05:12
cloudfare means I can just include it, right
@abohannon
Jul 13 2017 05:12
@kumquatfelafel I see.
dylantelson
@dylantelson
Jul 13 2017 05:13
but i dunno how to include it
@abohannon
Jul 13 2017 05:14
@kumquatfelafel Yea, 2+4 is easier haha but the algo challenge said not to use a + operator =\
kumquatfelafel
@kumquatfelafel
Jul 13 2017 05:14
@abohannon :p
@abohannon
Jul 13 2017 05:14
and i had never used bitwise operators before so I guess it was time to learn!
so thank you @kumquatfelafel
CamperBot
@camperbot
Jul 13 2017 05:14
abohannon sends brownie points to @kumquatfelafel :sparkles: :thumbsup: :sparkles:
:warning: abohannon already gave kumquatfelafel points
dylantelson
@dylantelson
Jul 13 2017 05:15
hey Adam, know how I include the cloudfare CDN?
@abohannon
Jul 13 2017 05:15
@dylantelson I picked the following libraries for my weather app
<link href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.min.css" rel="stylesheet">
dylantelson
@dylantelson
Jul 13 2017 05:15
awesome, thanks
@abohannon
Jul 13 2017 05:15
dylantelson
@dylantelson
Jul 13 2017 05:15
yeah, got it
just wasnt sure what the link to include was
CallMeOrange
@EgnaroDev
Jul 13 2017 05:15
really?
Claudio Restifo
@Marmiz
Jul 13 2017 05:16
@abohannon for reference you can use either the min.css or the css` version. You probably don't need them both.. saving yourself some loading time :)
@abohannon
Jul 13 2017 05:16
@dylantelson the site is really helpful too, so check out the docs and you should have no problem implementing the icons.
CallMeOrange
@EgnaroDev
Jul 13 2017 05:16
Me: what is 2+2? hm... Head: 4, Me: oh! 4
@abohannon
Jul 13 2017 05:16
@Marmiz ah yes, you're totally right. Thanks!
CamperBot
@camperbot
Jul 13 2017 05:16
abohannon sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles: