Sum
1.JavaScript 教程 - 网道 (wangdoc.com)
2.Node.js 教程 | 菜鸟教程 (runoob.com)
create by ChatGPT
Here’s a 2-week study plan to learn the basics of JavaScript and Node.js. This plan assumes you’re starting from scratch and want a solid foundation in both front-end JavaScript (which is the core language) and back-end Node.js (which builds on JavaScript for server-side development).
Week 1: JavaScript Basics
In the first week, you’ll focus on learning the core concepts of JavaScript, which is essential before moving to Node.js.
Day 1: Introduction to JavaScript
- What is JavaScript? Learn its role in web development.
- Setting up a basic JavaScript environment (using browser developer tools, or an online IDE like Replit or CodePen).
- First JavaScript program:
console.log("Hello, world!");
- Basic Syntax:
- Variables:
let
,const
,var
- Data types:
string
,number
,boolean
,null
,undefined
,object
,array
- Variables:
Resources:
- MDN JavaScript Guide: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
Day 2: Control Structures & Functions
- Conditionals:
if
,else
,else if
,switch
- Loops:
for
,while
,do while
- Functions:
- Function declaration
- Function expressions
- Arrow functions
- Parameters and return values
Resources:
- FreeCodeCamp JavaScript basics: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/
Day 3: Arrays & Objects
- Arrays: Creation, methods (
push
,pop
,shift
,unshift
,map
,filter
,reduce
) - Objects: Creation, accessing properties, methods,
for...in
loops - Array and object destructuring
Resources:
- MDN Arrays: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
- MDN Objects: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects
Day 4: Understanding Scope & Closures
- Scope: Global scope vs. local scope
- Function scope vs. block scope
- Closures: How closures work in JavaScript
Resources:
- JavaScript.info - Closures: https://javascript.info/closures
Day 5: Asynchronous JavaScript (Part 1)
- Callbacks: Introduction to callback functions
- setTimeout and setInterval: Handling timers
- Error handling with
try/catch
Resources:
- MDN Asynchronous Programming: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous
Day 6: Asynchronous JavaScript (Part 2)
- Promises: What are promises? How do they work?
- Chaining promises
- Async/Await: Simplifying promise handling with async functions
Resources:
- MDN Promises: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises
- Async/Await Tutorial: https://javascript.info/async-await
Day 7: Review & Practice
- Go over everything you’ve learned so far.
- Build a small project: Create a simple calculator, a to-do list app, or a number guessing game.
- Try solving problems on platforms like LeetCode, CodeWars, or HackerRank.
Week 2: Introduction to Node.js
Now that you have a good grasp of JavaScript basics, it’s time to dive into Node.js. This week will focus on setting up and using Node.js for server-side JavaScript development.
Day 8: Introduction to Node.js
- What is Node.js? Understand the concept of server-side JavaScript.
- Install Node.js: Download and install from nodejs.org.
- Your first Node.js app: Create a simple “Hello, World!” app using
console.log
. - Understanding
require
andmodule.exports
.
Resources:
- Node.js Docs: https://nodejs.org/en/docs/
Day 9: Working with the File System
- The
fs
module: Read and write files (fs.readFile
,fs.writeFile
) - The
path
module: Work with file and directory paths
Resources:
- Node.js File System Docs: https://nodejs.org/dist/latest-v16.x/docs/api/fs.html
Day 10: HTTP Module & Building a Basic Server
- The
http
module: Create a simple HTTP server usinghttp.createServer()
. - Request and Response objects: Handle GET and POST requests.
Resources:
- Node.js HTTP Docs: https://nodejs.org/dist/latest-v16.x/docs/api/http.html
Day 11: Introduction to Express.js
- What is Express.js? Learn about Express as a web framework for Node.js.
- Set up Express: Install via npm (
npm install express
). - Create a simple Express server: Set up routes and handle basic HTTP methods (GET, POST).
Resources:
- Express.js Docs: https://expressjs.com/en/starter/installing.html
Day 12: Working with APIs & JSON
- Handling JSON: Sending and receiving JSON in Express.
- Creating RESTful routes: Basic CRUD (Create, Read, Update, Delete) operations.
- Using
body-parser
: Parse incoming request bodies.
Resources:
- Express.js Routing: https://expressjs.com/en/starter/basic-routing.html
- Node.js Body Parser: https://www.npmjs.com/package/body-parser
Day 13: Databases with Node.js
- Introduction to MongoDB: Setting up a simple MongoDB database.
- Install and use MongoDB in a Node.js app using
mongoose
for object data modeling (ODM). - Basic CRUD operations with MongoDB.
Resources:
- MongoDB Node.js Driver Docs: https://www.mongodb.com/docs/drivers/node/current/
- Mongoose Docs: https://mongoosejs.com/docs/
Day 14: Review & Build a Simple Project
- Review: Go over the key topics you’ve learned in both JavaScript and Node.js.
- Build a simple project that combines everything you’ve learned. For example:
- A RESTful API with Express and MongoDB.
- A chat application using websockets (Socket.io).
Resources:
- Full-Stack Tutorial (JS, Node, Express, MongoDB): https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs
General Tips:
- Practice daily: Code regularly to reinforce learning.
- Debugging: Use
console.log()
and debugging tools to understand how your code is behaving. - Community: Join JavaScript and Node.js communities on platforms like StackOverflow, Reddit, or Discord for help when stuck.
By following this plan, you should have a solid understanding of both JavaScript and Node.js by the end of 2 weeks. You can then build upon this foundation with more advanced topics!