Adsense
Popular Posts
- Install APXS in Redhat Linux
- MySQL workbench -"Could not decrypt password cache"
- Transfer modules between sites
- JavaScript, remove trailing insignificant zeros after toFixed function
- Set Windows path command line
- datatable order by nunmeric
- MySQL date created and date modified
- super(props) in React
- PHP, dump varailbes in a format way
- React: connect(mapStateToProps, mapDispatchToProps)
Monday, June 15, 2015
Creating multiline strings in JavaScript
For a long strings, if you use return key in text editor for javascript, you may encounter an error for example:
var s1= 'test
This is another line';
We can use \ in at the end of each line to create a multiline string such as
var s1= 'test \
This is another line';
We can also use string concatenation (better)
var s1= 'test'+
'This is another line';
Labels:
javascript
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment