Category Archives: JavaScript

Another 10 Interesting JavaScript Features

I previously posted about 10 Interesting JavaScript Features. Here’s ten more JavaScript features that I’ve recently found interesting.
Posted in JavaScript | Tagged | Comments closed

Should you use semicolons in JavaScript?

There has been a quite a bit of chatter recently on whether or not you should use semicolons in your JavaScript code. JavaScript provides a feature called Automatic Semicolon Insertion (ASI). For the most part there are rarely problems in omitting semicolons, but there are a few cases where semicolons are required to prevent syntax [...]
Posted in JavaScript | Tagged , , , | Comments closed

Creating namespaces in JavaScript

In the past it was very common to see global variables in snippets of JavaScript code across the web, such as: name = "Spock"; function greeting() { return "Hello " + name; } A better approach is to place all of your code within a namespace; an object that contains all of your code and [...]
Posted in JavaScript | Tagged | Comments closed

10 Interesting JavaScript Features

I’ve been doing some more reading on JavaScript recently and decided to note down some of what were interesting features for me. If you’ve been doing JavaScript for a while then please let me know if anything looks a bit off, otherwise I hope you find the list an interesting read!
Posted in JavaScript | Tagged , , , , , , , , , , , , , , , , | Comments closed

Find the position of an element with JavaScript

Quirksmode provides a nice findPos() function to find the absolute position of an element on a page. If you need to find the position of the element relative to the viewport then you will also need to know the page’s current scroll position, which I found over at Stack Overflow.
Posted in JavaScript | Tagged , , , , | Comments closed