Both JavaScript and JQuery have been around and are performing better.
Except JQuery, I haven’t accepted any other third party JavaScript frameworks or libraries. However recently, I have been drilling into AngularJS. I’m questioning, is Angular worth adding to projects?
After reading, AngularJS recursive templates, post, it appears Angular is bloated and expensive compared to native JavaScript.
I rewrote the post’s conclusion in Native JavaScript + JQuery. What I wrote isn’t the best and can be improved on, however I believe it to be sleeker and trimmer.
Conclusion, presently I wouldn’t include any Angular into projects. I would continue learning JavaScript and apply all the great JavaScript patterns.
Please compare what I offered and mention why Angular? Please I know about reinventing the wheel, but I’m not convinced.
View what they offered JSFiddle.
Below is what I thought would accomplish similar results.
DOM
<div id="ahhBetter"> </div>
JavaScript + JQuery
function doAgain(arry) { var s = "<ul>"; for (var i = 0; i < arry.length; i++) { s += "<li>" + arry[i].title + "</li>"; if (arry[i].categories) { s += doAgain(arry[i].categories); } } s += "</ul>" return s; } $("#ahhBetter").append(doAgain(items));
Data
var items = [{ title: 'Computers', categories: [{ title: 'Laptops', categories: [{ title: 'Ultrabooks' }, { title: 'Macbooks' }] }, { title: 'Desktops' }, { title: 'Tablets', categories: [{ title: 'Apple' }, { title: 'Android' }] } ] }, { title: 'Printers' } ];
This post is for the purpose of my notes only and sometimes a rant.
“I invented nothing new. I simply assembled the discoveries of other men behind whom were centuries of work. Had I worked fifty or ten or even five years before, I would have failed. So it is with every new thing. Progress happens when all the factors that make for it are ready and then it is inevitable. To teach that a comparatively few men are responsible for the greatest forward steps of mankind is the worst sort of nonsense.”
Henry Ford
No comments:
Post a Comment