With the fo开发者_运维技巧llowing code I am trying to set both the test title and object. The code works if I use one line but not both.
if (today <= test0) var testTitle = testTitle0
if (today <= test0) var testObject = testObject0
Outcome:
if (today <= test0) var testTitle = testTitle0 & var testObject = testObject0
You are missing curly braces and semicolons:
if (today <= test0) {
var testTitle = testTitle0,
testObject = testObject0;
}
if (today <= test0)
{
var testTitle = testTitle0;
var testObject = testObject0;
}
Learn to use braces around if statements and semicolons at the end of your lines.
精彩评论