The Map object holds key-value pairs like a standard object. There are a few significant differences between Map and a regular key-value pair object. These are: Objects: Keys must be obtained and used to iterate over. Map: This is iterable, meaning we can directly iterate. Objects: The key can only be an integer, string, or symbol. Map: Key field can be of any data-type including objects and functions. Objects: Retrieving size is a manual process. Map: The size property hold this info. Objects: Iterating will not always return keys in MORE q
By DarkMG73 on April 17th, 2020 inSet Data Structure in JavaScript
Prototypes in JavaScript
Constructors
Classes in JavaScript
Classes are blueprints to create Objects. When a class is set up with all of the properties and functions for the object, this class can then be used to create any number of identical Objects. Important notes on classes : It is common to capitalize the first letter of the class name to make clear it is a class and MORE q
By DarkMG73 on April 12th, 2020 inLiterals in JavaScript
Literal in programming: In computer science, a literal is a notation for representing a fixed value in source code. In JavaScript, it would be closed by { } or [ ]. Object Literal: This would be closed by { } and have a key(String or Number) and a value (any type) separated by a colon with each entry MORE q
By DarkMG73 on April 12th, 2020 inArrays in Javascript
An array is a way to organze and store data. Basic Rules for Arrays Arrays will always be enclosed in [ ] and each item within the array is numbered (an index). This numbering starts at 0 and can hold as many items as needed. Any data type can be stored (string, number, boolean, Objects (including functions and other arrays), etc. Arrays can be a mix of numbers and strings, although this is generally not a good idea and there can be a little bit of a performamce hit by doing so. Arrays carry properties (information about MORE q
By DarkMG73 on April 11th, 2020 inVariables in JavaScript
Variables in JavaScript are basically names or references to storage locations in memory. A variable name needs to start with a letter (lowercase is most common, though uppercase can be used), an underscore( _ ) or dollar sign( $ ). Variables will be either local, which means they are only accessible within a function or brackets, or global, which means they are accessible anywhere. Variable Declarations var - scoped globally. const - block scoped by curly brackets {} and unchangeable. let - block scoped and changeable. The last option is MORE q
By DarkMG73 on April 10th, 2020 inObjects in JavaScript
Objects are the center of JS programming. Methods and Properties can be attached. Objects are lists or collections of properties For each property, Objects always have a name that is a STRING and a value that can be a STRING, NUMBER or FUNCTION Under the hood: When creating an object or adding a property, the JS engine invokes the [put] method to assign a place in memory. When changing a property, the JS engines invokes the [set] method for changing the MORE q
By DarkMG73 on March 31st, 2020 in