Purpose
You want to return a function result in your JavaScript function
 

Solution
Use the function with parentheses e.g.

return s.toUpperCase();

Remark
The notation without parentheses

return s.toUpperCase;

is syntactically correct but returns the "toUpperCase" string function and not its result. In most cases this is not what you intend. It is possible (but rarely makes sense) to use the returned function in subsequent JavaScript calls; see the examples 3 and 4 below.

Example 1
CallJS x = toUpper "abcde"
Message
"&V[x]"

// JavaScript upper case function
function toUpper(s) 
{
  return s.toUpperCase();
};


Example 2
CallJS x = toUpper "abcde"
Message
"&V[x]"

// JavaScript upper case function
function toUpper(s) 
{
  return s.toUpperCase;
};


Example 3
CallJS mytoupper = toUpper "xyz"
CallJS
x = mycall "&V[mytoupper]"  "abcde"
Message
"&V[x]"

// JavaScript upper case function
function toUpper(s) 
{
  return s.toUpperCase;
};

function mycall(m,s)
{
 
return m.call(s);
};


Example 4
CallJS mytoupper = toUpper
CallJS
x = mycall "&V[mytoupper]"  "abcde"
Message
"&V[x]"

// JavaScript upper case function
function toUpper() 
{
  return String.prototype.toUpperCase;
};

function mycall(m,s)
{
 
return m.call(s);
};


 

Components
InputAssistant + Controls