<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>LinuxSir.cn，穿越时空的Linuxsir! - Javascript文档</title>
    <link>http://linuxsir.cn/forum.php?mod=forumdisplay&amp;fid=243</link>
    <description>Latest 20 threads of Javascript文档</description>
    <copyright>Copyright(C) LinuxSir.cn，穿越时空的Linuxsir!</copyright>
    <generator>Discuz! Board by Comsenz Inc.</generator>
    <lastBuildDate>Wed, 15 Apr 2026 00:58:41 +0000</lastBuildDate>
    <ttl>60</ttl>
    <image>
      <url>http://linuxsir.cn/static/image/common/logo_88_31.gif</url>
      <title>LinuxSir.cn，穿越时空的Linuxsir!</title>
      <link>http://linuxsir.cn/</link>
    </image>
    <item>
      <title>十六进制，二进制和八进制数字</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=400068</link>
      <description><![CDATA[十六进制 数字在 JavaScript 中被广泛用于表示颜色，编码字符以及其他许多东西。所以自然地，有一种较短的写方法：0x，然后是数字。

例如：

alert( 0xff ); // 255
alert( 0xFF ); // 255（一样，大小写没影响）
二进制和八进制数字系统很少使用，但也支持使用 0b 和  ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Mon, 19 Feb 2024 15:04:07 +0000</pubDate>
    </item>
    <item>
      <title>可达性（Reachability）</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=400067</link>
      <description><![CDATA[JavaScript 中主要的内存管理概念是 可达性。

简而言之，“可达”值是那些以某种方式可访问或可用的值。它们一定是存储在内存中的。

这里列出固有的可达值的基本集合，这些值明显不能被释放。

比方说：

当前执行的函数，它的局部变量和参数。
当前嵌套调用链上的其 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Mon, 19 Feb 2024 15:03:18 +0000</pubDate>
    </item>
    <item>
      <title>深层克隆</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=400066</link>
      <description><![CDATA[到现在为止，我们都假设 user 的所有属性均为原始类型。但属性可以是对其他对象的引用。

例如：

let user = {
  name: \&quot;John\&quot;,
  sizes: {
    height: 182,
    width: 50
  }
};

alert( user.sizes.height ); // 182
现在这样拷贝 clone.sizes = user.sizes 已经不 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Mon, 19 Feb 2024 15:02:52 +0000</pubDate>
    </item>
    <item>
      <title>自动检查器</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=400065</link>
      <description><![CDATA[检查器（Linters）是可以自动检查代码样式，并提出改进建议的工具。它们的妙处在于进行代码风格检查时，还可以发现一些代码错误，例如变量或函数名中的错别字。因此，即使你不想坚持某一种特定的代码风格，我也建议你安装一个检查器。下面是一些最出名的代码检查工具：
 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Mon, 19 Feb 2024 15:02:12 +0000</pubDate>
    </item>
    <item>
      <title>箭头函数</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=400064</link>
      <description><![CDATA[创建函数还有另外一种非常简单的语法，并且这种方法通常比函数表达式更好。

它被称为“箭头函数”，因为它看起来像这样：

let func = (arg1, arg2, ..., argN) =&gt; expression;
这里创建了一个函数 func，它接受参数 arg1..argN，然后使用参数对右侧的 expression 求值 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Mon, 19 Feb 2024 15:00:37 +0000</pubDate>
    </item>
    <item>
      <title>undefined 值</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=400053</link>
      <description><![CDATA[特殊值 undefined 和 null 一样自成类型。

undefined 的含义是 未被赋值。

如果一个变量已被声明，但未被赋值，那么它的值就是 undefined：

let age;

alert(age); // 弹出 \&quot;undefined\&quot;
从技术上讲，可以显式地将 undefined 赋值给变量：

let age = 100;

// 将值修 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Sun, 18 Feb 2024 15:24:41 +0000</pubDate>
    </item>
    <item>
      <title>回调函数</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=400052</link>
      <description><![CDATA[让我们多举几个例子，看看如何将函数作为值来传递以及如何使用函数表达式。

我们写一个包含三个参数的函数 ask(question, yes, no)：

question
关于问题的文本
yes
当回答为 “Yes” 时，要运行的脚本
no
当回答为 “No” 时，要运行的脚本
函数需要提出 question（问 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Sun, 18 Feb 2024 15:23:54 +0000</pubDate>
    </item>
    <item>
      <title>正确命名变量</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=400051</link>
      <description><![CDATA[谈到变量，还有一件非常重要的事。

一个变量名应该有一个清晰、明显的含义，对其存储的数据进行描述。

变量命名是编程过程中最重要且最复杂的技能之一。快速地浏览变量的命名就知道代码是一个初学者还是有经验的开发者写的。

在一个实际项目中，大多数的时间都被用来 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Sun, 18 Feb 2024 15:23:17 +0000</pubDate>
    </item>
    <item>
      <title>后备的默认参数</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=400050</link>
      <description><![CDATA[有些时候，将参数默认值的设置放在函数执行（相较更后期）而不是函数声明时，也行得通。

我们可以通过将参数与 undefined 进行比较，来检查该参数是否在函数执行期间被传递进来：

function showMessage(text) {
  // ...

  if (text === undefined) { // 如果参数未 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Sun, 18 Feb 2024 15:22:37 +0000</pubDate>
    </item>
    <item>
      <title>严格相等</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=400049</link>
      <description><![CDATA[普通的相等性检查 == 存在一个问题，它不能区分出 0 和 false：

alert( 0 == false ); // true
也同样无法区分空字符串和 false：

alert( \'\' == false ); // true
这是因为在比较不同类型的值时，处于相等判断符号 == 两侧的值会先被转化为数字。空字符串和 false 也 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Sun, 18 Feb 2024 15:21:52 +0000</pubDate>
    </item>
    <item>
      <title>浏览器控制台</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=400048</link>
      <description><![CDATA[当你使用 开发者控制台 运行代码时，请注意它默认是不启动 use strict 的。

有时，当 use strict 会对代码产生一些影响时，你会得到错误的结果。

那么，怎么在控制台中启用 use strict 呢？

首先，你可以尝试搭配使用 Shift+Enter 按键去输入多行代码，然后将 use st ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Sun, 18 Feb 2024 15:21:17 +0000</pubDate>
    </item>
    <item>
      <title>当作对象的原始类型</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399989</link>
      <description><![CDATA[以下是 JavaScript 创建者面临的悖论：

人们可能想对诸如字符串或数字之类的原始类型执行很多操作。最好使用方法来访问它们。
原始类型必须尽可能的简单轻量。
而解决方案看起来多少有点尴尬，如下：

原始类型仍然是原始的。与预期相同，提供单个值
JavaScript 允许访 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Sat, 03 Feb 2024 15:23:58 +0000</pubDate>
    </item>
    <item>
      <title>计算属性</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399988</link>
      <description><![CDATA[创建一个对象时，我们可以在对象字面量中使用方括号。这叫做 计算属性。

例如：

let fruit = prompt(\&quot;Which fruit to buy?\&quot;, \&quot;apple\&quot;);

let bag = {
  [fruit]: 5, // 属性名是从 fruit 变量中得到的
};

alert( bag.apple ); // 5 如果 fruit=\&quot;apple\&quot;
计算属性的含 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Sat, 03 Feb 2024 15:23:13 +0000</pubDate>
    </item>
    <item>
      <title>Symbol.iterator</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399952</link>
      <description><![CDATA[通过自己创建一个对象，我们就可以轻松地掌握可迭代的概念。

例如，我们有一个对象，它并不是数组，但是看上去很适合使用 for..of 循环。

比如一个 range 对象，它代表了一个数字区间：

let range = {
  from: 1,
  to: 5
};

// 我们希望 for..of 这样运行：
// for ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Thu, 01 Feb 2024 14:23:27 +0000</pubDate>
    </item>
    <item>
      <title>带有 “get” 捕捉器的默认值</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399951</link>
      <description><![CDATA[最常见的捕捉器是用于读取/写入的属性。

要拦截读取操作，handler 应该有 get(target, property, receiver) 方法。

读取属性时触发该方法，参数如下：

target —— 是目标对象，该对象被作为第一个参数传递给 new Proxy，
property —— 目标属性名，
receiver ——  ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Thu, 01 Feb 2024 14:12:40 +0000</pubDate>
    </item>
    <item>
      <title>我应该使用默认的导出吗？</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399950</link>
      <description><![CDATA[命名的导出是明确的。它们确切地命名了它们要导出的内容，因此我们能从它们获得这些信息，这是一件好事。

命名的导出会强制我们使用正确的名称进行导入：

import {User} from \'./user.js\';
// 导入 {MyUser} 不起作用，导入名字必须为 {User}
……对于默认的导出，我 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Thu, 01 Feb 2024 14:11:50 +0000</pubDate>
    </item>
    <item>
      <title>变音符号和规范化</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399949</link>
      <description><![CDATA[很多语言都有由基础字符及其上方/下方的标记所组成的符号。

举个例子，字母 a 就是这些字符 àáâäãåā 的基础字符。

大多数常见的“复合”字符在 Unicode 表中都有自己的编码。但不是所有这些字符都有自己的编码，因为可能的组合形式太多了。

为了支持任意的组 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Thu, 01 Feb 2024 14:11:14 +0000</pubDate>
    </item>
    <item>
      <title>数学运算符</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399948</link>
      <description><![CDATA[BigInt 大多数情况下可以像常规数字类型一样使用，例如：

alert(1n + 2n); // 3

alert(5n / 2n); // 2
请注意：除法 5/2 的结果向零进行舍入，舍入后得到的结果没有了小数部分。对 bigint 的所有操作，返回的结果也是 bigint。

我们不可以把 bigint 和常规数字类型混 ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Thu, 01 Feb 2024 14:10:33 +0000</pubDate>
    </item>
    <item>
      <title>重置样式属性</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399947</link>
      <description><![CDATA[有时我们想要分配一个样式属性，稍后移除它。

例如，为了隐藏一个元素，我们可以设置 elem.style.display = \&quot;none\&quot;。

然后，稍后我们可能想要移除 style.display，就像它没有被设置一样。这里不应该使用 delete elem.style.display，而应该使用 elem.style.display =  ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Thu, 01 Feb 2024 14:09:53 +0000</pubDate>
    </item>
    <item>
      <title>浏览器默认行为</title>
      <link>http://linuxsir.cn/forum.php?mod=viewthread&amp;tid=399946</link>
      <description><![CDATA[有很多默认的浏览器行为：

mousedown —— 开始选择（移动鼠标进行选择）。
在  上的 click —— 选中/取消选中的 input。
submit —— 点击  或者在表单字段中按下 Enter 键会触发该事件，之后浏览器将提交表单。
keydown —— 按下一个按键会导致将字符添加到字段， ...]]></description>
      <category>Javascript文档</category>
      <author>一起看海</author>
      <pubDate>Thu, 01 Feb 2024 14:09:05 +0000</pubDate>
    </item>
  </channel>
</rss>