JavaScript Posts

6 posts in this category

Partial update an object in IndexedDB
Let’s say, you have the object store called characters as the following table: To update a record, we can use IDBObjectStore.put() method, but this will update the value object as a whole. In case you…
JavaScript
Moving to IndexedDB
LocalStorage is a popular solution to persists data (locally) across sessions for web applications, but there are some limitations, for example: It is limited to 10MB on most browsers. On Safari, it’s…
JavaScript
Beware the delete
Unlike C/C++, the delete operator in JavaScript has nothing to do with memory deallocation. What it actually does is remove a property from its parent object. If there is no more reference to that…
JavaScript
Named imports and dead code elimination
One thing about JavaScript that is sometimes confusing: The named imports. When there is a big module that exports a lot of things, we usually think that we can use named import to get just what we…
JavaScript
Non-English Variables
In JavaScript, you can use any ASCII characters as variable or function names, even non-English words or some special symbols: But sadly you cannot use emojis: Apparently, this is not only possible in…
JavaScript
Console Assert Command
The built-in console comes with the console.assert method, which is pretty useful to write some tests in your code. This method has the syntax of: When the assertion expression returns false, the…
JavaScript