evalScripts

evalScripts() -> [returnedValue...]

Evaluates the content of any script block present in the string. Returns an array containing the value returned by each script.

Only script tags containing inline code are supported; script tags referencing external files are ignored (and leave an undefined in the results array).

Examples


'lorem... <script>2 + 2</script>'.evalScripts();
// -> [4]

'<script>2 + 2</script><script>alert("hello world!")</script>'.evalScripts();
// -> [4, undefined] (and displays 'hello world!' in the alert dialog)