https://boilerplate-npm.emabeee.repl.co
How to Use package.json, the Core of Any Node.js Project or npm Package
"author": "emalie",
Add a Description to Your package.json
https://boilerplate-npm.emabeee.repl.co
How to Use package.json, the Core of Any Node.js Project or npm Package
"author": "emalie",
Add a Description to Your package.json
API: Awesome JSON Datasets, Emojis
pm.test("Status test", function () {
pm.response.to.have.status(200);
});Results: passed
It's pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You're given one parameter, the original string. You don't have to worry with strings with less than two characters.
function removeChar(str) {
return str.slice(1, str.length - 1)
}Network Requests: how javascript loads new information when it is needed.
AJAX: Asynchronous JavaScript And XML; umbrella term for network requests from JavaScript.
There are multiple ways to send a network request and get information from the server.
fetch() method
let promise = fetch(url, [options])Callback Function: The action is started, and when it finishes, the callback function is called with the result.
Example: setTimeout function waits a given number of milliseconds (a second is a thousand milliseconds) and then calls a function. setTimeout(() => console.log("Tick"), 500);
To implement asynchronous code we use callbacks and promises in JavaScript.
Callbacks:
A callback is a function passed as an argument to another function. This technique allows a function to call another function. A callback function can run after another function has finished. JavaScript functions are executed in the sequence they are called. Not in the sequence they are defined.
Sequence Control Sometimes you would like to have better control over when to execute a function. Suppose you want to do a calculation, and then display the result. You could call a calculator function (myCalculator), save the result, and then call another function (myDisplayer) to display the result. Or, you could call a calculator function (myCalculator), and let the calculator function call the display function (myDisplayer) The problem with the first example above, is that you have to call two functions to display the result. The problem with the second example, is that you cannot prevent the calculator function from displaying the result. This is when you use a callback.
function myDisplaThe theory of async JavaScript helps you break down big complex projects into smaller tasks.
In a synchronous system, tasks are completed one after another. Like you have one hand to complete 10 tasks so you have to do them one at a time. JavaScript is by default Synchronous [single threaded] – one thread means one hand with which to do stuff. Example: Synchronous system, three images are in the same lane. One can't overtake the other. The race is finished one by one. If image number 2 stops, the following image stops.
console.log(" I ");Both Chrome and Firefox have excellent JavaScript consoles, also known as DevTools, for debugging your JavaScript.
You can find Developer tools in your Chrome's menu or Web Console in Firefox's menu. If you're using a different browser, or a mobile phone, we strongly recommend switching to desktop Firefox or Chrome.
The console.log() method, which "prints" the output of what's within its parentheses to the console, will likely be the most helpful debugging tool. Placing it at strategic points in your code can show you the intermediate values of variables. It's good practice to have an idea of what the output should be before looking at what it is. Having check points to see the status of your calculations throughout your code will help narrow down where the problem is.
Here's an example to print the string Hello world! to the console:
console.log('Hello world!');
Use the console.log() method to print the value of the variable a where noted in t