Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialValerie Smith
Courses Plus Student 5,244 Pointsin script element features array is getting pulled up as error with sytax error code!
In my script element, the console does not like the array features it says the '[' bracket is 'uncaught syntax error; unexpected token' and none of the edits are showing. Please let me know if I have made any other mistakes!
<script> $('audio,video').mediaelementplayer({ success: function(player, node){ $('#' + node.id + '-mode').html('mode: ' + player.pluginType); }, features['playpause', 'tracks', 'progress'], startLanguage: 'en', translationSelector: true }); </script>
1 Answer
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsLine 44 of treehouse-skin.html you need to put a colon after the property name features
:
$('audio,video').mediaelementplayer({
success: function(player, node){
$('#' + node.id + '-mode').html('mode: ' + player.pluginType);
},
features: ['playpause', 'tracks', 'progress'],
startLanguage: 'en',
translationSelector: true
});
Often the problem isn't where the error message says it is but right before it. I ran your code through jshint (http://jshint.com/) and it gave me much better error messages. The first item here says what the problem is, everything else fixed itself.
Expected ':' and instead saw '['.
5 Expected ':' and instead saw ','.
5 Expected '}' to match '{' from line 1 and instead saw ']'.
6 Expected ')' and instead saw ':'.
6 Missing semicolon.
7 Expected an assignment or function call and instead saw an expression.
7 Missing semicolon.
7 Unrecoverable syntax error. (87% scanned).