Abhinaya has Published 75 Articles

How to check whether a string contains a substring in JavaScript?

Abhinaya

Abhinaya

Updated on 20-Apr-2022 12:44:47

JavaScript provides us with different methods to check whether a string contains a substring or not. In this article, we use the following three methods for this purpose-String search() methodString indexOf() methodString includes() methodLet’s explore in detail each method.1. String search() methodThe string search method can be used to search ... Read More

How to add a unique id for an element in HTML?

Abhinaya

Abhinaya

Updated on 24-Jun-2020 08:28:45

Use the id attribute in HTML to add the unique id of an element.ExampleYou can try to run the following code to implement id attribute −           Tutorialspoint       We provide Tutorials!       More...                function display() {             document.getElementById("myid").innerHTML = "We provide learning videos as well";          }          

How to include the result of a calculation in HTML5?

Abhinaya

Abhinaya

Updated on 24-Jun-2020 08:08:17

Use the tag in HTML5 to specify the result of a calculation. The HTML tag also supports the following additional attributes −AttributeValueDescriptionfor forList of IDs of other elements, i.e. it indicates the elements who have contributed input value to the calculation.form formEnables to place output elements anywhere within ... Read More

How do we include an emphasized text in HTML?

Abhinaya

Abhinaya

Updated on 24-Jun-2020 07:39:13

Use the tag in HTML to include emphasized text. The tag formats the text in a document.ExampleYou can try to run the following code to learn how to implement tag in HTML −           HTML em Tag               Simply Easy Learning.    

Why aren't variable-length arrays part of the C++ standard?

Abhinaya

Abhinaya

Updated on 24-Jun-2020 05:52:35

Having to create a potential large array on the stack, which usually has only little space available, isn't good. If you know the size beforehand, you can use a static array. And if you don't know the size beforehand, you will write unsafe code. Variable-length arrays can not be included ... Read More

How to set the length of the item relative to the rest with JavaScript?

Abhinaya

Abhinaya

Updated on 23-Jun-2020 12:16:12

Use the flex property in JavaScript to set the length of the item relative to the rest. You can try to run the following code to implement flex property with JavaScript −Example                    #box {           ... Read More

How to create JavaScript regexes using string variables?

Abhinaya

Abhinaya

Updated on 23-Jun-2020 12:07:53

Yes, use new RegExp(pattern, flags) to achieve this in JavaScript.You can try to run the following code to implement JavaScript regex using string variables −                    var str = 'HelloWorld'.replace( new RegExp('hello', 'i'), '' );          document.write(str);          

How to set the bottom padding of an element with JavaScript?

Abhinaya

Abhinaya

Updated on 23-Jun-2020 11:21:20

To set the bottom padding, use the paddingBottom property in JavaScript.ExampleYou can try to run the following code to return the bottom padding of an element with JavaScript −                    #box {             border: 2px ... Read More

Match any string containing zero or more p's.

Abhinaya

Abhinaya

Updated on 23-Jun-2020 08:33:40

To match any string containing zero or more p’s with JavaScript RegExp, use the p* Quantifier.ExampleYou can try to run the following code to match any string containing zero or more p’s. Here, p is considered as a number of occurrences −           JavaScript Regular Expression ... Read More

With JavaScript RegExp search a vertical tab character.

Abhinaya

Abhinaya

Updated on 23-Jun-2020 07:50:10

To find a vertical tab character with JavaScript Regular Expression, use the following −\vExampleYou can try to run the following code to find a vertical tab character. It returns the position where the vertical tab (\v) character is found −           JavaScript Regular Expression     ... Read More

1 2 3 4 5 ... 8 Next
Advertisements