TechHui

Hawaiʻi's Technology Community

Leo D's Blog – March 2014 Archive (2)

A pretty neat programming interview question

Added by Leo D on March 24, 2014 at 10:03pm — 1 Comment

Sequencing computations in Javascript

Sequencing computations in Javascript

Given any sequence of simple assignment statements concluded by a return statement, we can view the whole sequence

as a function that executes the first statement,

and then executes and returns a function that contains the rest of the statements.

For example, this sequence of two statements, which results in 6,



x = 3;

2*x;

=>

6

can be re-written as:



(function(x){

return…
Continue

Added by Leo D on March 20, 2014 at 2:00am — 1 Comment

Sponsors

web design, web development, localization

© 2019   Created by Daniel Leuck.   Powered by

Badges  |  Report an Issue  |  Terms of Service