Teachnique
      CourseRoadmaps
      Login

      OverviewPlacementSyntaxHello WorldConsole.log()CommentsVariableslet StatementConstantsData TypesType ConversionsStrict ModeReserved Keywords

      OperatorsArithmetic OperatorsComparison OperatorsLogical OperatorsBitwise OperatorsAssignment OperatorsConditional Operatorstypeof OperatorNullish Coalescing OperatorDelete OperatorComma OperatorGrouping OperatorYield OperatorSpread OperatorExponentiation OperatorOperator Precedence

      If...ElseWhile LoopsFor LoopFor...in LoopFor...of LoopLoop ControlBreak StatementContinue StatementSwitch CaseUser Defined Iterators

      FunctionsFunction ExpressionsFunction ParametersDefault ParametersFunction() ConstructorFunction HoistingArrow FunctionsFunction InvocationFunction call() MethodFunction apply() MethodFunction bind() MethodClosuresVariable ScopeGlobal VariablesSmart Function Parameters

      NumberBooleanStringsArraysDateMathRegExpSymbolSetsWeakSetMapsWeakMapIterablesReflectTypedArrayTempate LiteralsTagged Templates

      Objects OverviewClassesObject PropertiesObject MethodsStatic MethodsDisplay ObjectsObject AccessorsObject ConstructorsNative PrototypesES5 Object MethodsEncapsulationInheritanceAbstractionPolymorphismDestructuring AssignmentObject DestructuringArray DestructuringNested DestructuringOptional ChainingGlobal ObjectMixinsProxies

      HistoryVersionsES5ES6ECMAScript 2016ECMAScript 2017ECMAScript 2018ECMAScript 2019ECMAScript 2020ECMAScript 2021ECMAScript 2022

      CookiesCookie AttributesDeleting Cookies

      Browser Object ModelWindow ObjectDocument ObjectScreen ObjectHistory ObjectNavigator ObjectLocation ObjectConsole Object

      Web APIHistory APIStorage APIForms APIWorker APIFetch APIGeolocation API

      EventsDOM Events

      Feedback

      Submit request if you have any questions.

      Course
      ECMAScript 2016

      JavaScript Tutorial

      This JavaScript tutorial is crafted for beginners to introduce them to the basics and advanced concepts of JavaScript. By the end of this guide, you'll reach a proficiency level that sets the stage for further growth. Aimed at empowering you to progress towards becoming a world-class software developer, this tutorial paves the way for a successful career in web development and beyond.

      ECMAScript 2016

      The ECMAScript 2016 version of JavaScript was released in 2016. Previously the old versions of JavaScript are named by numbers for example ES5 and ES6. Since 2016 the versions are named by the year they are released for example ECMAScript 2016, ECMAScript 17, etc. Lets discuss the featues added in ECMAScript 2016.

      New Features Added in ECMAScript 2016

      Here are the new methods, features, etc., added to the ECMAScript 2016 version of JavaScript.
      • Array includes() method
      • Exponentiation Operator (**)
      • Exponentiation Assignment Operator (**=)
      Here, we have explained each feature in detail.

      JavaScript Array includes() Method

      The JavaScript array includes() methods is used to check whether the array contains a particular element.

      Syntax

      The syntax of Array includes() method in JavaScript is as follows
      
      arr.include(searchElement, fromIndex);
      Here arr is the original array, the searchElement is to be search from. The fromIndex is an optional argument if passed, the searching will start from the fromIndex index.

      Example

      In the below code, we use the array includes() method to check whether the watches array contains the 'Noise' brand.
      <html>
      <body>
      <div id = "output">Does watches array include Noise?</div>
      <script>
      const watches = ["Titan", "Rolex", "Noise", "Fastrack", "Casio"];
      document.getElementById("output").innerHTML += watches.includes("Noise");
      </script>
      </body>
      </html>

      Output

      Does watches array include Noise? true

      Example

      In the below code, we use the array includes() method to check whether the subjects array contains the 'Python' subject searching from index 1.
      <html>
      <body>
      <div id = "output">Does subjects array include Python fromIndex 1? </div>
      <script>
      const subjects = ["Java", "JavaScript", "Python", "C", "C++"];
      document.getElementById("output").innerHTML += subjects.includes("Python", 1);
      </script>
      </body>
      </html>

      Output

      Does subjects array include Python fromIndex 1? true

      JavaScript Exponentiation Operator

      The JavaScript exponentiation operator is used to find the power of the first operand raised to the second operand.

      Syntax

      The syntax of expponentiation operator is as follow
      x ** y;
      It returns the result of raising the first operand (x) to the power of the second operand (y).

      Example

      In the below code, we find the 22 using the exponentiation operator and store the resultant value in the 'res' variable.
      <html>
      <body>
      <div id = "output">The resultant value for 2 ** 2 is: </div>
      <script>
      document.getElementById("output").innerHTML += 2 ** 2;
      </script>
      </body>
      </html>

      Output

      The resultant value for 2 ** 2 is: 4

      Exponentiation Assignment Operator

      The JavaScript exponentiation assignment operator raises the power of the first operand by the second operand and assigns it to the first operand.

      Syntax

      The syntax of exponentiation assignment operator is as follows
      x **= y;
      It assigns the result of raising the first operand (x) to the power of the second operand (y) to x.

      Example

      In the below code, we find the 102 and assign the resultant value to the 'num' variable using the exponentiation assignment operator.
      <html>
      <body>
      <div id = "output">The resultant value for 10 ** 2 is: </div>
      <script>
      let num = 10;
      num **= 2; // exponentiation assignment operation
      document.getElementById("output").innerHTML += num;
      </script>
      </body>
      </html>

      Output

      The resultant value for 10 ** 2 is: 100

      ECMAScript 2016 Browser Support

      Most modern browsers support the ECMAScript 2016 version of JavaScript
      Chrome
      Firefox
      Microsoft Edge
      Opera
      Safari
      Firefox Android
      Yes
      Yes
      Yes
      Yes
      Yes
      Yes