This page requires a JavaScript-compatible browser.

JS

JavaScript Demos:
Pseudo URLS - Evaluating JavaScript Expressions.

jim.cerny@unh.edu  13-AUG-1998


javascript:7/3

javascript:Math.random()

javascript:for(i=0,j=1,k=0,fib=1; i<10; i++,fib=j+k,k=j,j=fib) alert(fib);


Discussion.

To quickly test the evaluation of a JavaScript expression, you can enter it as a JavaScript pseudo URL and Netscape and Explorer will interpret it. These examples were typed as shown in the browser's File -> Open box for entering URLs.

  • Divide 7 by 3.
  • Display a random number in the range 0,1.
  • Calculate the first ten numbers in a Fibonacci series, i.e., 1,1,2,3,5,8,13,21,34,55,89
This is probably of less use when working by example and of more use when developing your own scripts that involve computation.