Camel Case - xhr.onreadystatechange (solved - it just is, now eat your food Johnny)


#1

(https://www.codecademy.com/courses/intermediate-javascript-requests/lessons/requests-i/exercises/xhr-get-requests-ii?action=lesson_resume&course_redirect=introduction-to-javascript)

Why is the following property of xhr not camelcased?:

xhr.onreadystatechange

According to https://www.w3schools.com/xml/dom_http.asp it is not camel cased, so I guess it’s just one of those things. Nothing to see here folks, just human written code!


#2

i would be careful with the use of w3schools:

http://www.w3fools.com/
https://www.quora.com/Why-is-it-that-some-web-programmers-and-designers-do-not-recommend-W3Schools-to-use-as-a-reference-manual-and-what-are-some-alternatives

its not that you can’t use w3schools, but you have to be careful.

That is weird, properties are usually cammelcase. I would personally not worry about it, someone implemented this method and decide not to use cammelcase. Personally not something i would focus on


#3

Morning!

Thanks for the insight, I’ll check it out :upside_down_face:

I found this comment on a teamtreehouse forum:

A lot of the javascript events don’t follow the camel case conventions (onclick, onmouseover, …). So I guess the rule of thumb is that your methods should be camel case, but don’t always expect events to follow suit because many were created before casing conventions became uniform.


#4

I just went searching the web for this very question. The answer above appears to be the most widely accepted. I can live with it.