Basically they are categorized into 3 types, Regular Expressions provided group of patterns in order to match characters. Uses a regular expression or a fixed string to break a string into an array of substrings. It returns the index of the match, or -1 if the search fails.Įxecutes a search for a match in a string, and replaces the matched substring with a replacement substring.Įxecutes a search for all matches in a string, and replaces the matched substrings with a replacement substring. Returns an iterator containing all of the matches, including capturing groups. Returns an array containing all of the matches, including capturing groups, or null if no match is found. ![]() It returns an array of information or null on a mismatch. log ( res2 ) // null MethodĮxecutes a search for a match in a string. It simply collects all properties and wraps them inside a container. It will overwrite the identical properties inside two objects and replace the former with the latter. You can not use the strict mode inside function containing the rest operator. You may or may not use the strict mode inside the function containing the spread operator. It collects the data in the developer's desired format. It expands an Array in form of elements, while in key-value pairs in the case of Objects. Rest Syntax is just the opposite of spread syntax it collects the data and stores that data in a variable which we can use further in our code. Spread operator as its name suggests it spreads or expands the content of the given element. ![]() But the spread syntax expands iterables into individual elements. ![]() The main difference between rest and spread is that the rest operator puts the rest of some specific user-supplied values into a JavaScript array. value = 90 // Declaring global variable by window object function setValue ( )
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |