The link() method is used to display a string as a hyperlink.
The link() method is used to display a string as a hyperlink.
This method returns the string embedded in the <a> tag, like this:
<a href="url">string</a>
string.link("url")
Parameter | Require | Description |
---|---|---|
url | Required. | The URL to link to |
A string embedded in the <a> tag
Display the text: "Free Web Building Tutorials!" as a hyperlink:
//display a string as a hyperlink. var str = "Tutorials!"; var result = str.link("https://www.book2s.com"); console.log(result);/*from www . j a v a 2 s . c om*/