Writing Scripts in Nashorn

In this chapter, you will learn:

  • How to write scripts in Nashorn
  • The difference between running the script in strict mode and nonstrict mode
  • How to declare variables and write comments
  • Primitive and object data types, and how to convert values of one data type to another data type
  • Operators, statements, and creating and invoking functions in Nashorn
  • Different ways of creating and using objects
  • Variable scoping and hoisting
  • About built-in global objects and functions

Nashorn is a runtime implementation of the ECMAScript 5.1 specification on the JVM. ECMAScript defines its own syntax and constructs for declaring ...

Get Scripting in Java: Integrating with Groovy and JavaScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.