JavaScript (like most programming languages) has mutltiple runtimes, each of which is a full implementation of the language and supporting libraries. With JavaScript, the two implementations (runtimes) that we care about are V8 (used in Chrome, and also the Node.js runtime) and Spidermonkey (used in Firefox).
const readline = require('readline');
const fs = require('fs');
let dictionary = [];
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
function askQuestion() {
rl.question('What would you like to spell check? ', (answer) => {
let wordsToCheck = answer.split(' ');
let result = [];
for (let i =0; i < wordsToCheck.length; i++) {
if (dictionary.includes(wordsToCheck[i])) {
result.push(wordsToCheck[i]);
} else {
result.push("*" + wordsToCheck[i] + "*");
}
}
rl.close();
console.log(result.join(' '));
});
}
fs.readFile('dictionary.txt', 'utf8', (err, data) => {
if (err) {
console.log(err);
return;
}
console.log(data);
dictionary = data.split('\n');
//using callback chaining
askQuestion();
});
This will create a .git
hidden folder inside your new repository.
Git is a distributed version control system that allows us to build up patch sets and changes.
GitHub is a company that provides git repository hosting as well as project management features like code review, issues, wiki, etc.
Adding to Staging:
git diff --cached
Committing:
git commit
to create a commit from all the changes that are currently in stagingPushing to Remote:
After discovering the repository url (from GitHub, Bitbucket, etc. or if someone sends you a link to their privately hosted git repository)
The changes tracked by your local branch called branch_name
can be pushed to any remote with the git push
command.
Assuming you are working on an existing project. First create a branch
Make your changes, add them and commit them
Push your newly created branch.
Then point your browser at the GitHub repository, and follow the onscreen prompts to create a pull request.
Once you’ve done the mental work of correcting the conflicting errors, use git add
and git commit
to commit the resolved code.
Hard (git reset --hard <ref>
):
Soft (git reset --soft <ref>
):
Mixed (git reset <ref>
):
git rebase
allows us to rewrite the history of the current branch my changing commit contents, or adding commits to our history and replaying all the commits since that moment on top of them. Rebase allows us to clean up mistakes in our history, or to avoid adding “merge commits” by adding the commits from another branch into our branches’ history.
This will leave your git repository in a “headless” state, which you cannot apply commits on top of.