JavaScript Symbol iterator Property Last Updated : 19 May, 2023 Comments Improve Suggest changes Like Article Like Report It is an object of Iterables which is also a kind of generalized arrays. Iterables that make any object easier to use in a for..of the loop. We know that arrays are iterative in nature but other than that, there are also several objects which are used for the iterative purpose. Suppose if any object which is not an array but does possess a group of the list, set, etc then for..of can be used to iterate it. We use for..of loop to represent a range object of any interval. It decides the range in which the for..of the loop will work and iterate the loop. We will use a method Symbol.iterator (an in-built method in JavaScript) to iterate the range object which is mentioned above. The steps in which this method works: Once for..of loop starts it checks the error first, if it is not found then it accesses the method and the object with the method.After that for..of loop will run over the object.To take the next upcoming value, it calls the next() method for that output object.The values returned will be of the form {done: Boolean, value: any}. When done=true is returned then the loop will be considered as the complete one. Syntax: [Symbol.iterator]Features:The range will not have the next() method on its own.When we call to the range[Symbol.iterator](), an iterator is formed and the method next() will generate the value for further iterations. Example: JavaScript let range = { from: 2, to: 7 }; range[Symbol.iterator] = function() { return { now: this.from, end: this.to, next() { if (this.now <= this.end) { return { done: false, value: this.now++ }; } else { return { done: true }; } } }; }; for (let i of range) { console.log(i); } Output: 2 3 4 5 6 7 Supported Browsers: The browsers supported by Symbol iterator property are listed below: Google Chrome 51Firefox 50Edge 15OperaApple Safari We have a complete list of Javascript symbols' properties and methods, to check those please go through the Javascript Symbol Complete Reference article. Comment More infoAdvertise with us Next Article JavaScript Symbol match Property K krishnakripa Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Properties JavaScript-Symbol Similar Reads JavaScript Symbol() Constructor The Symbol() constructor is used to create a new symbol. The Symbol() constructor returns a value of the type of symbol with static properties. Every time we call the constructor a unique symbol is created. A Symbol constructor is a primitive data type having no object or no methods which are genera 2 min read JavaScript Symbol constructor Property JavaScript Symbol constructor property is used to return the Symbol constructor function for the object. The function returned by this property is just the reference, not the actual WeakSet. It is an object property of JavaScript and can be used with Strings, Numbers, etc. Syntax: symbol.constructor 1 min read JavaScript Symbol asyncIterator Property JavaScript Symbol asyncIterator property is used to set an object as an async iterable. Iterable properties of this object can be iterated over using a for await...of loop. An async iterable object is any object that returns a function that produces an AsyncIterator for its Symbol.asyncIterator prop 2 min read JavaScript Symbol description Property JavaScript symbol description is an inbuilt property in JavaScript that is used to return the optional description of the specified symbol objects. Syntax: Here "A" is the specified symbol object which might be Symbol('anyValues'), Symbol.iterator, Symbol.for('anyValues') etc. A.description;Paramete 1 min read JavaScript Symbol hasInstance Property JavaScript Symbol hasInstance is used to determine if a given constructor object recognizes the object as its instance. Syntax: [Symbol.hasInstance](Object) Parameters: It accepts a parameter "object". Return value: This returns true if the value is in the chain of the object otherwise false.JavaScr 1 min read JavaScript Symbol isConcatSpreadable Property JavaScript Symbol.isConcatSpreadable is a well-known symbol used to configure if a given object should be flattened to its array elements while using the Array.prototype.concat() method. Syntax: Array[Symbol.isConcatSpreadable]Here Array is the array object which is to be flattened to its array elem 2 min read JavaScript Symbol iterator Property It is an object of Iterables which is also a kind of generalized arrays. Iterables that make any object easier to use in a for..of the loop. We know that arrays are iterative in nature but other than that, there are also several objects which are used for the iterative purpose. Suppose if any object 2 min read JavaScript Symbol match Property JavaScript Symbol match property is used to identify the matching of a regular expression against a string and this function is called using String match() method. Syntax: regexp[Symbol.match] = false; Parameters: It does not accept any parameters. Return value: It will return the Boolean value for 1 min read JavaScript Symbol matchAll Property JavaScript Symbol matchAll property used to return the regular expression that matches against a string. JavaScript String matchAll() method calls this property. Syntax: regExp[Symbol.matchAll](str); Parameter: It takes a string used to find matches of the regular expression against the string. Retu 2 min read JavaScript Symbol replace Property JavaScript Symbol replace the property is used to determine the method that replaces the matched substring of a string. This function is called by the String replace() method. Syntax: [Symbol.replace](string) Parameters: It accepts single parameter "String". Return value: It will return a new string 2 min read Like