I saw % in many codes. Can you explain to me its purpose or what it does?
Edit: I know the operand in math 13 % 10 = 3 but what I saw is like return %foo.
Encountered this while looking through v8 source files
Why are some of the function invocations preceded by a % sign?
%CheckIsBootstrapping();
//---
// Only used by async-await.js
function RejectPromise(promise, reason, debugEvent) {
%PromiseReject(promise, reason, debugEvent);
}
//---
var callbacks = %create_resolving_functions(promise, debugEvent);
Based on the link you provided in the comments, the
%character appears to be used in some of the V8 JavaScript engine source code to indicate a method of the C++ runtime that will be executed while parsing the JavaScript source.For example, the line in string.js:
When encountered by the parser, the
StringBuilderConcatmethod will be executed. You can find a list of the runtime methods available to the V8 JavaScript files in runtime.h (note, I have no experience with C++, so for all I know this has nothing to do with theStringBuilderConcatmethod referenced in string.js, but I think it’s the same thing):As has already been stated,
return %foowould throw a SyntaxError in JavaScript.