Javascript...End Javascript: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
JAVASCRIPT <br />
JavaScript <br />
:[''statements''] <br />
:[''statements''] <br />
END JAVASCRIPT
End JavaScript


'''Description'''
== 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’.
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'''
== Example ==


<pre>
<pre>
REM JAVASCRIPT…END JAVASCRIPT sample
REM JavaScript…End JavaScript sample
Dim s
Dim s
s = "knuTH"
s = "knuTH"
JAVASCRIPT
JavaScript
   function UCFirst(str){
   function UCFirst(str){
     // split string
     // split string
Line 25: Line 25:
     return firstChar + remainChar
     return firstChar + remainChar
   }
   }
END JAVASCRIPT
End JavaScript
Print UCFirst(s)
Print UCFirst(s)
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 35: Line 35:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[html|HTML]]
[[html|HTML]]
[[Category:Language Reference]]

Revision as of 01:48, 17 August 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