What is pica? How to set the font size in CSS using pica?

Samual Sam
Updated on 15-Mar-2026 23:18:59

952 Views

A pica is a CSS unit of measurement primarily used in print design. One pica equals 12 points, and there are 6 picas per inch (1pc = 12pt = 1/6 inch). The pica unit is specified using "pc" in CSS. Understanding Pica Units Picas are absolute units like pixels, but they're based on traditional typography measurements: 1 pica = 12 points 6 picas = 1 inch 1pc ≈ 16 pixels (at 96 DPI) Syntax font-size: value pc; /* Examples */ font-size: 1pc; /* 12 points */ font-size: 2.5pc; ... Read More

Passing unknown number of arguments to a function in Javascript

Manisha Patil
Updated on 15-Mar-2026 23:18:59

3K+ Views

JavaScript allows functions to accept any number of arguments, even if the function definition specifies a different number of parameters. This flexibility is useful when creating functions that need to handle variable amounts of data. When defining a function, the variables listed in parentheses are called parameters. When calling the function, the actual values passed are called arguments. JavaScript provides two main approaches to handle unknown numbers of arguments. Basic Example: Fixed Parameters Functions with fixed parameters will only use the specified number of arguments, ignoring any extras: Passing ... Read More

JavaScript program to access browsing history

AmitDiwan
Updated on 15-Mar-2026 23:18:59

932 Views

In this article, we will learn to access browsing history using JavaScript. In web development, accessing a user's browsing history can improve user experience and provide personalized content. However, due to privacy concerns and security reasons, modern web browsers limit the amount of browsing history accessible via JavaScript. What is Browsing History? Browsing history refers to the list of web pages that a user has visited over a while. Browsers typically store this data locally, allowing users to navigate back and forth through the pages they've visited. The window.history Object In JavaScript, the window.history object allows ... Read More

Sort array based on presence of fields in objects JavaScript

AmitDiwan
Updated on 15-Mar-2026 23:18:59

338 Views

In JavaScript, you can sort arrays of objects based on the presence of specific fields using a custom comparator function. This technique is useful when you need to prioritize objects with complete information. Problem Statement Let's say we have an array of people objects where some have both firstName and lastName, some have only one of these properties, and others have neither: const people = [{ firstName: 'Ram', id: 301 }, { firstName: 'Shyam', lastName: 'Singh', ... Read More

Group values in array by two properties JavaScript

AmitDiwan
Updated on 15-Mar-2026 23:18:59

1K+ Views

We have an array of objects like this: const arr = [ { value: 12, gap: 1 }, { value: 13, gap: 1 }, { value: 14, gap: 1 }, { value: 15, gap: 1 }, { value: 19, gap: 2 }, { value: 21, gap: 1 }, { value: 22, gap: 1 }, { value: 23, gap: 1 }, { value: ... Read More

Program to test the equality of two arrays - JavaScript

AmitDiwan
Updated on 15-Mar-2026 23:18:59

205 Views

We are required to write a JavaScript function that takes in two arrays of literals and checks the corresponding elements of the array and it should return true if all the corresponding elements of the array are equal otherwise it should return false. Let's write the code for this function − Example Following is the code − const arr1 = [1, 4, 5, 3, 5, 6]; const arr2 = [1, 4, 5, 2, 5, 6]; const areEqual = (first, second) => { if(first.length !== second.length){ ... Read More

How can I delete all cookies with JavaScript?

Vrundesha Joshi
Updated on 15-Mar-2026 23:18:59

2K+ Views

To delete all cookies with JavaScript, you need to iterate through existing cookies and set their expiration date to the past. JavaScript doesn't provide a direct method to clear all cookies at once, so we must delete them individually. How Cookie Deletion Works Cookies are deleted by setting their expires attribute to a past date. When the browser sees an expired cookie, it automatically removes it from storage. Method 1: Basic Cookie Deletion This approach splits the cookie string and deletes each cookie by name: function deleteAllCookies() { var cookies ... Read More

Set the background color of an element with CSS

karthikeya Boyini
Updated on 15-Mar-2026 23:18:59

470 Views

To set the background color of an element, use the background-color property in CSS. This property accepts color values in various formats including color names, hex codes, RGB, and HSL values. Syntax background-color: color-value; Example Here's how to set background colors using different methods: Background Color Example This text has a blue background color. ... Read More

How to compare two string arrays, case insensitive and independent about ordering JavaScript, ES6

AmitDiwan
Updated on 15-Mar-2026 23:18:59

876 Views

We need to write a function that compares two strings to check if they contain the same characters, ignoring case and order. This is useful for validating anagrams or checking string equivalence. For example: const first = 'Aavsg'; const second = 'VSAAg'; isEqual(first, second); // true Using Array Sort Method This method converts strings to arrays, sorts the characters, and compares the results. We extend the String prototype to add a sort method. const first = 'Aavsg'; const second = 'VSAAg'; const stringSort = function(){ return this.split("").sort().join(""); ... Read More

Check whether a value exists in JSON object?

AmitDiwan
Updated on 15-Mar-2026 23:18:59

5K+ Views

In JavaScript, you can check whether a value exists in a JSON object (or array of objects) using several approaches. Let's explore different methods to find values efficiently. Consider the following JSON object structure: var apiJSONObject = [ {subjectName: "MySQL"}, {subjectName: "Java"}, {subjectName: "JavaScript"}, {subjectName: "MongoDB"} ] Using for Loop (Traditional Approach) The basic approach uses a for loop to iterate through the array and check each object: var apiJSONObject = [ {subjectName: "MySQL"}, ... Read More

Advertisements