objectForKeyedSubscript(_:)
Returns the value of the specified JavaScript property in the context’s global object, allowing subscript getter syntax.
Declaration
func objectForKeyedSubscript(_ key: Any!) -> JSValue!Parameters
- key:
The name of a JavaScript property in the context’s global JavaScript object.
Return Value
The JavaScript property named by key, or nil if no such field or function exists.
Discussion
This method first constructs a JSValue object from the key parameter, then uses that value in JavaScript to look up the name of a property in the context’s global object.