Reputation: 141
I'm currently reading a book on Learning to Program by Steven Foote. The book is currently talking about automation and is detailing how to use grunt.
I just installed grunt using npm install -g grunt-cli
succesfully, however I am now running into a error that I'm not familiar with.
When I run grunt I get the following errors:
users-mbp:kittenbook user$ grunt
Running "jshint:files" (jshint) task
Linting js/prompt.js ...ERROR
[L3:C21] E031: Bad assignment.
'<p>' + projectName = ' ' _ versionNumber +
Linting js/prompt.js ...ERROR
[L3:C22] W033: Missing semicolon.
'<p>' + projectName = ' ' _ versionNumber +
Linting js/prompt.js ...ERROR
[L3:C23] W030: Expected an assignment or function call and instead saw an expression.
'<p>' + projectName = ' ' _ versionNumber +
Linting js/prompt.js ...ERROR
[L3:C26] W033: Missing semicolon.
'<p>' + projectName = ' ' _ versionNumber +
Linting js/prompt.js ...ERROR
[L3:C27] W030: Expected an assignment or function call and instead saw an expression.
'<p>' + projectName = ' ' _ versionNumber +
Linting js/prompt.js ...ERROR
[L3:C28] W033: Missing semicolon.
'<p>' + projectName = ' ' _ versionNumber +
Linting js/prompt.js ...ERROR
[L4:C31] E031: Bad assignment.
'accessed on: ' + currentTime = '</p>';
Linting js/prompt.js ...ERROR
[L4:C31] W030: Expected an assignment or function call and instead saw an expression.
'accessed on: ' + currentTime = '</p>';
Linting js/prompt.js ...ERROR
[L4:C32] W033: Missing semicolon.
'accessed on: ' + currentTime = '</p>';
Linting js/prompt.js ...ERROR
[L4:C33] W030: Expected an assignment or function call and instead saw an expression.
'accessed on: ' + currentTime = '</p>';
Warning: Task "jshint:files" failed. Use --force to continue.
prompt.js
contains:
var userName = prompt('Hello what\'s your name?');
document.body.innerHTML = '<h1>Hello, ' + userName + '!</h1>' +
'<p>' + projectName = ' ' _ versionNumber +
'accessed on: ' + currentTime = '</p>';
I'm fairly new to grunt so I'm not sure what to do to fix the errors. Any help would be appreciated.
Upvotes: 0
Views: 90
Reputation: 4335
You just have a few wrong assignations in prompt.js
. In a few places you used =
instead of +
to concatenate the string.
Replace with the following:
var userName = prompt('Hello what\'s your name?');
document.body.innerHTML = '<h1>Hello, ' + userName + '!</h1>' +
'<p>' + projectName + ' ' + versionNumber +
'accessed on: ' + currentTime + '</p>';
Upvotes: 1