Browser storage: Local Storage, Session Storage, Cookie, IndexedDB and WebSQL

Local Storage Key-value storage that stores values as strings Does not have expiration date (persistent storage) unless explicitly clear the browser using settings or Javascript Up to 10MB data can be stored Follow the same-origin policy, which means the Protocol(Http/Https), port and the host are the same. Only scripts of the same origin can access… Continue reading Browser storage: Local Storage, Session Storage, Cookie, IndexedDB and WebSQL

Enum in JS

Enum is a data type in programming languages that defines a set of constant values. It is a distinct value type (i.e.) all values in an enum are unique. Using an enum makes the code readable and maintainable. Some examples of enum are all weekdays from Monday to Sunday, T-shirt sizes like S, M, L, XL, etc. The pseudocode of an enum… Continue reading Enum in JS

Install and use PrimeVue Library in Vue project.

PrimeVue is a rich set of open source UI components for Vue. Run the following command in your command line. Add provided code in main.js To import components of Primevue to use it, add provided code in main.js. Take Button as example. Use the component in Vue file as provided.

Creating a Vue Application and run it.

Install latest version of Node.js. Run the following command in your command line. Then type Project name and Package name Select Yes/No Type following in command line. The dev server will be started. Paste ‘http://localhost:5174/’ on browser. Vue app is created.

Swal – Confirmation

The “SweetAlert” library, often referred to as “swal,” to create a custom and interactive alert modal with customized buttons, text, and icons. The modal is typically used for user confirmation or information display in a more visually appealing way than the browser’s default alert. .then((willDelete) => { … }): This is a callback that is… Continue reading Swal – Confirmation

Clear Selection Dropdown

To make a selection from the dropdown to from select field, jQuery provides and option for this This part of the code is a jQuery method that sets the selectedIndex property of the selected <select> element to 0. The selectedIndex property determines which option is selected in the dropdown list. By setting it to 0,… Continue reading Clear Selection Dropdown

Published
Categorized as JavaScript

Nested Object Loop

IF you want to find the value for some specific key which is a nested object, like shown below, if we want to get “custcol_ag_bankname” object value from this we can use the code shown below

Published
Categorized as JavaScript

4 JavaScript Features in ES2023 That You Should Know

1. Array.findLast() and Array.findLastIndex() First up is the “Array find from last” feature, proposed by Wenlu Wang. It introduces two new methods for Array and TypedArray objects: findLast() and findLastIndex(). These methods function similarly to their existing counterparts (find() and findIndex()), but, as the names suggest, they start searching from the end of the array rather than the beginning. This… Continue reading 4 JavaScript Features in ES2023 That You Should Know

8 JavaScript Features in ES2019 That You Should Know

1. Array.prototype.{flat,flatMap} Array.prototype.flat() proposed to flatten arrays recursively up to the specified depth and returns a new array. Syntax: Array.prototype.flat(depth)depth — Default value 1, Use Infinity to flatten all nested arrays. Array.prototype.flatMap() maps each element using a mapping function and flattens the result into a new array. It’s identical to the map operation followed by a flat of depth 1. Syntax: Array.prototype.flatMap(callback)callback: function that produces an element of the new Array.… Continue reading 8 JavaScript Features in ES2019 That You Should Know