Front End Technology Articles - Page 546 of 860

How to access an object value using variable key in JavaScript?

Lokesh Yadav
Updated on 08-Dec-2022 08:12:01

14K+ Views

In this article we are going to discuss how to access an object value using variable key in JavaScript. An object value can be accessed by a Dot Notation and a Bracket Notation. To get the object value through a variable key, the value or expression inside the bracket notation must match with the existing key name, then it returns a value. The bracket notation, unlike the dot notation can be used with variables. If we are using a variable with bracket notation, the variable must reference a string. Let’s understand this concept better with the help of examples further ... Read More

How to convert a value into Boolean in JavaScript?

Lokesh Yadav
Updated on 08-Dec-2022 08:10:12

921 Views

In this article we are going to discuss how to convert a value into Boolean in JavaScript. In JavaScript programming we sometimes need values like these ‘YES / NO, ‘ON / OFF’, ‘TRUE / FALSE’. So, JavaScript provides Boolean() method, which helps us to convert a value into Boolean. A Boolean is a value that can return either true/false. There are two ways using which we can convert values into Boolean. One way is to use Boolean() method and the other way is to use the !! notation. Let’s understand this concept better with the help of the examples further ... Read More

What is the use of ()(parenthesis) brackets in accessing a function in JavaScript?

vineeth.mariserla
Updated on 30-Jul-2019 22:30:26

510 Views

The ()(parenthesis) brackets play an important role in accessing a function. Accessing a function without () will return the function definition instead of the function result. If the function is accessed with () then the result can be obtained.Without ()ExampleIn the following example, the function is accessed without () so the function definition is returned instead of the result as shown in the output.Live Demo function toCelsius(f) { return (5/9) * (f-32); } document.write(toCelsius); Outputfunction toCelsius(f) { return (5/9) * (f-32); ... Read More

Print elements that can be added to form a given sum

Sunidhi Bansal
Updated on 30-Jul-2019 22:30:26

233 Views

Input number of elements user want to enters and than input the total value user want to calculate from the given list of elements.Input : N=5    Enter any 5 values : 3 1 6 5 7    Enter sum you want to check : 10 Output : 3 1 6AlgorithmSTART STEP1-> Take values from the user STEP2-> Take the sum a user want to check in the set. STEP3-> For i = 0; i < n; i++ STEP4-> Check If sum - *(ptr+i) >= 0 then,    STEP4.1-> sum -= *(ptr+i);    STEP4.2-> Print the value of *(ptr+i) END ... Read More

How to Find the action Attribute and method of a Form in JavaScript?

Lokesh Yadav
Updated on 27-Jan-2025 12:06:11

3K+ Views

In this article we are going to learn how to find the action attribute and method of a form with suitable examples in JavaScript. In HTML, there is  elements which has few attributes: input, label, text area, select, name, target. The action and method attributes of the form are used to return those values. The action attribute also specifies where to send the form data when form is submitted. To get a better idea of this concept, let’s look into JavaScript examples where we achieved the given task using action attribute and also with method attribute. Using action ... Read More

HTML DOM Label Object

AmitDiwan
Updated on 30-Jul-2019 22:30:26

219 Views

The HTML DOM Label Object in HTML represents the element.SyntaxFollowing is the syntax −Creating a elementvar labelObject = document.createElement(“LABEL”)PropertiesHere, “LabelObject” can have the following properties −PropertyDescriptionControlIt returns the control of the labelformIt returns a reference of enclosing form that contains the labelhtmlForIt returns/sets the value of the for attribute of a labelExampleLet us see an example for Label htmlForproperty − Live Demo Label htmlFor    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px; ... Read More

HTML DOM Label htmlFor Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

204 Views

The HTML DOM Label htmlFor property returns/sets the value of for attribute.SyntaxFollowing is the syntax −Returning value of for attribute −labelObject.htmlForExampleLet us see an example for Label htmlForproperty − Live Demo Label htmlFor    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } Label-htmlFor Current Editor: Label for attribute set as editor two ... Read More

HTML DOM KeyboardEvent Object

AmitDiwan
Updated on 30-Jul-2019 22:30:26

117 Views

The HTML DOM KeyboardEvent Object represents an event when user presses a key on keyboard.PropertiesHere, “KeyboardEvent” can have the following properties and methods −Property/MethodDescriptionaltKeyIt returns whether the "ALT" key was pressed or notcharCodeIt returns the Unicode character code of the keycodeIt returns the code of the keyctrlKeyIt returns whether the "CTRL" key was pressed or notgetModifierState()It returns true if the specified key is activated and false if inactiveisComposingIt returns whether the state of the event is composing or notkeyIt returns the key value of the key represented by the eventkeyCodeIt returns the Unicode character code of the key that triggered ... Read More

HTML DOM KeyboardEvent shiftKey Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

112 Views

The HTML DOM KeyboardEvent shiftKey property returns the Boolean value (true/false) corresponding to if shift key was pressed using an event or not.SyntaxFollowing is the syntax −Returning booleanValue −event.shiftKeyExampleLet us see an example for KeyboardEvent shiftKey property − Live Demo KeyboardEvent shiftKey    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } KeyboardEvent-shiftKey Editor: I Dare you ... Read More

HTML DOM KeyboardEvent metaKey Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

118 Views

The HTML DOM KeyboardEvent metaKey property returns the Boolean value (true/false) corresponding to if meta key was pressed using an event or not.SyntaxFollowing is the syntax −Returning booleanValue −event.metaKeyExampleLet us see an example for KeyboardEvent metaKey property − Live Demo KeyboardEvent metaKey    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } KeyboardEvent-metaKey Editor: I Dare you ... Read More

Advertisements