<script>
let sectionFlags = {
objective: true; // '} expected'
coursework: true;
education: true;
technicalSkills:true;
}
function toggleSection(id){
sectionFlags[id] { //'} expected'
if(sectionFlags[id]){
$('#' + id.css('display','block'));
}
else {
'none'; //'} expected'
}
}
}
let resume;
function displayObjective() {
$('#objective').html(htmlFrag);
}
function displayFromJson() {
displayObjective(); //'} expected'
$("#objectiveHeading").on('click', {id: 'objective'}, toggleSection) // '} expected'
}
$(document).ready(function(){
$.getJSON('resume.json'), function(resumeData) {
resume = resumeData;
displayFromJson();
});
});
</script>
<script type = "text\javascript" src =
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>
<script src ='resume.html'></script> // 'JSX expressions must have one parent element'
此.js文件出现问题。我应该使用cdn加载jquery,从我已读取的所有资源中,该文件是在文件末尾的script标签中完成的。经过更多搜索后,我意识到我需要在标签中包含“ text \ javascript”作为类型,但这并不能解决我的任何错误。据我的搜索显示,我正确地加载了它。
我遇到的错误是“}预期的”,“ JSX表达式必须具有一个父元素”。我已经评论了这些错误在哪里。据我所知,任何帮助都将不胜感激,因为我没有遗漏括号...我所做的研究没有帮助。 在此先感谢!
答案 0 :(得分:1)
尝试将这些分号更改为逗号。
let sectionFlags = {
objective: true,
coursework: true,
education: true,
technicalSkills:true
};