Naudojant kabutes susiduriama su problema, kai nori naudoti string'e pačias kabutes.
Vedant string:
"Slaptas kodas "nežinau""
Gausime kodą:
Uncaught SyntaxError: Unexpected identifier
Tam kad išvengti klaidos reikia prieš kabutes kurios bus string'e naudoti \.
"Slaptas kodas \"nežinau\""
Kiti specialūs simboliai:
Paskutiniai du yra kitokie (\n ir \t), nes jie sukuria "baltus tarpus".
Pavyzdys: norint išvesti šią informaciją:
"The file located at "C:\\Desktop\My Documents\Username\link.lnk" contains the names on the roster."
reikia pateikti:
"The file located at \"C:\\\\Desktop\\My Documents\\Username\\link.lnk\" contains the names on the roster."
Vedant string:
"Slaptas kodas "nežinau""
Gausime kodą:
Uncaught SyntaxError: Unexpected identifier
Tam kad išvengti klaidos reikia prieš kabutes kurios bus string'e naudoti \.
"Slaptas kodas \"nežinau\""
Kiti specialūs simboliai:
Paskutiniai du yra kitokie (\n ir \t), nes jie sukuria "baltus tarpus".
Pavyzdys: norint išvesti šią informaciją:
"The file located at "C:\\Desktop\My Documents\Username\link.lnk" contains the names on the roster."
reikia pateikti:
"The file located at \"C:\\\\Desktop\\My Documents\\Username\\link.lnk\" contains the names on the roster."
Komentarai
Rašyti komentarą