Learn R Programming

js (version 1.2.1)

js_eval: Evaluate JavaScript

Description

Evaluate a piece of JavaScript code in a disposable context.

Usage

js_eval(text)

Arguments

text

JavaScript code

Examples

Run this code
# Stateless evaluation
js_eval("(function() {return 'foo'})()")

# Use V8 for stateful evaluation
ct <- V8::new_context()
ct$eval("var foo = 123")
ct$get("foo")

Run the code above in your browser using DataLab