跳到正文
产品桌面工具TASTECAD图纸查看TASTEFILES文件管理TASTEFTP文件传输TASTESSH远程工作空间TASTEZIP压缩与解压TASTEWINM文件管理开发工具TASTECODERust 集成开发环境TASTESTUDIO集成开发与测试环境TASTEETL数据整合(ETL)服务器TASTEREMOTE远程桌面服务器TASTEGEO空间信息服务器TASTEMAIL邮件工作空间投资TASTESTOCK股票自动交易桌面应用开始使用下载文档购买全部产品
市场
资讯
技术资讯今日开发资讯开发文档编程语言RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartWeb 前端框架Next.jsReactVue.js · NuxtSvelteKitAngular服务端框架Spring BootDjangoFastAPIASP.NET CoreNestJS · Express应用与桌面框架TauriFlutterReact NativeElectron算法算法基础核心算法进阶算法实用算法
社区项目开发日志提示词AI 工具问题作品展示社区指南
合作技术传授网站构建桌面应用构建发布与支付流水线销售合作伙伴联系我们
服务远程桌面安装包定制
TASTEDEV
产品

桌面工具

TASTECAD复杂图纸,轻松打开TASTEFILES只要需要的文件,最快送达TASTEFTP让文件往来,干净利落TASTESSH你与服务器之间,连接更牢靠TASTEZIP压得更快,解得更稳TASTEWINM以键盘为主、用两个窗格整理文件的文件管理器

开发工具

TASTECODE在一个窗口中完成 Rust 应用的编辑、构建、调试和测试TASTESTUDIO从编辑到远程测试,再到经批准的 AI 修复TASTEETL边看数值,边搬数据

服务器

TASTEREMOTE在自己的服务器上运行的远程桌面TASTEGEO用 Rust 重新构建兼容 GeoServer 的空间信息服务器TASTEMAIL把邮件的主导权拿回自己手中

投资

TASTESTOCK何时、做什么——按你定下的规则运行的股票自动交易

开始使用

下载所有产品的最新版本文档各产品使用方法购买订阅与永久许可全部产品一览全部产品
全部产品
市场资讯
技术

资讯

今日开发资讯语言、框架、GitHub 与 AI 官方发布开发文档语言、框架与算法指南

编程语言

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

框架

Web 前端框架Next.jsReactVue.js · NuxtSvelteKitAngular
服务端框架Spring BootDjangoFastAPIASP.NET CoreNestJS · Express
应用与桌面框架TauriFlutterReact NativeElectron

算法

算法基础复杂度分析 · 排序 · 查找 · 基础数据结构 · 树与堆核心算法图遍历 · 最短路径与最小生成树 · 动态规划 · 贪心算法 · 分治法 · 回溯法进阶算法字符串算法 · 数学与数论 · 位运算 · 线段树 · 并查集实用算法编程面试解题策略 · LRU 缓存 · 限流 · 一致性哈希
查看全部开发文档
社区
项目发现开发者与作品开发日志决策与试错提示词可复用的指令AI 工具问题Claude、Codex、Gemini 的问题与变通办法作品展示已完成的成果社区指南我们如何公开构建
合作
技术传授用 Rust 和 egui 打造原生应用网站构建10 种语言、账户、文档与下载桌面应用构建Rust 和 egui,不用 WebView发布与支付流水线签名、MSI、deb、rpm、AppImage、哈希销售合作伙伴推荐即得 30%联系我们开发、合作与投资咨询
服务
远程桌面用浏览器连接你的电脑安装包定制只装需要的,设置预先放好
购买
ZH
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
登录
登录
TASTEDEV

从小工具到更好的开发。

support@tastedev.net支持 TASTEDEV
产品产品线购买文档下载市场客户支持
社区项目开发日志提示词AI 工具问题作品展示
政策关于我们隐私政策服务条款订阅条款退款政策社区规范
账户登录注册
访客
今天
昨天
累计浏览
公司名称
GXSOFT
法定代表人
CHOI YOUNG GU
营业执照号
853-44-00368
地址
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
电话
+82-10-4404-1523
电子邮件
whitecalvin@tastedev.net
个人信息保护负责人
CHOI YOUNG GU

