Contents
Should I use JavaScript or jQuery?
Pure JavaScript can be faster for DOM selection/manipulation than jQuery as JavaScript is directly processed by the browser. jQuery has to be converted into JavaScript to make it run in a browser. All these can be done in JavaScript but we may have to write many lines of code.
Should I download jQuery or use CDN?
Using CDN is preferred as it improves the site performance. Yes, users accessing a site from behind strict firewall rules can face issues to access CDN urls. In that case you can download jQuery. I would advise using bower to install it so you can upgrade / maintain jQuery easily.
Can I learn JavaScript without CSS?
if you want to learn JavaScript without HTML and CSS, then you have come to the Right Place. Yes you can learn JavaScript without knowing much about other Language like HTML,CSS or PHP. Because HTML is a Markup Language, CSS is a Style Sheets Language and JavaScript is a interpreted, object-oriented Language.
Is it better to download or use CDN?
Use a CDN if you need a CDN. If your user is global and spread over a large area, or you have a lot of such content that you don’t want to store on your own server, that is when a CDN is useful. Globally, it can speed up access to your content if the server is closer to the user.
What’s the best way to use JavaScript in HTML?
Always place script files reference at the end of the body tag. Always separate JavaScript code from the HTML file. Always use === comparison. Always try to avoid Eval () because it decreases the performance.
What are the best practices for CSS and JavaScript?
Here are the best practices of JavaScript, CSS, and HTML. Choose short and meaningful but readable variable names. Avoid global variables whenever possible. Use one global object to encapsulate any global variables you really need. Always use var to declare your variables.
When to place JavaScript files in Your Solution?
While development you can place your JavaScript files in your solution because it is easy to test but in production don’t place your JavaScript files inside the solution rather you place the files in other server and give the relative path in your project, make sure that the JavaScript files content cannot be accessed by End-User.