Set the font variant with CSS

Ankitha Reddy
Updated on 15-Mar-2026 23:18:59

146 Views

The CSS font-variant property controls how text is displayed, allowing you to transform lowercase letters into small capital letters or display text normally. Syntax font-variant: normal | small-caps | inherit; Parameters Value Description normal Default value. Text displays normally small-caps Converts lowercase letters to small capital letters inherit Inherits the font-variant from parent element Example: Using small-caps .small-caps { ... Read More

How to slice an array with wrapping in JavaScript

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

421 Views

Let's say, we are required to write an array method that overwrites the default Array.prototype.slice(). Usually the Array.prototype.slice() method takes in two arguments the start index and the end index, and returns a subarray of the original array from index start to end-1. What we wish to do is make this slice() function so it returns a subarray from index start to end and not end-1. We iterate over the array using a for loop which is faster than many array methods. Then return the required subarray, lastly we overwrite the Array.prototype.slice() with the method we just wrote. ... Read More

How to use the map function to see if a time is in a certain time frame with JavaScript?

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

297 Views

In JavaScript, you can use the map() function to iterate through schedule records and check if the current time falls within a specific time frame. This is useful for determining which activity or subject you should be working on at any given moment. Example Data Structure Let's start with a simple schedule containing subject names and their study times: const scheduleDetails = [ { subjectName: 'JavaScript', studyTime: '5 PM - 11 PM' }, { subjectName: 'MySQL', studyTime: '12 AM - 4 PM' } ] Using map() ... Read More

How to invoke a JavaScript Function with 'new' Function Constructor?

Shubham Vora
Updated on 15-Mar-2026 23:18:59

903 Views

In this tutorial, we will learn how to invoke a JavaScript Function with the 'new' Function Constructor. Functions are a set of reusable codes that perform a specific task and may return a value. In JavaScript, functions are defined by the keyword function. A function may not have any parameters and may also not have any return statement. In JavaScript, we also have functions with no function names, called anonymous functions. Using the 'new' Function Constructor The Function constructor makes a new Function object. By using the constructor, we can create a function dynamically. It takes parameters, ... Read More

How to get the value of the usemap attribute of an image with JavaScript?

Sravani S
Updated on 15-Mar-2026 23:18:59

287 Views

To get the value of the usemap attribute of an image, use the useMap property. This property returns the value of the usemap attribute, which specifies which image map to use with the image. Syntax let value = imageElement.useMap; Example ... Read More

Bootstrap Form TextArea

Lakshmi Srinivas
Updated on 15-Mar-2026 23:18:59

3K+ Views

Bootstrap provides excellent styling for textarea elements in forms. The element is used when you need multiple lines of input from users, such as comments, descriptions, or detailed information. Basic Textarea Syntax To create a Bootstrap-styled textarea, use the form-control class: Label Text Complete Example Bootstrap Forms ... Read More

What are the characteristics of JavaScript 'Strict Mode'?

Arnab Chakraborty
Updated on 15-Mar-2026 23:18:59

490 Views

JavaScript strict mode enables stricter parsing and error handling in your JavaScript code. By default, JavaScript runs in "sloppy mode" which allows certain questionable practices. Strict mode helps you write more secure and optimized code by catching common coding mistakes. Syntax Strict mode can be enabled in different scopes using the "use strict" directive: Global Strict Mode "use strict"; // All code in this script runs in strict mode Function Strict Mode function myFunction() { "use strict"; // Only this function runs in strict mode ... Read More

Prefix sums (Creating an array with increasing sum) with Recursion in JavaScript

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

477 Views

Consider the following array of numbers: const arr = [10, 5, 6, 12, 7, 1]; The sum of its consecutive elements taking one less element in every go will be: [10, 5, 6, 12, 7, 1] = 10 + 5 + 6 + 12 + 7 + 1 = 41; [5, 6, 12, 7, 1] = 5 + 6 + 12 + 7 + 1 = 31; [6, 12, 7, 1] = 6 + 12 + 7 + 1 = 26; [12, 7, 1] = 12 + 7 + 1 = 20; [7, 1] ... Read More

JavaScript how to get an alert to appear when I click on a button in a class?

Shriansh Kumar
Updated on 15-Mar-2026 23:18:59

2K+ Views

An alert in JavaScript is a dialog box that displays important information or warnings to the user. It contains a message with an OK button that dismisses the dialog when clicked. Clicking a button triggers an event handler that invokes a function instructing the browser to display the alert dialog. In this article, we will explore different ways to show an alert when a user clicks on a button in a class. For example, click on the button below to see an alert: .alerttoappear { margin: auto; width: ... Read More

Prime numbers in a range - JavaScript

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

1K+ Views

We are required to write a JavaScript function that takes in two numbers, say, a and b and returns the total number of prime numbers between a and b (including a and b, if they are prime). For example − If a = 2, and b = 21, the prime numbers between them are 2, 3, 5, 7, 11, 13, 17, 19 And their count is 8. Our function should return 8. Understanding Prime Numbers A prime number is a natural number greater than 1 that has no positive divisors other than 1 ... Read More

Advertisements