Abhinaya has Published 58 Articles

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

Abhinaya

Abhinaya

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

875 Views

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

913 Views

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";          }          

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

Abhinaya

Abhinaya

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

471 Views

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

112 Views

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

145 Views

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

659 Views

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

178 Views

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

266 Views

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

With JavaScript how can I find the name of the web browser, with version?

Abhinaya

Abhinaya

Updated on 23-Jun-2020 07:01:42

306 Views

To find the name of the web browser, with version, you need to try the following code −Example           Browser Detection Example                                  

How do you launch the JavaScript debugger in Google Chrome?

Abhinaya

Abhinaya

Updated on 23-Jun-2020 06:40:20

274 Views

To launch JavaScript debugger in Google Chrome, try any of the following ways,Press Ctrl + Shift + JGo to Settings and click More Tools. After that, click Developer Tools.For more, refer the official website of  Chrome Dev Tool,

Advertisements