JavaScript in Visual Studio


For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

JavaScript is a first-class language in Visual Studio. You can use most or all of the standard editing aids (code snippets, IntelliSense, and so on) when you write JavaScript code in the Visual Studio IDE. You can write JavaScript code for many application types and services.

For the JavaScript language reference documentation, see JavaScript.

Specific versions of Visual Studio, or specific Visual Studio extensions, may be required to develop particular application types and services using HTML and JavaScript. The following list has links to more information.

The JavaScript editor in Visual Studio provides IntelliSense support. For more info, see JavaScript IntelliSense.

New features for JavaScript are listed in the following table.

ClassesNew syntax supports declaration of classes.
PromisesPromises allow easier and cleaner asynchronous coding. Promise constructors are supported, along with the all and race utility methods.
IteratorsNow you can iterate over iterable objects (including arrays, array-like objects, and iterators), invoking a custom iteration hook with statements to be executed for the value of each distinct property. For more information, see Iterators and Generators. Note: Generators are not yet supported.
Arrow functionsThe arrow function (=>) provides shorthand syntax for the function keyword which features a lexical this binding.
New methods for built-in objectsThe Array Object, Math Object, Number Object, Object Object, and String Object built-in objects include many new utility functions and properties for manipulating and inspecting data.
Object literal enhancementsObjects now support computed properties, concise method definitions, and shorthand syntax for properties whose value is initialized to a same-named variable. For more information, see Creating Objects.
ProxiesProxies enable custom behavior for objects.
Rest parametersRest parameters allow you to turn consecutive arguments in a function call to an array. For more information, see Functions.
Spread operatorThe spread operator () expands iterable expressions into individual arguments. For example, a.b(…array) is approximately the same as a.b.apply(a, array).
SymbolsSymbol objects allow properties to be added to existing objects with no possibility of interference with the existing object properties, with no unintended visibility, and with no other uncoordinated additions by other code.
Template stringsTemplate strings are string literals that allow for expressions to be evaluated and concatenated with the string literal.
Unicode enhancementsImprovements have been made to Unicode support. For example, a new escape sequence format supports astral code points (code points with more than four hexadecimal digits). For more information, see Special Characters.
WeakSetA WeakSet is a collection of objects that will be garbage collected if they are not referenced anywhere else.