我可以创建什么(什么样的)项目来学习 JavaScript?

发布于 2024-08-27 01:58:44 字数 254 浏览 6 评论 0原文

我不久前开始学习 JavaScript。考虑到我在大学学过 Java、非常了解 php 并且我已经使用过 python 和 ruby​​,这是一种相当简单的编程语言。问题是,为了正确学习编程语言,我通常会创建一个项目。在javascript中,我只是不知道我可以创建什么样的项目——也就是说,一个不基于网络或与网络浏览器相关的项目。我可以创建 javascript shell 脚本吗?除了网络浏览器之外,JavaScript 还常用在哪些地方?

那么,有人可以给我一些想法吗?

I started learning JavaScript a while ago. It's a fairly easy programming language considering that I learned Java in university, that I know php pretty well and that I already played around with python and ruby. The problem is that to properly learn a programming language I usually create a project. In javascript, I just don't know what kind of project I could create - that is, a project that is not web-based or related to the web browser. Can I create javascript shell scripts? Where is javascript commonly used beside the web browsers?

So, can someone actually give me some ideas please?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

爱冒险 2024-09-03 01:58:44

我可以创建 javascript shell 脚本吗?

你打赌!

  • 在 Windows 上,您可以使用 cscript.exe 来完成此操作(您甚至可以设置一个文件扩展名 - 我使用 jx - 当您双击时它会自动运行)单击文件名或将其用作 shell 中的命令:只需将该文件扩展名与命令关联起来 "c:\WINDOWS\system32\cscript.exe" /e:JavaScript /nologo "%1" %*)。这(我仔细测量过)比使用 Windows 批处理语言要好大约 8000 万倍。关于。 (如果您不想使用 JScript——Microsoft 的 JavaScript 变体——您甚至可以选择,请参见下文。)
  • 在 *nix 上,可以将 shell 脚本设置为在任何已安装的解释器中运行(这就是#!... 行告诉命令解释器)。我希望如果你四处寻找,你会找到一些。
  • 在 Mac 上,您可能已在 /System/Library/ 中安装了 JavaScriptCore Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc
  • 对于以上所有内容,如果您愿意,可以安装 Rhino 和 Java,获得平台独立性并访问大量的库功能。 Rhino 有一个内置的 shell,或者您可以告诉它执行特定的 JavaScript 文件。它与 Java 进行互操作,因此如果您这样做,您就可以轻松访问 Java 可用的所有基本功能。

除了网络浏览器之外,JavaScript 还常用在哪些地方?

我用它在 Windows 上编写 shell 脚本。我还将它用作服务器端语言,例如在 Web 应用程序的服务器端部分。它还用于其他需要使用轻量级、功能强大的脚本语言的环境,例如 MongoDB< /a> shell环境(可以用它来查询MongoDB数据)和存储过程。

综上所述,编写基于浏览器的项目是学习该语言的一种丰富的交互式方式。

Can I create javascript shell scripts?

You bet!

  • On Windows, you can do this by using cscript.exe (you can even set up a file extension -- I use jx -- that automatically runs when you just double-click the filename or use it as a command in a shell: Just associate that file extension with the command "c:\WINDOWS\system32\cscript.exe" /e:JavaScript /nologo "%1" %*). This is (and I've measured carefully) about 80 milion times better than fighting with Windows' batch language. About. (And if you don't want to use JScript — Microsoft's variant of JavaScript — you even have options, see below.)
  • On *nix, a shell script can be set to run in any installed interpreter (that's what the #!... line at the top is telling the command interpreter). I expect you'll find a few if you search around.
  • On the Mac, you probably have JavaScriptCore installed in /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc
  • And on all of the above, if you like, you can install Rhino and Java and get platform independence and access to a huge range of library functionality. Rhino has a built-in shell, or you can tell it to execute a specific JavaScript file. It interoperates with Java, so if you do this, you have easy access to all essentially of the functionality available to Java.

Where is javascript commonly used beside the web browsers?

I use it for shell scripting on Windows. I also use it as a server-side language, for instance in the server-side part of a web application. It's also used in other environments where a lightweight, powerful scripting language is useful, such as in the MongoDB shell environment (you can use it to query MongoDB data) and stored procedures.

All of that said, writing a browser-based project is a rich, interactive way to learn the language.

踏月而来 2024-09-03 01:58:44

Windows 侧边栏小工具、Apple 的小部件和 Google 桌面小工具都是使用 HTML/JS/CSS 创建的。

我通过创建一些小型 Windows 侧边栏小工具来学习 Javascript。

入门

侧边栏参考

windows Sidebar Gadgets, Apple's Widgets, and Google Desktop Gadgets are all created using HTML/ JS/ CSS.

I learnt Javascript by creating a few small Windows Sidebar Gadgets.

Getting Started

Sidebar Reference

小伙你站住 2024-09-03 01:58:44

您可以使用 javascript 制作可以在 Web 浏览器沙箱之外运行的 HTA(HTML 应用程序)。
MSDN HTA 应用程序简介
HTML 应用程序的 Javascript 教程

You could use javascript to make HTA (HTML Applications) that can be run outside of the the web browser sandbox.
MSDN intro to HTA Applications
Javascript Tutorial on HTML Applications

眼眸里的快感 2024-09-03 01:58:44

您可以编写一个非阻塞 TCP 服务器。
Node.js 支持这一点。

You could write a non-blocking TCP server.
Node.js supports that.

枉心 2024-09-03 01:58:44

浏览器之外 JavaScript 的常见用途是 Windows 上的 WSH 脚本和 HTA 应用程序以及 Mac 上的仪表板小部件。

Common uses of javascript outside of browsers are WSH scripts and HTA applications on Windows and Dashboard widgets on Mac.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文