I've just read that WeakMaps take advantage of garbage collection by working exclusively with objects as keys, and that assigning an object to null is equivalent to delete it:
let planet1 = {name: 'Coruscant', city: 'Galactic City'};
let planet2 = {name: 'Tatooine', city: 'Mos Eisley'};
let planet3 = {name: 'Kashyyyk', city: 'Rwookrrorro'};
const lore = new WeakMap();
lore.set(planet1, true);
lore.set(planet2, true);
lore.set(planet3, true);
console.log(lore); // output: WeakMap {{…} => true, {…} => true, {…} => true}
Run Code Online (Sandbox Code Playgroud)
Then I set the …
我第一次收到来自 GitHub 的关于我的一些项目依赖项的潜在安全问题(标签:high-severity)的通知。这是示例消息:
在 package-lock.json 中发现的 url-parse 漏洞
这是建议的解决方案:
将 url-parse 升级到 1.4.3 或更高版本。例如:
"dependencies": {
"url-parse": ">=1.4.3"
}
Run Code Online (Sandbox Code Playgroud)
或者…
"devDependencies": {
"url-parse": ">=1.4.3"
}
Run Code Online (Sandbox Code Playgroud)
现在,我所做的只是npm outdated -g --depth=0根据官方文档在我的终端中运行并执行npm -g update命令来简单地检查任何过时的包(我也尝试使用 来定位依赖项本身npm update url-parse)。一些软件包已成功更新,但似乎没有找到导致问题的软件包。我是否应该通过添加建议的代码行来手动更新它:"url-parse": ">=1.4.3"?
最后,我应该在多大程度上关注此类警报?
谢谢!
我正在处理ES6中的Generator,从概念上讲,我想了解以下函数中发生的情况:
function* createNames() {
const people = [];
people.push(yield);
people.push(yield);
people.push(yield);
return people;
}
const iterator = createNames();
iterator.next('Brian');
iterator.next('Paul');
iterator.next('John');
iterator.next(); // output: ["Paul", "John", undefined]
Run Code Online (Sandbox Code Playgroud)
我的问题是:为什么忽略了第一次推送?数组不应该像people = ['Brian', 'John', 'Paul', undefined]吗?很抱歉这个愚蠢的问题,但是我真的很想能够完全掌握这个问题。提前致谢!
我正在使用WAVE(Web 可访问性评估工具)Chrome 扩展程序测试我的应用程序,并且我的<noscript>元素收到警告。具体来说,警告告诉我:“确保脚本化的内容是可访问的。内容将呈现给极少数用户,但如果使用,则必须是可访问的。”
现在,我一直在努力寻找可行的解决方案(尝试使用aria-hidden="true"),但似乎无法找到确定的解决方案。任何的想法?
编辑:我的<noscript>元素仅包含一串文本:“您需要启用 JavaScript 才能运行此应用程序。”
谢谢!
我最近开始尝试 Bulma 和 Fontawesome,我发现垂直和水平对齐图标很棘手。我的情况如下。
npm i bulma --save-dev;<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>;Run Code Online (Sandbox Code Playgroud)<div class="control has-icons-left has-icons-right"> <input class="input" type="text"> <span class="icon is-small is-left"> <i class="fas fa-map-pin"></i> </span> <span class="icon is-small is-right"> <i class="fas fa-check"></i> </span> </div>
这导致图标奇怪地与它们各自位置的左上角对齐。我试图通过将一个has-text-centered类附加到 span 元素来使它们居中,但这不起作用。任何解决方法?
ecmascript-6 ×2
javascript ×2
alignment ×1
bulma ×1
css ×1
dependencies ×1
font-awesome ×1
generator ×1
github ×1
html ×1
iterator ×1
noscript ×1
null ×1
security ×1
wai-aria ×1
weakmap ×1