Open dshgna opened 8 years ago
$(document).ready(...)
in index.html
(formerly home.html
), also in other files wherever needed.for.. of
but it showed error. So for array convention I used for(i=0;i<limits;i++)
problemList.js
but the work of making it JSON
is not - done.problemCode
in the place of id
, please comment whether I need to add an id
.loadpage()
, there is a problemTemplatePage.html
,when it is loaded function loadProblemData()
in loadProblems.js
is invoked to fill up the template page.Really loving how you are taking the initiative!
$(document).ready(...)
should be in the JS. For example:$(document).ready(function() {
navigationBar();
});
Having $(document).ready(...)
in both the js files included is not a problem.
for...of
may not be supported by your browser as its a recent construct, So a sequential for loop is perfectly fine here.problemCode
also works perfectly.
Great work so far Neha!
home.html It's better to use JQuery's
$(document).ready()
instead of JSonload()
. document.ready() is fired as soon as possible whileonload()
is called after all the page's content are loaded. More here.fetchProblems() Here, we have to iterate through an array of objects. In JS,
for...in
is meant to be used to iterate over properties of objects. To iterate over an array, it is best to use either the sequential for loop or the newly introducedfor...of
loop can be used. More on this hereDisplaying problem data from JSON file
Fix indentation - use Codepen's Tidy to get this done quickly