I've been watching tutorials and I've seen two methods to add new elements to the document. One way is to createElement in javascript and then assign classes/id to it or do whatever you want. This way the element is "in memory"...at least that's what was said in the tutorial. The other way is creating the element in CSS and then using display:none, later using JS to change display to block/inline.
Which method is better? or is it a scenario kind of answer? What are the perks of both? Or are they the same and it's just based on preference?
Sorry if this is a duplicate question, I didn't know what the methods were called.