{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# JavaScript in `JupyterLite`\n", "\n", "![](https://jupyterlite.readthedocs.io/en/latest/_static/kernelspecs/javascript.svg)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Basics" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "2 + 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Standard streams" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "trusted": true }, "outputs": [], "source": [ "console.log('hello world')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "trusted": true }, "outputs": [], "source": [ "console.error('error')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## JavaScript specific constructs" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "trusted": true }, "outputs": [], "source": [ "const delay = 2000;\n", "\n", "setTimeout(() => {\n", " console.log('done');\n", "}, delay);" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "trusted": true }, "outputs": [], "source": [ "var str = \"hello world\"\n", "str.split('').forEach(c => {\n", " console.log(c)\n", "})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Markdown cells" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lorenz system of differential equations\n", "\n", "$$\n", "\\begin{aligned}\n", "\\dot{x} & = \\sigma(y-x) \\\\\n", "\\dot{y} & = \\rho x - y - xz \\\\\n", "\\dot{z} & = -\\beta z + xy\n", "\\end{aligned}\n", "$$\n" ] } ], "metadata": { "kernelspec": { "display_name": "JavaScript", "language": "javascript", "name": "javascript" }, "language_info": { "codemirror_mode": { "name": "javascript" }, "file_extension": ".js", "mimetype": "text/javascript", "name": "javascript", "nbconvert_exporter": "javascript", "pygments_lexer": "javascript", "version": "es2017" }, "toc-showcode": true }, "nbformat": 4, "nbformat_minor": 4 }