Google Releases JavaScript to Dart Translation Guide

By Kshitij Sobti | Published on 03 Feb 2012
Google Releases JavaScript to Dart Translation Guide

Want to modernise your banking loan application?

Build an application that analyses credit risk with #IBMCloud Pak for Data on #RedHat #OpenShift

Click here to know more


Google hopes to make Dart one of the official languages of the web; but before that is feasible it will need some fluent “speakers” first.

Dart is similar to JavaScript, so someone coming from the JavaScript world should not have too much trouble understanding it. Also, Dart in most can be used with a syntax similar to JavaScript; however this would not be taking advantage of the new features Dart brings. This is where Google’s JavaScript to Dart Synonym app comes in.

The JavaScript to Dart Synonym app compare common programming idioms in JavaScript and Dart, so people can can a quick reference for the best way to accomplish something in Dart if they know how to do it in JavaScript.

For example, in Dart typing is optional, so while you can declare a variable in the JavaScript way with var stringVariable = ""; it is better if you do the more descriptive String stringVariable = ""; instead. Also, since Dart supports string interpolation, so the following JavaScript example:

var name = 'Aaron';
var greeting = 'My name is ' name '.';

Can instead be written as:

String name = 'Aaron';
String greeting = 'My name is $name.';

The JavaScript to Dart Synonym app has dozens of such examples, including the ones above, that should help anyone transition from JavaScript to Dart.

For those who are looking for a JavaScript alternative, but aren’t satisfied by Dart, there are always other options.

Kshitij Sobti

Digit caters to the largest community of tech buyers, users and enthusiasts in India. The all new Digit in continues the legacy of as one of the largest portals in India committed to technology users and buyers. Digit is also one of the most trusted names when it comes to technology reviews and buying advice and is home to the Digit Test Lab, India's most proficient center for testing and reviewing technology products.

We are about leadership-the 9.9 kind! Building a leading media company out of India.And,grooming new leaders for this promising industry. Protection Status