Determine whether the obj object contains the children attribute, but the following error occurs
Do not access Object.prototype method ‘hasOwnProperty’ from target object.
Cannot directly access methods on Object prototype
Reason:
It is not safe to call hasOwnProperty directly on the result object,If the obj object itself has the hasOwnProperty property,there will be some unexpected problems when calling it. If someone with intentions takes advantage of ,set the property in obj to malicious code, will cause some security issues.
Workaround:
Use call to change the call point
const hasChild = Object.prototype.hasOwnProperty.call(obj, 'children');
Read More:
- SSIS Exception: Failed to retrieve long data for column “TS_Description”
- FTP use get command 550 failed to open file, but use the put command to solve the problem
- Solve the problem that power view in Excel prompts activate method of oleobject class failed or activate method like oleobject is invalid
- Failed to instantiate [org.springframework.web.servlet.HandlerMapping] Factory method ‘resourceHandl
- error TS2339:Property ‘length’ does not exist on type ‘object’
- Error ts1005: ‘;’ expected
- TypeError: Failed to execute ‘fetch‘ on ‘Window‘: Request with GET/HEAD method cannot have body.
- [Solved] Logon failed, use ctrl+c to cancel basic credential prompt. unable to access
- HTTP 405 Error: Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
- How to Solve failed Precondition Error: attempting to use uninitialized value beta1_power
- nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
- Processing method of SVN error “failed to run the WC DB work queue associated with…”
- Vue + TS reports an error after configuring the path alias
- ionic4- error TS2307: Cannot find module ‘rxjs-compat/Observable’
- Trivia: How does R language solve Error in ts(x):’ts’ object must have one or more observations
- [Solved] VUE Error: “You may use special comments to disable some warnings.Use // eslint-disable-next-line to …
- “Method does not override method from its superclass”
- Difference between isempty method and isblank method in stringutils
- Use yum to prompt Error: rpmdb open failed
- Failed to set up listener: socketexception: address already in use