Found 8895 Articles for Front End Technology

How to set Text alignment in HTML?

Sharon Christine
Updated on 29-Aug-2023 07:12:50

226K+ Views

To set text alignment in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML tag, with the CSS property text-align for the center, left, and right alignment. HTML5 do not support the align attribute of the tag, so the CSS style is used to set text alignment.Just keep in mind, the usage of style attribute overrides any style set globally. It will override any style set in the HTML tag or external style sheet.ExampleYou can try to run the following code to set text ... Read More

What is the difference between closure and nested functions in JavaScript?

mkotla
Updated on 09-Jan-2020 06:52:53

797 Views

JavaScript ClosuresIn JavaScript, all functions work like closures. A closure is a function, which uses the scope in which it was declared when invoked. It is not the scope in which it was invoked.Here’s an exampleLive Demo           JavaScriptClosures                       varp = 20;             functiona(){                var p = 40;                b(function(){                   alert(p);             ... Read More

How to set font color in HTML?

Lokesh Badavath
Updated on 29-Aug-2023 07:35:05

153K+ Views

We use the style attribute to set the font color in HTML. The style attribute specifies an inline style for an element, with the CSS color property. The attribute is used with the HTML tag, with the CSS color property. HTML5 do not support the tag, so the CSS style is used to add font color. The tag deprecated in HTML5. Syntax text… Example In the example below, we set the font color of the text inside the tag. DOCTYPE html> HTML Font color ... Read More

How does recursion function work in JavaScript?

Shubham Vora
Updated on 22-Jul-2022 13:16:55

508 Views

This article will teach you how to create a JavaScript recursive function-a function that calls itself-using the recursion method. The process of recursion involves calling itself. Recursive functions are those that call themselves repeatedly. A condition to cease calling itself is always included in recursive functions. Otherwise, it will continue to call itself. Recursive functions are typically used to divide a large issue into smaller ones. Recursive functions are frequently found in data structures like binary trees, graphs, and algorithms like binary search and quick-sort.A recursive function is not immediately clear or simple to comprehend. You will read and comprehend ... Read More

Understanding function scope and context in JavaScript?

Shubham Vora
Updated on 15-Nov-2022 10:41:11

187 Views

In this tutorial, let us discuss the function scope and context in JavaScript. Functions are the building blocks of Javascript. Therefore, JavaScript is a functional programming language. Scope The 'scope' is the code space where we can define and use a variable in a function. Scopes are of four types. Global scope Global 'scope' is the default scope. A variable with global 'scope' is accessible throughout the program. Browser closing removes a global variable. Window objects can access var variables wherein they can't access the let variables. Functional or local 'scope' A function variable is accessible only with the function. ... Read More

How to call functions in JavaScript?

Ankitha Reddy
Updated on 09-Jan-2020 06:48:02

151 Views

A function is a group of reusable code which can be called anywhere in your program. This eliminates the need of writing the same code repeatedly. It helps programmers in writing modular codes.The most common way to define a function in JavaScript is by using the function keyword, followed by a unique function name, a list of parameters (that might be empty), and a statement block surrounded by curly braces.Here’s an example −     To call a function somewhere later in the script, you would simply need to write the name of that function as shown in the following ... Read More

How to arguments object with Rest, default, and destructured parameters in JavaScript?

Abhinaya
Updated on 15-Jun-2020 13:19:37

88 Views

defaultThis came to handle function parameters with ease. Easily set Default parameters to allow initializing formal parameters with default values. This is possible only if no value or undefined is passed. Let’s see an exampleExampleLive Demo                    // default is set to 1          function inc(val1, inc = 1) {             return val1 + inc;          }          document.write(inc(10, 10));          document.write("");          document.write(inc(10));           restES6 ... Read More

How to set background color in HTML?

Lokesh Badavath
Updated on 29-Aug-2023 07:08:04

234K+ Views

Setting the background color of a web page or an element on the web page, enable us to create unique layouts for the web page. To set the background color in HTML, use the style attribute, with the CSS property background-color inside the body tag of the HTML document. HTML5 do not support the tag bgcolor attribute, so the CSS style is used to add background color. The bgcolor attribute deprecated in HTML5. We can change the background color by overriding the property with the other property. Syntax Example Following is the example program to set background ... Read More

How to concatenate multiple string variables in JavaScript?

Shubham Vora
Updated on 08-Aug-2022 11:38:55

17K+ Views

In this tutorial, we will learn to concatenate the multiple string variables in JavaScript. It’s many times needed that we need to concatenate two strings in a single variable and use it. The simple meaning of concatenation is to merge two or multiple strings. Also, string concatenation is useful to insert some substring in the parent string. For example, while developing the application, as a programmer, you need to update the string by adding some other extra string to it. Users can split the string first and insert the substring using the concatenation operation. There are various methods to merge ... Read More

How to create a link to send email in HTML?

Lokesh Badavath
Updated on 18-Nov-2022 09:53:52

2K+ Views

We use HTML tag defines a hyperlink used to link web pages. The href attribute of the tag, which indicates the link's destination. Which provides us option to specify an email address. To create a link to send mail we use mailto:to specify email address inside href attribute in HTML. Syntax Following is the syntax to link a mail address to the web page. xx@gmail.com Same as the way we link a mobile number. We use mailto instead of tel inside a href attribute. Example Following is the example program to link a mail address to the ... Read More

Advertisements