JavaScript String link() Method

var result ="");```

guys is this the prefered method for adding url links to my js file?

is this supported by all browsers?

can i use String link() Method as properties?

```var object ={
link:"this is a link",
}``` returns a full anchor tag as a string. You can use it as a property if that’s what you’re going for, but I wouldn’t call it the “preferred” method. I’m sure there’s some good use for it, but I don’t know that adding a link to a page is it.

As far as browser support, you can check for anything at

edit: I guess this method doesn’t have an entry on caniuse. MDN says it’s supported, though.

1 Like