Skip to content
Advertisement

Why does the radix for JavaScript’s parseInt default to 8?

Defaulting the radix to 8 (if the string starts with a 0) in JavaScript’s parseInt function annoys me, only because I continue to forgot to pass the optional second argument as 10. I’m looking for an answer telling me why it makes sense to have it default to 8. Answer It only “defaults” to 8 if the input string starts

navigator.language list of all languages

Where i can see the list of languages and their codes? I want to compare languages and auto-select required language in template. Are they cross-browser equal? Any other solution? Answer This list of languages is defined by the ISO : http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes Example : be for belarus, fr for french. If you are looking for something more specific, those are not

Detect when a user leaves a website

I am trying to create my own website access library (for fun) like Google Analytics where I can detect when a user accesses my website, what pages they view etc. Is there a way to determine when the user leaves a page &/or leaves the website for good? I have successfully coded (in python) the detecting when the user 1st

JavaScript numbers to Words

I’m trying to convert numbers into english words, for example 1234 would become: “one thousand two hundred thirty four”. My Tactic goes like this: Separate the digits to three and put them on Array (finlOutPut), from right to left. Convert each group (each cell in the finlOutPut array) of three digits to a word (this what the triConvert function does).

this.name returns undefined in javascript

I am trying to remotely create an onclick for each <div> (to save typing time). Here is the window.onload() function: The name of every <div> is “flyingsheep” – this value was set by <div name=”flyingsheep”>. When I click the <div>, the iframe “game” takes me to the webpage “/games/undefined”. Answer This will work. the problem is corrected. just use :

How to wait until an element exists?

I’m working on an Extension in Chrome, and I’m wondering: what’s the best way to find out when an element comes into existence? Using plain javascript, with an interval that checks until an element exists, or does jQuery have some easy way to do this? Answer DOMNodeInserted is being deprecated, along with the other DOM mutation events, because of performance

Advertisement