Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Javascript Articles
Page 45 of 534
Check if string ends with desired character in JavaScript
In the given problem statement we are required to check if the string ends with the desired character with the help of Javascript functionalities. So we will use basic functions and syntax of Javascript to solve the problem. Understanding the problem The problem at hand is to check if a given string is ending with the given specific character in Javascript. For example suppose we have a string as Hello World! and we have to check if the exclamation ‘!’ mark is present at the end of the string or not. So after comparing with the string the ...
Read MoreAverage with the Reduce Method in JavaScript
In the given problem statement, our aim is to get the average of all the items with the help of the reduce method of Javascript. So for doing this task we will create a function and give an array as a parameter. Understanding the problem statement We have given a task to calculate the average value of the given items in the array. And we have to use the reduce method which is a predefined method of Javascript. For example if we have an array as [1, 2, 3, 4, 5], so the average value of the ...
Read MoreAlgorithm to add binary arrays in JavaScript
In this problem statement, our target is to add two binary arrays with the help of Javascript. So we will break down the problem step by step to ensure understanding. What is the Binary array ? A binary array is an array that represents a binary number. In a binary number system we have only two possible digits, 0 and 1. The binary array will have the elements which can only be 0s and 1s. Every item in the array will represent a bit of the binary number. For example we have a binary array [1, ...
Read MoreHow to Convert Characters to ASCII Code using JavaScript?
ASCII, stands for American Standard Code for Information Interchange which is a method used for encoding characters by assigning them to a specific numerical value. The numerical values thus assigned are known as ASCII codes and are extensively utilized in computer systems to represent various characters including letters, numbers, punctuation marks, and special control characters. Example 1: Using charCodeAt() The following code illustrates a program to receive input character from the user using the ‘charCodeAt()’ function and then display the corresponding ASCII code for that character. Syntax string.charCodeAt(index) Algorithm Step 1 :Start with declaring the HTML tag. Step ...
Read MoreHow to hide span element if anchor href attribute is empty using JavaScript?
In modern web development, it's often necessary to dynamically hide or show elements based on certain conditions. One common requirement is to hide a element if the associated (anchor) element has an empty href attribute. This functionality can be particularly useful when working with navigation menus or links that are generated dynamically. In this article, we'll explore how to achieve this behavior using JavaScript. We'll delve into two different approaches: one utilizing JavaScript event listeners, and the other leveraging CSS selectors. By understanding both methods, you'll have the flexibility to choose the one that best suits your project ...
Read MoreHow to hide the table header using JavaScript?
Tables are a common element in web development, used to organize and present data in a structured format. While table headers provide valuable context and help users understand the content within a table, there are situations where hiding the table header becomes necessary. Whether it's to enhance the visual design, improve user experience, or accommodate specific requirements, knowing how to hide the table header using JavaScript can be a useful skill for web developers. In this article, we will explore different methods to hide the table header using JavaScript. We will cover techniques that leverage CSS, manipulate the Document Object ...
Read MoreHow to Highlight the Searched String Result using JavaScript?
Searching for specific content within a large body of text is a common task in web applications. However, simply displaying the search results without any visual indication can make it challenging for users to identify and focus on the relevant information. That's where the need for highlighting the searched string arises. By dynamically highlighting the matching portions of the text, we can improve the user experience and make it easier for users to locate the desired content. In this blog post, we will explore different methods to highlight the searched string using JavaScript. We'll cover various techniques that range from ...
Read MoreHow to Hide an HTML Element by Class using JavaScript?
When working with dynamic web pages, it's often necessary to hide certain HTML elements based on specific conditions or user interactions. One common approach is to assign classes to these elements and then dynamically hide them using JavaScript. This provides a flexible and efficient way to control the visibility of elements without modifying the HTML structure. In this article, we will explore how to hide HTML elements by class using JavaScript. We'll discuss the importance of dynamically hiding elements, understand the concept of HTML classes, and learn different methods to select elements by class using JavaScript. We will then dive ...
Read MoreFile Type Validation while Uploading it using JavaScript
Social media platforms that focus solely on employment allow users to create an account and will be asked to upload the necessary documents so that the job recruiters can analyze them. To collect the documents from the user, these websites will provide an "Upload file" or "Choose file" option in their user details form; and they accept only particular file types such as ".pdf", ".jpg", ".png", etc. This process is called file validation and it can be done using JavaScript. In this article, we are going to design an option that validates the file types using JavaScript. To do so, ...
Read MoreDHTML JavaScript
DHTML stands for Dynamic Hypertext Markup Language. DHTML combines HTML, CSS, and JavaScript to create interactive and dynamic web pages. It allows for customization and changes to the content based on user inputs. Earlier, HTML was used to create static pages that only defined the structure of the content. CSS helped in enhancing the page's appearance. However, these technologies were limited in their ability to create interactive experiences. DHTML introduced JavaScript and the Document Object Model (DOM) to make web pages dynamic. With DHTML, the web page can be manipulated and updated in response to user actions, eliminating the ...
Read More