I would not say it's necessary to learn HTML and CSS before JavaScript, but it will be very good if you learn HTML and CSS before hopping on to JavaScript, as it will help you in clearing the basics and making your foundation strong that will help you in getting your concepts on JavaScript clear. Because in Front-End Web Development layers, HTML and CSS form the first two layers, and then JavaScript is the last layer, so you could consider HTML and CSS to be the precursor to making dynamic content through JavaScript.
Aspiring to become a Full Stack Developer? Check out the MEAN Stack course from Intellipaat which offers you dedicated instructor-led training and guided projects and exercises to help you master the concepts and become a practically skilled professional. Also, watch our YouTube video on HTML vs JavaScript, made by our expert team.