background preloader

JavaScript

Facebook Twitter

List of JS game engines. You can find a wikified version at Feel free to modify that. I sync it here every once in a while. Javascript Slideshow. 3D Rotation Viewer | JavaScript Examples. Brewing Java: A Tutorial. Copyright 1995-1998, 2000-2002, 2004-2006 Elliotte Rusty Harold elharo@metalab.unc.edu Last-modified: 2005/07/19 URL: This tutorial has grown into a book called The Java Developer's Resource , available now from Prentice Hall. It's now out of print, but the examples and exercises from that book are also online here and may be of use. For more details about the JDR including the plans for a second edition see the JDR page. Minor corrections on array dimensions Improve naming conventions in examples Fix a typo and make some efforts (incomplete) toward well-formedness Fix a typo and URLs Minor bug fix Some minor changes about = and := Fixed a few typos. Fixed a few bugs. Fixed a few typos Very minor corrections and updates This tutorial covers Java 1.0.

I've fixed a number of typos. I fixed a bug in the Arg method of the complex class. The RAM config program, typewriter applet, Bozo sort algorithm and Java doodle applet are finally included. Linked lists Comments. JavaScript Tutorial. List of JS game engines. You can find a wikified version at Feel free to modify that. I sync it here every once in a while. JavaScript. Javascript using hacks. Javascript is so much fun, except when it’s not. There’s always the fear of runtime errors that keeps us thinking all the time while writing code. It makes us better coders - we have no other option than to visualize every line of code as if it’s running as we write it. That’s why it’s so important to have tidy code. Small code. I gathered some fun snippets I enjoy using instead of boring code that takes too much space. I learned all of this from open source code (until node.js all javascript code was open source, wasn’t it?)

Hipster Hack #1 - Method calling I really hate if/else blocks and this is quite a useful trick to call the right function based on a boolean value. Hipster Hack #2 - String joins It’s a known fact that strings like other strings. Hipster Hack #3 - Default Operator || Javascript is all about not knowing what an object holds. Hipster Hack #4 - Guard Operator && Similar to the Default Operator, this one is super useful. Hipster Hack #5 - XXX Operator Hipster Hack #6 - Timing. Functions and stuff. Although JavaScript deals fine with the syntax of two matching curly braces for blocks, it does not support block scope; hence, all that is left in the language is function scope. function test() { // a scope for(var i = 0; i < 10; i++) { // not a scope // count } console.log(i); // 10} There are also no distinct namespaces in JavaScript, which means that everything gets defined in one globally shared namespace.

Each time a variable is referenced, JavaScript will traverse upwards through all the scopes until it finds it. In the case that it reaches the global scope and still has not found the requested name, it will raise a ReferenceError. The Bane of Global Variables // script Afoo = '42'; // script Bvar foo = '42' The above two scripts do not have the same effect. Again, that is not at all the same effect: not using var can have major implications. // global scopevar foo = 42;function test() { // local scope foo = 21;}test();foo; // 21 Local Variables var foo = 3; bar = 4;}test(10); Hoisting. Functions and stuff. How to enable JavaScript in your browser and why. The Beginner's Guide to three.js.

In this step-by-step guide, we’re going to create a 3D version of the Treehouse logo using three.js, which is a 3D graphics framework built on top of WebGL. Click and drag your mouse to orbit the camera! You can also use your mousewheel to zoom in and out. See the Demo Download the Code View on CodePen Note: You’ll need the desktop version of either Chrome, Firefox, or Safari. See browser compatibility below. 3D graphics can be difficult, especially 3D in the browser. Even though three.js might look complex at first, it would actually take even more code to write the same thing in pure WebGL, mostly because we’d need to write a rendering engine. Browser Compatibility For this tutorial, you’ll need the desktop version of either Chrome, Firefox, or Safari. Also, if you’re using Safari, you need to enable WebGL first. Open the Preferences menu.Click on the Advanced tab.Click the checkbox that says Show Develop menu in menu bar.Open the Develop menu from the menu bar and select Enable WebGL.