Sdílet prostřednictvím


JavaScript in Visual Studio

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

What's New in JavaScript

New features for JavaScript are listed in the following table.

Feature Description
Classes New syntax supports declaration of classes.
Promises Promises allow easier and cleaner asynchronous coding. Promise constructors are supported, along with the all and race utility methods.
Iterators Now 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 functions The arrow function (=>) provides shorthand syntax for the function keyword which features a lexical this binding.
New methods for built-in objects The 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 enhancements Objects 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.
Proxies Proxies enable custom behavior for objects.
Rest parameters Rest parameters allow you to turn consecutive arguments in a function call to an array. For more information, see Functions.
Spread operator The spread operator () expands iterable expressions into individual arguments. For example, a.b(…array) is approximately the same as a.b.apply(a, array).
Symbols Symbol 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 strings Template strings are string literals that allow for expressions to be evaluated and concatenated with the string literal.
Unicode enhancements Improvements 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.
WeakSet A WeakSet is a collection of objects that will be garbage collected if they are not referenced anywhere else.