© 2026 TASTEDEV产品信息以已验证的开发源码为准。已发布·持续改进

JavaScript 文档
JavaScript
Getting StartedSyntax BasicsTypes and DataModules and PackagesErrors and TestingKey Concepts: Async and Closures
讨论

JavaScript 指南 · 1/6

Getting Started

本章目前仅提供英文版。

JavaScript was born in the browser, but runtimes like Node.js have carried it to servers, command-line tools, build pipelines and desktop apps. This chapter shows the two places you will run code most often, then walks you through your first script, a new npm project and a comfortable editor setup.

Two runtimes, one language

The core language (variables, functions, arrays, Promises) behaves the same everywhere. What changes is the set of APIs around it: document exists only in the browser, while the fs module for reading files exists only in Node.js.

RuntimeGives youTypical use
Browserwindow, document, DOM eventsWeb pages and web apps
Node.jsFile system, network, process APIsServers, CLI tools, build scripts

Try it in the browser console

The quickest way to run JavaScript needs no install at all. In Chrome, Edge or Firefox, press F12 or Ctrl+Shift+I (Cmd+Option+I on macOS) and open the Console tab. Type a line, press Enter, and the result appears immediately.

console.log("Hello, JavaScript!");

const scores = [72, 95, 88];
scores.sort((a, b) => a - b);
console.log(scores); // [72, 88, 95]

document.title; // the current page title (browser only)

The console echoes the value of the last expression, which makes it ideal for quick experiments. Anything you type is lost on reload, though, so move longer code into a file.

Install Node.js

Node.js runs JavaScript outside the browser. Download an installer from nodejs.org; unless you have a reason not to, pick the LTS (long-term support) release. If you need to switch between versions, a version manager such as nvm, fnm or Volta makes that painless.

npm, the package manager, ships with Node.js. Confirm both are on your path:

node --version
npm --version

Run your first script

Create hello.js in any folder. process.argv holds the command-line arguments; the values you pass start at index 2.

// hello.js
const name = process.argv[2] ?? "world";
const now = new Date().toLocaleTimeString("en-US");

console.log(`Hello, ${name}! It is ${now}.`);

Run it by handing the file to node:

node hello.js
node hello.js Ada

# re-run automatically whenever the file changes (recent Node.js)
node --watch hello.js
对本章有疑问?
下一章Syntax Basics

Running node with no file opens the REPL, an interactive prompt much like the browser console. Leave it with .exit or by pressing Ctrl+C twice.

Create an npm project

Real projects start with a package.json, which records the project name, its dependencies and the commands you run often. npm init -y creates one with default answers.

mkdir my-app
cd my-app
npm init -y
npm install --save-dev prettier

After adding a start script by hand, the file looks roughly like this (default fields vary a little between npm versions):

{
  "name": "my-app",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "devDependencies": {
    "prettier": "^3.0.0"
  }
}

Installing packages creates a node_modules folder and a package-lock.json file. Keep node_modules out of Git by listing it in .gitignore, since it can always be rebuilt. Do commit package-lock.json: it pins exact versions so everyone installs the same thing.

Set up your editor

Visual Studio Code understands JavaScript out of the box, so autocomplete, go-to-definition and rename all work immediately. A few extensions make it better:

  • ESLint flags likely bugs and style problems as you type.
  • Prettier formats indentation, quotes and line breaks consistently.
  • Error Lens (optional) shows diagnostics inline next to the offending line.

Add // @ts-check to the top of a JavaScript file and VS Code will type-check it with the TypeScript engine. Describe types in JSDoc comments and mistakes surface before you run anything.

// @ts-check

/**
 * @param {number} price
 * @param {number} rate
 */
function withTax(price, rate) {
  return price * (1 + rate);
}

withTax("1000", 0.1); // the editor underlines the string argument

Summary

  • The browser console is the fastest way to experiment, with nothing to install.
  • With Node.js installed, node file.js runs a script and npm manages packages.
  • Projects begin with npm init -y; ignore node_modules, commit package-lock.json.
  • VS Code plus ESLint, Prettier and // @ts-check catches many beginner mistakes early.

0 条评论

热门评论最新优先

登录 · 登录后即可发表评论。