JavaScript / November 16, 2010

JS Generator – Newton’s Method

Basic implementation of the Newton’s Method for narrowing in on a square root. NOTE: in Firefox the yield keyword doesn’t exist unless the script tag loading the function has a type of “text/javascript;version=1.7”. version must be 1.7 or higher.

Read More
JavaScript / October 4, 2010

Delegated AJAX

About a year ago I needed a quick and easy AJAX library to just grab XML or JSON. At that time I was working heavily in Objective-C on the iPhone which uses a lot of delegation of functionality. I wanted to build something similar for my web application. In most browsers the XMLHttpRequest object is

Read More
JavaScript / October 2, 2010

JS Generator – Fibonacci Example

The function fibonacci contains the keyword “yield” making the function a generator. When the function is called it returns an iterator. The first time the iterator’s next function is called the fibonacci function runs like normal until the yield keyword. Yield works just like return, returning the value specified. The next time “next” is called

Read More