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
-
Economics & Finance
Web Development Articles
Page 277 of 801
How to compile a Typescript file?
In this article we are going to explore TypeScript and how to compile and execute TypeScript files. TypeScript is an open-source programming language developed and maintained by Microsoft. TypeScript is syntactically similar to JavaScript but adds additional features like static typing and object-oriented programming. Unlike JavaScript, TypeScript does not run directly in web browsers and must be compiled to JavaScript first. TypeScript files need to be transpiled to JavaScript before they can be executed. This compilation process converts TypeScript syntax into standard JavaScript that browsers and Node.js can understand. Prerequisites Before compiling TypeScript files, you need ...
Read MoreHow to convert a string of any base to an integer in JavaScript?
An integer can be represented in various formats in programming languages such as Binary (base 2), Decimal (base 10), Hexadecimal (base 16), and Octal (base 8). A Binary number consists of two digits only (0 & 1), whereas a decimal consists of digits from 0 to 9. We can convert a string to an integer using the parseInt() method. When the integer is represented in a different base, we need to pass the base parameter to decode it correctly. Syntax parseInt(string_value, base) parseInt(string_value) // Defaults to base 10 Parameters ...
Read MoreJavaScript: How to Create an Object from Key-Value Pairs
In JavaScript, there are several ways to create objects from key-value pairs. Whether you have individual keys and values or arrays of data, you can build objects dynamically using different approaches. Using Object Literal Syntax The simplest way is to create an empty object and assign properties directly: Object Using Key-value Pair Welcome to Tutorials Point let object = {}; let firstKey ...
Read MoreHow to Create a Parallax Effect using HTML, CSS, and JavaScript?
In this article, we are going to learn about parallax effects and how to create them using HTML, CSS, and JavaScript. We will be using the mouse-move event to show the parallax effect. During the parallax effect, two different images move in parallel to each other. Both the images will be working parallel and making the same transitions. The only difference will be they move in the opposite directions. Parallax effects are used for making websites better in terms of User Experience and enhancing the interactivity level of the website. We can move the foreground and the background images ...
Read MoreHow to Create Timeline Animations using Anime.js?
In this article, we are going to explore and learn about Timeline Animations. Anime.js is a lightweight JavaScript library that has a small but powerful set of APIs. It works upon the DOM attributes, CSS properties, SVG, and JavaScript objects. We can build multiple and complex animations using the Anime.js. Anime's built-in staggering system helps in making complex follow through and overlapping animations simple. It can also be used on both timings and properties. How to use Anime.js? We can import or use Anime.js in our code in the following two ways: ...
Read MoreHow to Declare an Object with Computed Property Name in JavaScript?
In JavaScript, computed property names allow you to dynamically create object properties using expressions inside square brackets. This ES6 feature provides flexibility when property names need to be determined at runtime. JavaScript Object – A JavaScript object contains key-value pairs where the key represents a property from which we can get and set the value of an object. Using Square Bracket Notation in Object Literals We can use square bracket expressions [] to create computed property names directly in object literals. In ES6, it's possible to use any expression within the brackets. Example 1 In ...
Read MoreHow to Generate a PDF from an HTML Webpage?
Converting HTML content to PDF is a common requirement for web applications. This allows users to save content for offline reading, generate reports, or create downloadable documents. There are two primary approaches to generate PDFs from HTML webpages: Using the browser's native print functionality Using JavaScript libraries like jsPDF Method 1: Using Browser Print Functionality This method leverages the browser's built-in print feature to create a PDF. It opens a new window with the content and triggers the print dialog. Steps: Open a ...
Read MoreHow to Detect if CAPS Lock is ON using JavaScript?
In this article, we are going to explore the CAPS LOCK key and how to check if it is turned on or not using JavaScript on a webpage. While working with modern web applications, we often require information about user interaction and experience. The user interacts with a website to execute functionality like hitting an API, handling clicks or buttons that trigger methods, and many more. In some cases, we might need to know whether the CAPS LOCK key is turned on or not. One use case can be any authentication system that notifies the user that the ...
Read MoreJavaScript: How to Detect if a Website is Open on a Mobile or a Desktop?
We can use the CSS media queries to check whether the website is opened inside a web browser or a mobile browser. This information can be fetched using the min-width and the max-width of the webpage. CSS media queries are only limited to styling the web pages but we can control the functionality of a website as per the user's device by using the navigator properties in JavaScript. The Navigator returns a set of values that includes user browser, version, operating system, and many more. Syntax navigator.userAgent Method 1: Using navigator.userAgent In ...
Read MoreHow to encode and decode a URL in JavaScript?
Encoding and decoding URLs is essential in web development for handling special characters in URLs. When making GET requests to APIs with query parameters, proper encoding ensures URLs are transmitted correctly. Browsers often handle this automatically, but understanding these methods is crucial. For example, a space " " is encoded as %20 or + depending on the context. Understanding URL Encoding Methods JavaScript provides two main functions for URL encoding: encodeURI() − Encodes a complete URI while preserving URL structure characters like :, /, ?, #, &, = encodeURIComponent() ...
Read More