Front End Technology Articles - Page 538 of 860

How to add a method to a JavaScript object?

Lokesh Yadav
Updated on 09-Dec-2022 05:37:08

7K+ Views

In this article, we’ll go over how to add a method to a JavaScript object in JavaScript with appropriate examples. A JavaScript object is an entity which has properties. A property can be a variable or a method which define state and behavior of the object. A method is a property of an object that adds behavior to an object. We can add a method to a JavaScript object using object prototype. All JavaScript objects get their attributes and methods from a prototype. Let’s understand this concept better with the help of examples further in this article. Syntax The syntax ... Read More

Create many JavaScript objects as the same type?

Manisha Patil
Updated on 23-Aug-2022 13:34:16

2K+ Views

JavaScript is a lenient object-oriented language. We'll look at various JavaScript object creation methods in this article. It is crucial to know that JavaScript is an object-oriented language based on prototypes instead of classes before moving on. It can be more difficult to understand how JavaScript enables you to build hierarchies of objects and to get an inheritance of properties and their values because of this different foundation. Programming objects can combine variables, functions, and data structures. In other words, objects can hold values, you can use objects to manipulate values, and you can combine values into more complicated objects, ... Read More

Access property as a property using 'get' in JavaScript?

Manisha Patil
Updated on 23-Aug-2022 13:31:54

555 Views

Property accessors offer dot notation or bracket notation-based access to an object's properties. Associative arrays are a good way to understand objects (a.k.a. map, dictionary, hash, lookup table). The names of the property names are the keys inside this array. A difference between properties and methods is frequently made when discussing an object's properties. But the distinction between a property and a technique is simply an established practice. When a property's value is a reference to an example of a Function, for example, that property can be invoked to perform a function. Syntax ObjectName[propertyName] You will study JavaScript getter ... Read More

HTML DOM Button autofocus Property

AmitDiwan
Updated on 06-Aug-2019 14:12:45

163 Views

The HTML DOM Button autofocus property is associated with autofocus property of the element. The button autofocus property is used to specify whether a button on the HTML document should get the focus or not when the page loads.SyntaxFollowing is the syntax for −Setting the button autofocus property −buttonObject.autofocus = true|falseHere, the true|false specifies if the given input button should get the focus on not when the page loads.True − Input button gets focusFalse − Input button doesn’t get focus.ExampleLet us see an example for the HTML DOM button autofocus property − BUTTON Click the below button to know ... Read More

HTML DOM Bold object

AmitDiwan
Updated on 06-Aug-2019 14:06:12

491 Views

The HTML DOM bold object is associated with the html (bold) tag. The tag is used to make the text inside the tag bold .Using the bold object we can access the HTML tag.SyntaxFollowing is the syntax for −Creating a bold object −var x = document.createElement("B");ExampleLet us see an example for the HTML DOM Bold object − Click the below button to create a element with some text CREATE    function createBold() {       var x = document.createElement("B");       var t = document.createTextNode("SAMPLE BOLD TEXT");     ... Read More

HTML DOM Body property

AmitDiwan
Updated on 20-Feb-2021 06:15:52

160 Views

The HTML DOM body property associated with HTML element is used to set or return property values of the element. It returns the element. It can be used to change content inside the element. This property can overwrite child elements content present inside the element.SyntaxFollowing is the syntax for −Setting the body property −document.body = New_ContentHere, New_Content is the new content for the element.ExampleLet us see an example for the HTML DOM Body property −Live Demo Sample HEADING Click the below button to overwrite child content Overwrite Content A sample paragraph   ... Read More

HTML DOM Body object

AmitDiwan
Updated on 06-Aug-2019 14:17:32

358 Views

The HTML DOM Body object is associated with the HTML element. The attributes and their values set inside the body tag stay throughout the HTML document unless they are overridden by any of its child node.The body object can be used to access and manipulate these properties and their values.PropertiesFollowing are the properties for HTML DOM Body object −Note − The properties below are not supported in HTML5 .Use CSS instead −PropertyDesciptionaLinkTo set or return the active link color in a document.backgroundTo set or return the background image for the documentbgColorTo set or return the background color of the ... Read More

How to encode a string in JavaScript?

Lokesh Yadav
Updated on 09-Dec-2022 05:33:56

26K+ Views

In this article we are going to learn how to encode a string in JavaScript with appropriate examples. Encoding is the process of converting from one data format to another format. In computer science terms, encoding is the process of converting a text into a cipher text. Encoding is different from the Encryption process. The difference between encoding and encryption is where the encoding is used to keep data usable and data confidentiality is maintained by encryption. Encoding does not use a key for encoding process whereas for encryption there should be a key for encryption process. The methods that ... Read More

HTML DOM blockquote object

AmitDiwan
Updated on 20-Feb-2021 06:19:06

196 Views

The HTML DOM blockquote basically represent the HTML element . The element does not add any quotation marks unlike the tag. We can create and access properties with the help of the blockquote object.SyntaxFollowing is the syntax for −Creating the blockquote object −var x = document.createElement("BLOCKQUOTE");ExampleLet us see an example of the blockquote object −Live Demo Click on the below button to create a blockquote object CREATE    function createBloc() {       var x = document.createElement("BLOCKQUOTE");       var t = document.createTextNode("This is a random block quote.This is some sample text."); ... Read More

HTML DOM blockquote cite Property

AmitDiwan
Updated on 06-Aug-2019 14:39:29

175 Views

The HTML DOM blockquote cite property is associated with the HTML element. This property is used to set or return the cite attribute of the quote. The cite property is useful for screen readers and not so much for normal user as it doesn’t have any visual effect on the web page. The cite property is used to set the source url of the quote.SyntaxFollowing is the syntax for −Setting the cite property −blockquoteObject.cite = URLHere, URL specifies the quotation location.ExampleLet us see an example for the blockquote cite property − Quote Here is a quote: ... Read More

Advertisements