Last Updated : Jan 1, 2023
This method is same like MySQL like method in which we get full row or specific data from columns using _o%.
As, there are many methods with the help of which we are able to get substring after character.
In this article, we are going to use substing() method. So, let us understand how to use substring method with help of codes.
- First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
- Secondly, the <html> tag is used to indicate the beginning of an HTML document.
- As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
- Here, then we create a body tag. All the content which we want to show on browser’s screen or display is always written inside this codes.
- For this inside body tag, we create a variable named string. And inside this we create or say write string and use a special character here that is _ as you see in codes given above.
- Now, after this we want that we have to get the substring after character _. So, the content that we get on output is given here known as string.
- So, for this we use substring() on string and store this is variable named after that is created with the help of const.
- Now, at last we print the output using console. It means that the output should not be printed on screen it goes showed on when we inspect our webpage and opens console tab.
- At last, the <body> and <html> tags are closed with </body> and </html> respectively.