Here you can find the source of booleanValue(String name, Scriptable scope)
Parameter | Description |
---|---|
name | the JavaScript variable |
scope | the JavaScript scope to read from |
static boolean booleanValue(String name, Scriptable scope)
//package com.java2s; //License from project: Open Source License import org.mozilla.javascript.Context; import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.UniqueTag; public class Main { /**//w w w . ja v a 2 s. com * Return the boolean value of a JavaScript variable. If the variable is undefined, <i>false</i> is returned. * @param name the JavaScript variable * @param scope the JavaScript scope to read from * @return the value of <i>name</i> */ static boolean booleanValue(String name, Scriptable scope) { Object val = scope.get(name, scope); if (val == UniqueTag.NOT_FOUND) { return false; } else { return Context.toBoolean(val); } } }