Build a simple website using HTML, CSS, and JavaScript is a very basic course offered by microsoft, but there are some useful tips that are worth noting down for speedy coding.
Use VS Code
In Visual Studio Code, you can also create files with the command code index.html main.css app.js. These files are immediately opened in the editor, saving you a step, but also requires you to save each file.
Assuming that you’re using Visual Studio Code, type code . in the command line to open the directory in that application.
In VS Code, select the index.html page and type html:5, then hit Enter (Return). It will generate the html skeleton.
noscript element
The
Strict Mode
As you get started with JavaScript, the initial focus is often working with numbers, math, text manipulation, dates, and storing information. Sometimes JavaScript makes assumptions about the type of data you enter; assignment, math, or logical equality can give you unexpected results. JavaScript tries to be friendly, make your code work, and provide you with a solution even if the result should be an error. To combat these shortcomings, you can activate strict mode, which reduces silent errors, improves performance, provides more warnings, and fewer unsafe features. You enter strict mode by adding 'use strict'; at the beginning of you js file.
Git
Git status
1 | git status |
displays current git status, such as what untracked files you have.
add
When you add files with Git, you’re preparing to record or stage the changes. Although you could add a single file, usually it’s best to stage all changes with the following command.
1 | git add . |
commit
After staging your changes, you can save them by committing. You add a message to the commit, so you know what changes occurred.
1 | git commit -m "Add new posts to source" |