how to cast to javascript executor

JavaScript
JavascriptExecutor js = (JavascriptExecutor) driver;  
js.executeScript(Script,Arguments);
Source

Also in JavaScript: