= JavaScript Language
:doctitle: JavaScript
:shortname: js
:artifactid: camel-javascript
:description: Evaluates a JavaScript expression.
:since: 3.20
:supportlevel: Stable
:tabs-sync-option:
//Manually maintained attributes
:camel-spring-boot-name: javascript

*Since Camel {since}*

Camel allows https://www.graalvm.org/javascript/[JavaScript] to be
used as an xref:manual::expression.adoc[Expression] or xref:manual::predicate.adoc[Predicate]
in Camel routes.

For example, you can use JavaScript in a xref:manual::predicate.adoc[Predicate]
with the xref:eips:choice-eip.adoc[Content-Based Router] EIP.

== JavaScript Options


// language options: START
include::partial$language-options.adoc[]
// language options: END




== Variables

[width="100%",cols="10%,10%,80%",options="header",]
|=======================================================================
|Variable |Type |Description
|*this* |Exchange |the Exchange is the root object
|context |CamelContext |the CamelContext
|exchange |Exchange |the Exchange
|exchangeId |String |the exchange id
|message |Message |the message
|body |Message |the message body
|headers |Map |the message headers
|properties |Map |the exchange properties
|=======================================================================


== Dependencies

To use JavaScript in your Camel routes, you need to add the dependency on
*camel-javascript*, which implements the JavaScript language (JavaScript with GraalVM).

If you use Maven, you could add the following to your pom.xml,
substituting the version number for the latest & greatest release.

[source,xml]
-------------------------------------
<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-javascript</artifactId>
  <version>x.x.x</version>
</dependency>
-------------------------------------


include::spring-boot:partial$starter.adoc[]
