background preloader

JavaScript

Facebook Twitter

JavascriptTips - jslibs - JavaScript language advanced tips and tricks - standalone JavaScript development runtime environment with general purpose native libraries. These tips and tricks are not related to any web browser or any Document Object Model (DOM), they are only general purpose tips and tricks for the JavaScript language. Some of these tricks are using a latest version of JavaScript language (v1.8) and cannot run with the Microsoft Implementation of JavaScript (v1.5). All these tricks has been tested with the Mozilla SpiderMonkey/TraceMonkey JavaScript engine (v1.8).

You can try these examples using jshost, a command-line JavaScript interpreter. (download it). If you need more explanation about one of the following tips, don't hesitate to ask me or use the comment section at the end of this page. See the TOC at the end of the page. Append an array to another array var a = [4,5,6];var b = [7,8,9];Array.prototype.push.apply(a, b); uneval(a); // is: [4, 5, 6, 7, 8, 9] Milliseconds since epoch +new Date() // 1259359833574 Simulate threads using yield operator JavaScript 1.7 //// thread definitionfunction Thread( name ) { for ( var i = 0; i < 5; i++ ) { note.

Tomek on Software: Multi-line strings in JavaScript and Node.js. When writing Node.js or JavaScript applications, you sometimes need to embed multi-line strings in your code. It may be a snippet of HTML, a fragment of textual template, a piece of XML (remember XML?) , or code in another programming language. JavaScript has no built-in way of representing multi-line strings. If you need to embed a longer non-JavaScript text in your application the natural options are limited to concatenating several one-line JavaScript strings or using external files. Unless, of course, you use a little known trick: var html = (function () {/* <!

What happens here? That pattern can be applied to a variety of types of multi-line text. Enjoy!

JSON

Superhero.js. JSLint,The JavaScript Code Quality Tool. JsMini.com - Minify Your Javascript/jQuery Code Online. Librarries. WebSockets. Node.js. Three.js - JavaScript 3D library. Tutorial. JavaScript. JavaScript (JS) is a lightweight interpreted (or just-in-time compiled) programming language with first-class functions.

While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. JavaScript's dynamic capabilities include runtime object construction, variable parameter lists, function variables, dynamic script creation (via eval), object introspection (via for...in and Object utilities), and source-code recovery (JavaScript functions store their source text and can be retrieved through toString()). This section is dedicated to the JavaScript language itself, and not the parts that are specific to Web pages or other host environments. Looking to become a front-end web developer?

Get started.

Jquery