v8

v8

好久不见. 提交于 2019-12-09 00:28:31
V8 - 开源,由Google开发,用C ++编写 Rhin- 由Mozilla基金会开源,完全用Java开发 SpiderMonkey 第一个JavaScript引擎,Netscape Navigator,Firefox JavaScriptCore 苹果公司为Safari开发 KJS 最初由Harri Porten为KDE项目的Konqueror网络浏览器开发 Chakra** (JScript9) Microsoft Edge Chakra** (JavaScript) Microsoft IE9-IE11 Nashorn 作为OpenJDK的一部分,由Oracle Java语言和工具组编写 JerryScript 一个物联网的轻量级引擎 链接:https://www.jianshu.com/p/81f6ded64ab2 来源: https://www.cnblogs.com/hshy/p/12008753.html

Async Function in Getter w/ Return in Callback

末鹿安然 提交于 2019-12-08 19:28:44
问题 I want to define a read-only object property that asynchronously fetches a value and then returns it using the new EcmaScript 5 getters. However, the property always returns undefined even though magicValue in the example code below is definitively never undefined. Also, when I just return 'xxx'; the printed value is still undefined . It only works when I return outside the callback function. It seems like return is being executed immediately regardless of whether the callback of

Why is __proto__ undefined?

ε祈祈猫儿з 提交于 2019-12-08 17:05:24
问题 While reading on Javascript's prototypes I encountered this behaviour I can't explain. I am testing this in chrome's console (which is V8). var fruit = {taste:'good'}; var banana = Object.create(fruit); console.log(banana.taste); //"good" console.log(banana.__proto__); //Object {taste: "good"} console.log(Object.getPrototypeOf(banana)); //Object {taste: "good"} So far everything is as expected. However if I do this: var drink = Object.create(null); Object.defineProperty(drink, 'taste', {value

NodeJS String format like Python?

泪湿孤枕 提交于 2019-12-08 17:05:24
问题 In python, I can do the following: name = "bob" print("Hey, %s!" % name) Is there anything similar to that (or Python's .format() ) in JavaScript/NodeJS? 回答1: sprintf should do what you are asking for I think. 回答2: You can use util.format, it's printf like function. 回答3: Another option is template strings For example: const name = "bob"; console.log(`Hey, ${name}!`); 来源: https://stackoverflow.com/questions/10788408/nodejs-string-format-like-python

get all values of the closure in node.js or V8

我是研究僧i 提交于 2019-12-08 17:00:52
问题 For example, if we assume the following code: var f = function() { return 'hello world' }; var x = 10; var y = 314; var g = function() { var buf = [], xx = x; while (xx--) buf.append(f() + ' '); return buf.join(''); } I can get the actual "code" as a string of g with g.toString() . However, this does not (obviously) get f and x —members of the closure of g (sorry if I'm not quite using these terms correctly.) Is there some way to query a function for what its closure contains? Ideally I could

How to understand “hasOwnProperty” and “__proto__” in Js?

旧城冷巷雨未停 提交于 2019-12-08 05:44:32
问题 In ECMAScript,there is not __proto__ of an object: Array.hasOwnProperty('prototype') //true var arr = new Array() arr.hasOwnProperty('__proto__') //false then, we can find: Object.getOwnPropertyDescriptors(arr) Output: length:{value: 1, writable: true, enumerable: false, configurable: false} __proto__:Object So, I am confused: Does arr has his own property __proto__ ? When I try to do follow things: arr.unshift("2") Where does Js engine find unshift method? Is there any information let Js

Nodeclipse debugger ignoring breakpoints

混江龙づ霸主 提交于 2019-12-08 03:30:48
问题 I'm using Nodeclipse 0.10 with nodemon, but when I try to debug my script it doesn't stop at any of my breakpoints. I've already seen this and this answer but it hasn't helped. Occasionally, it will stop on the first line of nodemon, other times it gives me a timeout error from the V8 VM, and sometimes it doesn't do anything at all. Here's what I've tried so far: I tried both the "Node application" and the "Node with monitor", neither one works. Removed nodemon from the preferences page, but

Difficulty installing therubyracer 0.10.2 and apple-gcc42 on Mac OSX 10.12.6 Sierra

纵饮孤独 提交于 2019-12-08 03:12:14
问题 The answer to this similar question doesn't solve my problem. Here is the answer from that question: If you decide to use a newer therubyracer gem version, you will no longer have this problem Otherwise: brew tap homebrew/dupes # Thanks Tom brew install apple-gcc42 export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 export CXX=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/g++-4.2 export CPP=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/cpp-4.2 brew uninstall v8 gem uninstall

Array destructuring assignment not working in v8 with harmony option in Node.js

筅森魡賤 提交于 2019-12-08 01:04:34
问题 I want to learn how to enable harmony v8 options in Node, and my node version is: $ node -v v5.5.0 Use ES6 destructuring as an example for testing $ cat destructure.js 'use strict' var a, b [a, b] = [1, 2] console.log(a, b) Run it straight gets error as expected. $ node destructure.js /usr/home/mko_io/pure-js-files/destructure.js:3 [a, b] = [1, 2] ^^^^^^ But get the same error, after the flag has been set: $ node --harmony_destructuring destructure.js /usr/home/mko_io/pure-js-files

Different result from JavaScript RegExp in “rhino1.7.6” vs “V8”

让人想犯罪 __ 提交于 2019-12-07 22:58:03
问题 currently, I found the same JavaScript RegExp might generate different result in different JavaScript Engines, here is an example: In Chrome V8 JS engine, /\x3c/.test("\x3c") --> returns true /\x3c/.test(function() { return "\x3c" }) -->returns ***false*** In rhino1.7.6,I typed the command like this: >java -jar js.jar Rhino 1.7.6 2015 04 15 js> /\x3c/.test(function() { return "\x3c" }) true js> And I tested these two: /\x3c/.test("\x3c") --> returns true /\x3c/.test(function() { return "\x3c"