Examples for 'htmlwidgets::JS'


Mark character strings as literal JavaScript code

Aliases: JS

Keywords:

### ** Examples

library(htmlwidgets)
JS('1 + 1')
[1] "1 + 1"
attr(,"class")
[1] "JS_EVAL"
list(x = JS('function(foo) {return foo;}'), y = 1:10)
$x
[1] "function(foo) {return foo;}"
attr(,"class")
[1] "JS_EVAL"

$y
 [1]  1  2  3  4  5  6  7  8  9 10
JS('function(x) {', 'return x + 1;', '}')
[1] "function(x) {\nreturn x + 1;\n}"
attr(,"class")
[1] "JS_EVAL"

[Package htmlwidgets version 1.5.4 Index]