Hi,
when i was on the reverse engineer phase of vanilla press i used a for of loop
i see you use a for loop, is it a reason for this ? as i found the for of loop much more simpler ( i also noticed that the for in loop doesn’t work, but i don’t know exactly why)
view.loadBlogPosts = function () {
var posts = model.getPosts(),
postsMarkup = document.createDocumentFragment(),
primaryContentEl = helpers.getPageContentEl();
for (var post of posts) {
postsMarkup.appendChild(view.createPostMarkup(post));
}
primaryContentEl.appendChild(postsMarkup);
};
and
model.getPost = function (slug) {
var posts = model.getLocalStore();
for (var post of posts) {
if(slug === post.slug){
return post;
}
}
return null;
};
well my code was much more messy, and i was stucked after the part of displaying all the posts (but super happy to get there alone!)