How can I rectify quot Expected String instead saw quotquot quot using jslint

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I ve got a regular expression:

return (str+  ).replace(/^(.)|s(.)/g, function ( $1 ) { return $1.toUpperCase ( ); } );

I get following jslint error:

Expected String instead saw ""

How can I rectify this error?

Answers

It wants you to use

String(str)

isntead of

(str+  )

Invoking the String function as a "cast" is a slightly cleaner way to convert something to a string from some other type.

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/10794420/how-can-i-rectify-expected-string-instead-saw-using-jslint

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils