My code keeps throwing a
SyntaxError: missing variable name
at line 17: var drawSverige = document.getElementById('draw-sverige')
I'm struggling to understand why. The keyword "var" is clearly present before the identifier drawSverige.
!function () {
'use strict';
function Flag(){
this.init = function (flag, country){
this.flagInfo = country;
this.htmlTag = flag;
};
}
this.draw = function() {
this.htmlTag.innerHTML = this.flagInfo;
};
var flagSverige = document.getElementById('flag-sverige'),
var drawSverige = document.getElementById('draw-sverige'),
var flagElfenbenskusten = document.getElementById('flag-elfenbenskusten'),
var drawElfenbenskusten = document.getElementById('draw-elfenbenskusten'),
var flagMaruritius = document.getElementById('flag-maruritius'),
var drawMaruritius = document.getElementById('draw-maruritius'),
var flagJapan = document.getElementById('flag-japan'),
var drawJapan = document.getElementById('draw-japan'),
showSverige = new Flag();
showSverige.init(flag, '<div class="flagga1 sverige"><div class="box1"></div><div class="box2"></div><div class="box3"></div><div class="box4"></div></div>');
var showElfenbenskusten = new Flag();
showElfenbenskusten.init(flag, '<div class="flag elfenbenskusten"><div class="part1"></div><div class="part2"></div></div>');
var showMaruritius = new Flag();
showMaruritius.init(flag, '<div class="flagga2 maruritius"><div class="box1"></div><div class="box2"></div><div class="box3"></div><div class="box4"></div><div class="box5"></div></div>');
var showJapan = new Flag();
showJapan.init(flag, '<div class="flagga3 japan"><div class="box1"></div><div class="cirkel1"></div></div>');
for (var flagx = [
flagSverige,
flagElfenbenskusten,
flagMaruritius,
flagJapan
], tot = 0; tot < flagx.length; tot++)
flagx[tot].draw();
}();