Core JavaScript
- JavaScript: forEach loop does not work in promise or async function
The implementation of forEach loop is not compatible with promise and async functions. Use a for loop to work around this limitation.
- JavaScript: Get ASCII value of character, convert ASCII to character
How to get the ASCII value of a character To get the ASCII value of a character, use the charCodeAt instance method of the String JavaScript object. Example:
- JavaScript: Get object size
How to get the size of an object in JavaScript Arrays in JavaScript have a length property that gives you the number of items in an array. Objects on the other hand, don't have a length or size prope...
- JavaScript: get the number of properties in an object without looping
How to get the number of properties in a JavaScript object without looping Unlike arrays, JavaScript objects do not a have a length property which gives you the number of properties / items in an obj...
- JavaScript: Object as object key
Can you use objects as Object keys in JavaScript? The short answer is "no". All JavaScript object keys are strings. Even if you pass an object as a key, the object's toString() will be called on it, ...
- JavaScript: substring() vs substr()
substring() returns the characters of a string from a starting index to an end index, substr() on the other hand, returns an n number of characters from a starting index.
- Truncating an Array in JavaScript
How do you truncate an array in JavaScript? There are two ways of truncating an array in JavaScript. One takes advantage of the fact that the length property of the Array object is writable, another ...