www.scala-js.org
Open in
urlscan Pro
2a06:98c1:3121::a
Public Scan
Submitted URL: http://scala-js.org/
Effective URL: http://www.scala-js.org/
Submission: On May 05 via api from GB — Scanned from GB
Effective URL: http://www.scala-js.org/
Submission: On May 05 via api from GB — Scanned from GB
Form analysis
0 forms found in the DOMText Content
Toggle navigation * DOCUMENTATION * LIBRARIES * COMMUNITY * NEWS * SCALA.JS 1.10.0 A SAFER WAY TO BUILD ROBUST FRONT-END WEB APPLICATIONS! Learn Scala.js Try Scala.js in the browser CORRECTNESS Strong typing guarantees your code is free of silly mistakes; no more mixing up strings or numbers, forgetting what keys an object has, or worrying about typos in your method names. Scala.js takes care of all this tedious book-keeping for you, letting you focus on the actual, more interesting problem your application is trying to solve. PERFORMANCE Scala.js optimizes your Scala code into highly efficient JavaScript. Incremental compilation guarantees speedy (1-2s) turn-around times when your code changes. The generated JavaScript is both fast and small, starting from 45kB gzipped for a full application. INTEROPERABILITY Scala.js loves JavaScript libraries, including React and AngularJS. You can use any JavaScript library right from your Scala.js code, either in a statically or dynamically typed way. You won't even notice you're crossing a language border! Learn more. EXCELLENT EDITOR SUPPORT With Scala.js, typos and type-errors are immediately caught and shown to you in your editor, without even needing to compile your code. Refactor any field or method with ease, with the confidence that if you mess it up the editor will tell you immediately. Stop flipping back and forth between your editor and MDN, because your editor will display what methods are available, what arguments they take, what they return, and even their documentation, right in-line with your code! GO BEYOND JAVASCRIPT ES6, TODAY * JavaScript/ES5 * ECMAScript 6 * TypeScript HELLO WORLD! JAVASCRIPT console.log("Hello World!"); ECMASCRIPT 6 console.log("Hello World!"); TYPESCRIPT console.log("Hello World!"); SCALA.JS println("Hello World!") CLASSES JAVASCRIPT var Person = function(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; }; Person.prototype.fullName = function() { return this.firstName + " " + this.lastName; }; ECMASCRIPT 6 class Person { constructor(firstName, lastName) { this.firstName = firstName; this.lastName = lastName; } fullName() { return `${this.firstName} ${this.lastName}`; } } TYPESCRIPT class Person { constructor(public firstName: string, public lastName: string) { } fullName() { return `${this.firstName} ${this.lastName}`; } } SCALA.JS class Person(val firstName: String, val lastName: String) { def fullName(): String = s"$firstName $lastName" } FAT ARROW FUNCTIONS JAVASCRIPT var names = persons.map(function(p) { return p.firstName; }); ECMASCRIPT 6 const names = persons.map(p => p.firstName); TYPESCRIPT const names = persons.map(p => p.firstName); SCALA.JS val names = persons.map(p => p.firstName) // or an even shorter version val names = persons.map(_.firstName) COLLECTIONS JAVASCRIPT var personMap = { "10": new Person("Roger", "Moore"), "20": new Person("James", "Bond") }; var names = []; for (var key in personMap) { if (Object.prototype.hasOwnProperty.call(personMap, key)) { if (parseInt(key) > 15) { names.push(key + " = " + personMap[key].firstName); } } } ECMASCRIPT 6 const personMap = new Map([ [10, new Person("Roger", "Moore")], [20, new Person("James", "Bond")] ]); const names = []; for (const [key, person] of personMap) { if (key > 15) { names.push(`${key} = ${person.firstName}`); } } TYPESCRIPT /// <reference path="dts/typescript/lib.es6.d.ts" /> const personMap = new Map<number, Person>([ [10, new Person("Roger", "Moore")], [20, new Person("James", "Bond")] ]); const names = new Array<string>(); for (const [key, person] of personMap) { if (key > 15) { names.push(`${key} = ${person.firstName}`); } } SCALA.JS val personMap = Map( 10 -> new Person("Roger", "Moore"), 20 -> new Person("James", "Bond") ) val names = for { (key, person) <- personMap if key > 15 } yield s"$key = ${person.firstName}" To find out more about what Scala.js looks like for JavaScript developers, check out the detailed comparisons. If you want to try it out yourself, check out the Tutorials! Feature JavaScript ES5 JavaScript ES6 TypeScript Scala.js Interoperability Fully EcmaScript5 compatible No compilation required Use existing JS libraries Language features Classes Modules Support for types Strong type system Extensive standard libraries Optimizing compiler Macros, to extend the language IDE support Catch most errors in IDE Easy and reliable refactoring Reliable code completion LEARN Documentation Tutorial COMMUNITY #scala-js on Discord Stackoverflow Mailing list Twitter GitHub