Reputation: 29
var stateData = {
MA: { fullName: 'Massachusetts: some infor here | some info here | test'},
VA: { fullName: 'Virginia:' },
VA: { fullName: 'Virginia' },
VA: { fullName: 'Virginia' },
VA: { fullName: 'Virginia' },
VA: { fullName: 'Virginia' },
VA: { fullName: 'Virginia' },
VA: { fullName: 'Virginia' },
VA: { fullName: 'Virginia' }
// other states' data...
}
I need help styling the code inside MA, it does not let me put line breaks or anything. Thanks for the help!
Upvotes: 0
Views: 31
Reputation: 6268
Sorry, this post is a bit too length for the comment box.
\n
is the universal newline character.
But perhaps you should look at this alternative:
var stateData = {
MA: {
fullName: 'Massachusetts',
motto: 'A catchy expression here',
information: 'More data here',
population: 1000
},
}
To me it looks like you are building some JSON that you'll probably reference like:
stateData.MA.fullName
It's considered bad practice to format your raw data. You should probably do this when you use the data:
console.log('Now you\'ve travelled to: ' + stateData.MA.fullName + "/n" + stateData.MA.motto);
Just a thought.
Upvotes: 1
Reputation: 1619
If you want a line break within a JavaScript string then you should do \n (which stands for new line)
Upvotes: 0