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
javascript parse time (minutes:seconds) from milliseconds
How to parse a given amount of milliseconds (e.g. 125230.41294642858) into a time format like: minutes:seconds? Answer
How to check if a string contains text from an array of substrings in JavaScript?
Pretty straight forward. In javascript, I need to check if a string contains any substrings held in an array. Answer There’s nothing built-in that will do that for you, you’ll have to write a function for it, although it can be just a callback to the some array method. Two approaches for you: Array some method Regular expression Array some
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
Convert to uppercase as user types using javascript
I want to convert lowercase chars to uppercase as the user types using javascript. Any suggestions are welcome. I have tried the following: Answer
Can someone explain me how jjencode works and if is good to use it on my code
Can someone explain me how http://utf-8.jp/public/jjencode.html works and if is good to use it on my code? The first time I tried it I thought that I needed to have some kind of algorithm in my code to use it, but it works on every site. What is happening? I already read the source code but I don’t understand it.
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