简介
据MDN文档所说内部属性是由 [[···]]
包裹的内容,于是我们去复制 ECMA-262 标准的所有文字部分,然后用正则统计 [[···]]
的出现并打印
效果
代码
经老大提醒,这里的正则并不能完整匹配字母
'use strict';
let re = /\[\[[A-z]+\]\]/g;
let f = ()=>{
let m = new Map()
for (const x of a.match(re)) {
let t = m.get(x) || 0
m.set(x,++t)
}
let arr = []
for (const [k,v] of m) {
arr.push({k,v})
}
arr.sort((a,b)=>{
return b.v - a.v
})
// console.log(arr.map(x=>JSON.stringify(x)).join('\n'))
console.log(arr.slice(0,25));
}
var a = `Reference number...(注意这里要自己去粘贴,方法就是下载pdf全选复制)`
f();
所以结果呢??
{"k":"[[Value]]","v":276}
{"k":"[[Configurable]]","v":232}
{"k":"[[Writable]]","v":218}
{"k":"[[Enumerable]]","v":212}
{"k":"[[Prototype]]","v":119}
{"k":"[[Type]]","v":86}
{"k":"[[Status]]","v":77}
{"k":"[[Get]]","v":74}
{"k":"[[Set]]","v":73}
{"k":"[[Done]]","v":70}
{"k":"[[Key]]","v":65}
{"k":"[[GetOwnProperty]]","v":61}
{"k":"[[Call]]","v":60}
{"k":"[[Construct]]","v":57}
{"k":"[[ViewedArrayBuffer]]","v":54}
{"k":"[[GetPrototypeOf]]","v":44}
{"k":"[[DefineOwnProperty]]","v":42}
{"k":"[[TypedArrayName]]","v":42}
{"k":"[[ArrayLength]]","v":39}
{"k":"[[ArrayBufferData]]","v":38}
{"k":"[[Promise]]","v":37}
{"k":"[[OwnPropertyKeys]]","v":34}
{"k":"[[Delete]]","v":33}
{"k":"[[Realm]]","v":32}
{"k":"[[Target]]","v":31}
{"k":"[[Reject]]","v":31}
{"k":"[[DateValue]]","v":30}
{"k":"[[PendingAsyncDependencies]]","v":29}
{"k":"[[LocalName]]","v":28}
{"k":"[[Resolve]]","v":28}
{"k":"[[EvaluationError]]","v":27}
{"k":"[[DFSAncestorIndex]]","v":27}
{"k":"[[ReferencedName]]","v":26}
{"k":"[[Extensible]]","v":26}
{"k":"[[ByteOffset]]","v":26}
{"k":"[[AsyncEvaluation]]","v":26}
{"k":"[[ModuleRequest]]","v":26}
{"k":"[[SetPrototypeOf]]","v":25}
{"k":"[[ImportName]]","v":25}
{"k":"[[ProxyHandler]]","v":23}
{"k":"[[ProxyTarget]]","v":23}
{"k":"[[AsyncGeneratorState]]","v":23}
{"k":"[[ExportName]]","v":23}
{"k":"[[Capability]]","v":23}
{"k":"[[IsExtensible]]","v":22}
{"k":"[[Base]]","v":22}
{"k":"[[MapData]]","v":22}
{"k":"[[HasProperty]]","v":21}
{"k":"[[DFSIndex]]","v":21}
{"k":"[[PreventExtensions]]","v":20}
{"k":"[[Order]]","v":20}
{"k":"[[BindingName]]","v":19}
{"k":"[[SetData]]","v":19}
{"k":"[[ByteIndex]]","v":18}
{"k":"[[Iterator]]","v":18}
{"k":"[[AlreadyCalled]]","v":18}
{"k":"[[Description]]","v":17}
{"k":"[[Block]]","v":17}
{"k":"[[Kind]]","v":17}
{"k":"[[StringData]]","v":17}
{"k":"[[ECMAScriptCode]]","v":17}
{"k":"[[ContentType]]","v":17}
{"k":"[[ArrayBufferByteLength]]","v":17}
{"k":"[[Strict]]","v":16}
{"k":"[[Module]]","v":16}
{"k":"[[ErrorData]]","v":16}
{"k":"[[Index]]","v":16}
{"k":"[[RemainingElements]]","v":16}
{"k":"[[NoTear]]","v":15}
{"k":"[[ElementSize]]","v":15}
{"k":"[[Environment]]","v":15}
{"k":"[[WeakRefTarget]]","v":15}
{"k":"[[ByteLength]]","v":15}
{"k":"[[GeneratorBrand]]","v":15}
{"k":"[[CycleRoot]]","v":15}
{"k":"[[AsyncParentModules]]","v":15}
{"k":"[[PromiseState]]","v":15}
{"k":"[[OriginalFlags]]","v":15}
{"k":"[[ThisValue]]","v":14}
{"k":"[[NumberData]]","v":14}
{"k":"[[RegExpMatcher]]","v":14}
{"k":"[[BindingObject]]","v":14}
{"k":"[[ObjectRecord]]","v":14}
{"k":"[[Cells]]","v":14}
{"k":"[[GeneratorState]]","v":14}
{"k":"[[TopLevelCapability]]","v":14}
{"k":"[[Min]]","v":14}
{"k":"[[Max]]","v":14}
{"k":"[[HappensBefore]]","v":14}
{"k":"[[EventList]]","v":13}
{"k":"[[EventsRecords]]","v":13}
{"k":"[[OuterEnv]]","v":13}
{"k":"[[WeakMapData]]","v":13}
{"k":"[[ParameterMap]]","v":13}
{"k":"[[Indent]]","v":13}
{"k":"[[WeakSetData]]","v":12}
{"k":"[[InitialName]]","v":12}
{"k":"[[Values]]","v":12}
{"k":"[[CandidateExecution]]","v":11}
{"k":"[[IsHTMLDDA]]","v":11}
{"k":"[[BooleanData]]","v":11}
{"k":"[[SourceText]]","v":11}
{"k":"[[ThisBindingStatus]]","v":11}
{"k":"[[HostDefined]]","v":11}
{"k":"[[HasTLA]]","v":11}
{"k":"[[Handler]]","v":11}
{"k":"[[AgentSignifier]]","v":10}
{"k":"[[Payload]]","v":10}
{"k":"[[CodeUnitCount]]","v":10}
{"k":"[[NextMethod]]","v":10}
{"k":"[[DeclarativeRecord]]","v":10}
{"k":"[[GlobalEnv]]","v":10}
{"k":"[[AsyncGeneratorQueue]]","v":10}
{"k":"[[StartIndex]]","v":10}
{"k":"[[Intrinsics]]","v":9}
{"k":"[[Callback]]","v":9}
{"k":"[[LittleEndian]]","v":9}
{"k":"[[IsClassConstructor]]","v":9}
{"k":"[[DataView]]","v":9}
{"k":"[[SyncIteratorRecord]]","v":9}
{"k":"[[VarNames]]","v":8}
{"k":"[[Exports]]","v":8}
{"k":"[[CodePoint]]","v":8}
{"k":"[[AlreadyResolved]]","v":8}
{"k":"[[Job]]","v":8}
{"k":"[[ReadsFrom]]","v":8}
{"k":"[[BigIntData]]","v":7}
{"k":"[[IsUnpairedSurrogate]]","v":7}
{"k":"[[BoundTargetFunction]]","v":7}
{"k":"[[FunctionObject]]","v":7}
{"k":"[[ThisMode]]","v":7}
{"k":"[[Names]]","v":7}
{"k":"[[ConstructorKind]]","v":7}
{"k":"[[GeneratorContext]]","v":7}
{"k":"[[PromiseResult]]","v":7}
{"k":"[[OriginalSource]]","v":7}
{"k":"[[EndIndex]]","v":7}
{"k":"[[Stack]]","v":7}
{"k":"[[PromiseFulfillReactions]]","v":7}
{"k":"[[PromiseRejectReactions]]","v":7}
{"k":"[[HostSynchronizesWith]]","v":7}
{"k":"[[SynchronizesWith]]","v":7}
{"k":"[[Event]]","v":6}
{"k":"[[ChosenValue]]","v":6}
{"k":"[[ChosenValues]]","v":6}
{"k":"[[SymbolData]]","v":6}
{"k":"[[UnregisterToken]]","v":6}
{"k":"[[CleanupCallback]]","v":6}
{"k":"[[ClassFieldInitializerName]]","v":6}
{"k":"[[Namespace]]","v":6}
{"k":"[[Object]]","v":6}
{"k":"[[ObjectWasVisited]]","v":6}
{"k":"[[AsyncGeneratorContext]]","v":6}
{"k":"[[ModifyOp]]","v":6}
{"k":"[[Gap]]","v":6}
{"k":"[[PromiseIsHandled]]","v":6}
{"k":"[[ReadsBytesFrom]]","v":6}
{"k":"[[PrivateElements]]","v":5}
{"k":"[[IsWithEnvironment]]","v":5}
{"k":"[[NewTarget]]","v":5}
{"k":"[[HomeObject]]","v":5}
{"k":"[[GlobalThisValue]]","v":5}
{"k":"[[GlobalObject]]","v":5}
{"k":"[[TemplateMap]]","v":5}
{"k":"[[Array]]","v":5}
{"k":"[[Closure]]","v":5}
{"k":"[[RequestedModules]]","v":5}
{"k":"[[IndirectExportEntries]]","v":5}
{"k":"[[Completion]]","v":5}
{"k":"[[AgentOrder]]","v":5}
{"k":"[[PrivateMethods]]","v":4}
{"k":"[[Fields]]","v":4}
{"k":"[[OuterPrivateEnvironment]]","v":4}
{"k":"[[Site]]","v":4}
{"k":"[[CanBlock]]","v":4}
{"k":"[[Signifier]]","v":4}
{"k":"[[KeptAlive]]","v":4}
{"k":"[[AgentSynchronizesWith]]","v":4}
{"k":"[[HeldValue]]","v":4}
{"k":"[[FormalParameters]]","v":4}
{"k":"[[BoundArguments]]","v":4}
{"k":"[[ImportMeta]]","v":4}
{"k":"[[VisitedKeys]]","v":4}
{"k":"[[RemainingKeys]]","v":4}
{"k":"[[LocalExportEntries]]","v":4}
{"k":"[[StarExportEntries]]","v":4}
{"k":"[[Symbol]]","v":4}
{"k":"[[Greedy]]","v":4}
{"k":"[[CharSet]]","v":4}
{"k":"[[Invert]]","v":4}
{"k":"[[ArrayBufferDetachKey]]","v":4}
{"k":"[[Errors]]","v":4}
{"k":"[[RevocableProxy]]","v":4}
{"k":"[[Name]]","v":3}
{"k":"[[Initializer]]","v":3}
{"k":"[[BodyFunction]]","v":3}
{"k":"[[PrivateEnvironment]]","v":3}
{"k":"[[ScriptOrModule]]","v":3}
{"k":"[[BoundThis]]","v":3}
{"k":"[[Context]]","v":3}
{"k":"[[ImportEntries]]","v":3}
{"k":"[[ReplacerFunction]]","v":3}
{"k":"[[PropertyList]]","v":3}
{"k":"[[Class]]","v":1}