diff --git a/lib/internal/navigator.js b/lib/internal/navigator.js index bfd2813414b26d..5b29a098fcd0d9 100644 --- a/lib/internal/navigator.js +++ b/lib/internal/navigator.js @@ -2,6 +2,8 @@ const { ObjectDefineProperties, + StringPrototypeIndexOf, + StringPrototypeSlice, Symbol, } = primordials; @@ -23,7 +25,7 @@ const nodeVersion = process.version; class Navigator { // Private properties are used to avoid brand validations. #availableParallelism; - #userAgent = `Node.js/${nodeVersion.slice(1, nodeVersion.indexOf('.'))}`; + #userAgent = `Node.js/${StringPrototypeSlice(nodeVersion, 1, StringPrototypeIndexOf(nodeVersion, '.'))}`; constructor() { if (arguments[0] === kInitialize) {