Scaffolded pages
This commit is contained in:
Родитель
8b0639edd8
Коммит
d05661f852
|
@ -0,0 +1,8 @@
|
|||
# Installing your toolkit
|
||||
|
||||
To start writing JavaScript on [Node.js](https://nodejs.org/) you will need a couple of tools. In particular, you'll need the Node.js runtime and a code editor.
|
||||
|
||||
- [Visual Studio Code](https://code.visualstudio.com?WT.mc_id=beginner-ch9-niner)
|
||||
- [Set up your Node.js development environment directly on Windows](https://docs.microsoft.com/en-us/windows/nodejs/setup-on-windows?WT.mc_id=beginner-ch9-niner)
|
||||
- [Set up your Node.js development environment with WSL 2](https://docs.microsoft.com/en-us/windows/nodejs/setup-on-wsl2)
|
||||
- [Node Version Manager](https://github.com/nvm-sh/nvm/blob/master/README.md)
|
|
@ -0,0 +1,8 @@
|
|||
# Creating your first Node.js application
|
||||
|
||||
When you're learning a programming language for the first time, convention is to write [Hello, world](https://en.wikipedia.org/wiki/%22Hello,_World!%22_program). We're not one to break from tradition, so we did the same with a couple of extra flourishes.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [Get started using Node.js on Windows for beginners](https://docs.microsoft.com/en-us/windows/nodejs/beginners)
|
||||
- [console.log](https://nodejs.org/dist/latest-v12.x/docs/api/console.html#console_console_log_data_args)
|
|
@ -0,0 +1,7 @@
|
|||
# Comments
|
||||
|
||||
[Comments](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Comments) give you the ability to leave notes about what your code is doing. It's also a powerful tool for leaving yourself notes, which is a wonderful for learning code!
|
||||
|
||||
## Further reading
|
||||
|
||||
- [Comments](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Comments)
|
|
@ -0,0 +1,9 @@
|
|||
# Variables
|
||||
|
||||
Variables are placeholders for information you'll use in your application. These could be relatively small like a number, or large like complex objects. Regardless of the data the variable will store you'll declare them all the same. What will change is where you'd like the variable to exist and the ability to modify it.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [const](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const)
|
||||
- [let](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let)
|
||||
- [var](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var)
|
|
@ -0,0 +1,8 @@
|
|||
# Strings
|
||||
|
||||
Strings in JavaScript are collections of zero or more characters. Working with strings is one of the core skills all developers need. Fortunately, JavaScript provides a host of ways for manipulating and working with strings.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)
|
||||
- [Template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
|
|
@ -0,0 +1,7 @@
|
|||
# Datatypes
|
||||
|
||||
JavaScript is [weakly typed](https://wikipedia.org/wiki/Strong_and_weak_typing), meaning it does not store the datatype while you are writing your code. However, it does support numerous data types and maintains what datatype a variable is storing at runtime. You can even query a variable to determine the datatype.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [typeof](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof)
|
|
@ -0,0 +1,7 @@
|
|||
# Numbers and math
|
||||
|
||||
It can be said a computer is nothing but a fancy calculator. We'll leave it up to you to debate the validity of the saying, but there's no denying math is one of the most common operations you'll perform. JavaScript has a full suite of options available to you.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [Math](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math)
|
|
@ -0,0 +1,7 @@
|
|||
# Catching errors with try/catch/finally
|
||||
|
||||
Whenever your code executes there's a chance something can go wrong, especially if you're communicating with external systems. By using `try`/`catch`/`finally` you can allow your code to catch errors and properly handle them.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [try/catch/finally](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch)
|
|
@ -0,0 +1,7 @@
|
|||
# Dates
|
||||
|
||||
Dates can be a little tricky to work with in code. You often want to be able to perform math, handle conversions, and other operations. JavaScript provides a `Date` object to give you access to dates and times.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
|
|
@ -0,0 +1,8 @@
|
|||
# Boolean logic
|
||||
|
||||
At the core of any application is making decisions. You can manage branching logic in JavaScript with an `if`/`else` or `switch`/`case` statement.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [if/else](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else)
|
||||
- [switch](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch)
|
|
@ -0,0 +1,7 @@
|
|||
# Arrays
|
||||
|
||||
Arrays provide the ability to gather a list of items. You can add and remove items, modify individual ones, or even loop through them all.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)
|
|
@ -0,0 +1,9 @@
|
|||
# Loops
|
||||
|
||||
JavaScript offers numerous ways to execute code multiple times and act upon collections of data. Fortunately, there's three key ones which will serve you well and cover most every situation you'll encounter: `for`, `for of`, and `while`.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [for](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for)
|
||||
- [for of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of)
|
||||
- [while](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while)
|
|
@ -0,0 +1,7 @@
|
|||
# Functions
|
||||
|
||||
Functions or methods allow you to create blocks of reusable code. Using functions makes your code more modular and easier to read. Don't be afraid to add functions to break your code into logical pieces.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [Functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions)
|
|
@ -0,0 +1,7 @@
|
|||
# Arrow functions
|
||||
|
||||
Anonymous functions, which are sometimes called arrow or fat arrow functions, allow you to create functions without a name. This can be useful when using callbacks and promises, which are common in JavaScript.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [Functions](https://developer.mozilla.org/en-US/docs/Glossary/Function)
|
|
@ -0,0 +1,8 @@
|
|||
# Objects and JSON
|
||||
|
||||
Objects allow you to create complex datatypes. Because of JavaScript's flexibility, you can create them on the fly through JavaScript Object Notation or JSON.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [Objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
||||
- [JSON](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON)
|
|
@ -0,0 +1,13 @@
|
|||
# Asynchronous code
|
||||
|
||||
Modern app development involves communicating with other systems. These communications can take time, and can cause your application to pause unable to perform other operations.
|
||||
|
||||
JavaScript is able to manage long running operations through the use of **promises**. A **promise** is similar to an [IOU](https://wikipedia.org/wiki/IOU); the code is promising it will let you know when it completes and execute the function you provide. You can use promises directly to specify how you want your code to respond when a call to a remote system returns.
|
||||
|
||||
Recently, a new pattern has emerged. Building upon promises, `async`/`await` allows you to create code which looks synchronous yet is asynchronous. This helps make code more readable while still taking allowing for better performance.
|
||||
|
||||
## Further reading
|
||||
|
||||
- [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
||||
- [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)
|
||||
- [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await)
|
|
@ -0,0 +1,13 @@
|
|||
# Packages
|
||||
|
||||
Packages can be thought of plug-ins for your code. Sometimes called libraries or modules, packages offer a defined set of functionality you can import into your application. You will find it's almost impossible to create an application which doesn't use multiple packages.
|
||||
|
||||
By using **npm** (Node Package Manager) you can access an entire world of tools and resources. If you are trying to implement common services like creating a web application, managing secrets, calling external resources, or incorporating artificial intelligence, chances are there's a package available to suit your needs.
|
||||
|
||||
## Further readings
|
||||
|
||||
- [npm](https://www.npmjs.com/)
|
||||
- [dotenv](https://www.npmjs.com/package/dotenv)
|
||||
- [express](http://expressjs.com/)
|
||||
- [Bot Framework](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-overview-introduction?view=azure-bot-service-4.0)
|
||||
- [JavaScript Azure Cognitive Services modules](https://docs.microsoft.com/en-us/javascript/api/overview/azure/cognitive-services?view=azure-node-latest)
|
Загрузка…
Ссылка в новой задаче