yCode Home

yCode Scramble Example

//this function will calculate a factorial
function myFactorial(n)
{
/* we assume an integer input greater than or equal to zero */
  if (n<=1) return 1;
  var factorial_value=1;
  var loop_index;
  for (loop_index = 2; loop_index<=n; loop_index++)
  {
   factorial_value*=loop_index;
  }

  return factorial_value;
}
  • function keyword is on a separate line; argument(s) are on the same line as the function name.
  • program statements are on separate lines and should be terminated with ";"
  • loop variable declared on a separate line using var keyword
  • we didn't use x or y variables since they define some properties for dhtml objects and hence will not be scrambled.
  • The same function after being scrambled:

    function x940202882765(x940202882766) { if (x940202882766<=1) return 1; var x940202882767=1; var x940202882768; for (x940202882768 = 2; x940202882768<=x940202882766; x940202882768++) { x940202882767*=x940202882768; } return x940202882767; }