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 357 of 801
How to manipulate JavaScript's Date object?
JavaScript's Date object provides powerful methods to manipulate dates and times. You can use getter methods to retrieve date components and setter methods to modify them. Understanding these methods is essential for effective date manipulation in JavaScript applications. Once a Date object is created, numerous methods allow you to operate on it. Most methods let you get and set the year, month, day, hour, minute, second, and millisecond fields using either local time or UTC (universal, or GMT) time. Common Date Methods Here are the key methods used with Date objects: Sr.No Methods ...
Read MoreWhat is the difference between custom and built-in functions in JavaScript?
JavaScript functions are divided into two main categories: custom (user-defined) functions and built-in functions. Understanding the difference helps you leverage JavaScript's capabilities effectively. Custom Functions (User-Defined) Custom functions are created by developers to perform specific tasks. You define the logic, parameters, and return values according to your needs. Syntax function functionName(parameter1, parameter2) { // Your custom logic here return result; } Example: Custom Function Custom Function Example ...
Read MoreHow to set the CSS margin properties in one declaration?
The margin property defines the space around an HTML element. It is possible to use negative values to overlap content. It specifies a shorthand property for setting the margin properties in one declaration. Syntax margin: value; margin: top right bottom left; margin: top horizontal bottom; margin: vertical horizontal; Margin Value Patterns The margin property accepts 1 to 4 values with different behaviors: Values Result Example 1 value All sides same margin: 20px 2 values vertical | horizontal margin: 10px 5px 3 values top | horizontal ...
Read MoreHow to invoke a JavaScript Function as a method?
In this tutorial, we will learn how to invoke a JavaScript Function as a method. In JavaScript, the code inside a function will execute when the function is invoked. We can invoke a function in a variety of ways. One of them is using the method. The method is a property of an object that has a function value. We can define functions as object methods. This function will have a function name, a parameter (optional), and a return type (optional). It will have a "this" keyword which refers to an object. Users can follow the syntax below ...
Read MoreHow can we assign a function to a variable in JavaScript?
In this tutorial, we will learn to assign a function to a variable in JavaScript. Functions are reusable code blocks that can be stored in variables as expressions. There are two main ways to achieve this: using anonymous functions and arrow functions. Most JavaScript programmers are familiar with named functions, which follow this syntax: function function_name() { // function body } However, when we want to assign a function to a variable as an expression, we have two different approaches: Creating Anonymous Functions ...
Read MoreSet Outset border with CSS
To set an outset border with CSS, use the border-style property with the value outset. An outset border creates a 3D effect that makes the element appear raised or protruding from the page. Syntax border-style: outset; /* Or combine with width and color */ border: width outset color; Example Outset Border Example This paragraph has no border. ...
Read MoreHow can we use a JavaScript function as an object?
This tutorial will teach us to use JavaScript functions as objects. In JavaScript, functions are first-class objects, meaning they can have properties and methods just like regular objects. This powerful feature allows us to create constructor functions that act as blueprints for creating multiple similar objects. The JavaScript object is an entity that contains key-value pairs with unique keys. Each key has values that can be of any type. We can access object values using their keys. We can create a function that behaves like an object using the this keyword and the new operator. Below is a ...
Read MoreHow to define custom JavaScript exceptions?
Custom JavaScript exceptions allow you to create specific error types for your application. You can throw custom error messages or create custom error classes for better error handling. Basic Custom Exception with String The simplest way to create a custom exception is by throwing a string message: function divide(a, b) { try { ...
Read MoreChange the width of the bottom border with CSS
The border-bottom-width CSS property controls the thickness of an element's bottom border. This property only works when a border style is defined, as borders are invisible by default. Syntax border-bottom-width: value; Common values include thin, medium, thick, or specific measurements like 1px, 5px, 0.5em. Example This is demo content with a 6px bottom border. ...
Read MoreHow to catch any JavaScript exception in Clojurescript?
ClojureScript is a dialect of the Clojure programming language that compiles to JavaScript, allowing developers to use Clojure's functional programming paradigms in web browsers and Node.js environments. When building ClojureScript applications, proper exception handling is crucial for maintaining application stability and user experience. What is ClojureScript? ClojureScript is a compiler that transforms Clojure code into optimized JavaScript. Originally, Clojure only compiled to Java Virtual Machine bytecode, but ClojureScript emerged in 2011 to bring Clojure's powerful features to client-side development. ClojureScript operates at a higher abstraction level than JavaScript. While JavaScript deals with variables, loops, conditions, and objects, ...
Read More