Skip to content

Commit eb2ed78

Browse files
committed
JavaScript Ejercicio: 1419 Comprobar Si un Dato Específico es un Objeto JSON Puro
Comprobar Si un Dato Específico es un Objeto JSON Puro con el lenguaje de programación JavaScript.
1 parent e94ea7c commit eb2ed78

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Ejercicio 1419: Comprobar si un dato específico es un objeto JSON puro.
2+
3+
function esObjetoJsonPuro(dato) {
4+
return toString.call(dato) === '[object Object]';
5+
}
6+
7+
let persona = {
8+
id: 1002,
9+
nombre: 'Juan',
10+
email: 'juan@mail.co'
11+
}
12+
13+
console.log(esObjetoJsonPuro(persona)); // true
14+
console.log(esObjetoJsonPuro(new Array())); // false
15+
console.log(esObjetoJsonPuro(new Map())); // false
16+
console.log(esObjetoJsonPuro(new Set())); // false

0 commit comments

Comments
 (0)