Javascript...End Javascript: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Created page with "JAVASCRIPT <br /> :[statements] <br /> END JAVASCRIPT '''Description''' The JAVASCRIPT statement allows you to ember pure JavaScript in your NS Basic/X program. This allows ...")
 
No edit summary
Line 1: Line 1:
JAVASCRIPT <br />
JAVASCRIPT <br />
:[statements] <br />
:[''statements''] <br />
END JAVASCRIPT
END JAVASCRIPT



Revision as of 17:22, 8 July 2012

JAVASCRIPT

[statements]

END JAVASCRIPT

Description

The JAVASCRIPT statement allows you to ember pure JavaScript in your NS Basic/X program. This allows you to have additional functionality or to reuse functions from other JavaScript projects. Statements within this block must follow all JavaScript rules. They are ignored by NS Basic/X itself. For more information, see the Tech Note ‘The role of JavaScript and WebKit’.

Example

REM JAVASCRIPT…END JAVASCRIPT sample
Dim s
s = "knuTH"
JAVASCRIPT
  function UCFirst(str){
    // split string
    firstChar = str.substring(0,1);
    remainChar = str.substring(1);
 
    // convert case
    firstChar = firstChar.toUpperCase(); 
    remainChar = remainChar.toLowerCase();
 
    return firstChar + remainChar
  }
END JAVASCRIPT
Print UCFirst(s)

Output

Knuth

Related Items

HTML