Skip to content

Commit 06567f8

Browse files
committed
Translated Instanceof JS
1 parent 792b27a commit 06567f8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

JS/JS-br.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,16 +290,16 @@ Atualmente, as arrow function não tem o `this`, `this` na função acima apenas
290290

291291
# Instanceof
292292

293-
The `instanceof` operator can correctly check the type of objects, because its internal mechanism is to find out if `prototype` of this type can be found in the prototype chain of the object.
293+
O operador `instanceof` consegue checar corretamente o tipo dos objetos, porque o seu mecanismo interno encontra se o tipo do `prototype` pode ser encontrado na cadeia de prototype do objeto.
294294

295-
let’s try to implement it:
295+
vamos tentar implementar ele:
296296
```js
297297
function instanceof(left, right) {
298-
// get the `prototype` of the type
298+
// obtenha o type do `prototype`
299299
let prototype = right.prototype
300-
// get the `prototype` of the object
300+
// obtenha o `prototype` do objeto
301301
left = left.__proto__
302-
// check if the type of the object is equal to the prototype of the type
302+
// verifique se o tipo do objeto é igual ao prototype do tipo
303303
while (true) {
304304
if (left === null)
305305
return false

0 commit comments

Comments
 (0)