CompanyX

Slicing a String using JavaScript Inline

$js.eval('new String("test").slice(0,3)')

$js.eval('new String("test").slice(0,3)')

Calling a JavaScript Function

$js.evalExpression('/demos/scripting/js/jstest.js','sliceMe("testme")')

The contents of the jstest are

function sliceMe(str){
	return str.slice(0,3);
}

$js.evalExpression('/demos/scripting/js/jstest.js','sliceMe("testme")')
© 2017 dotCMS Inc. All rights reserved.