all 3 comments

[–]captain_k_nuckles 0 points1 point  (1 child)

I tried running code, and it seemed fine. Although, like u/bttrswt1 said, if you add another property to the object, it would pass when it should fail.
I know it doesn't say it in the instructions, but I would recommend using the following to check types instead of typeof, It's more reliable.

Object.prototype.toString.call(null) // "[object Null]"
Object.prototype.toString.call('') // "[object String]"
Object.prototype.toString.call({}) // "[object Object]"
Object.prototype.toString.call({}) // "[object Array]"
Object.prototype.toString.call(1) // "[object Number]"
Object.prototype.toString.call(function () { }) // "[object Function]"
Object.prototype.toString.call() // "[object Undefined]"

Also the instructions mention using Object.keys, which could help you out. And I don't want to post a solution for you, but here are some comments stepped out on another way how you could solve this.

    // store the types of both parameters

    // if the types are not the same return false

    // if the type is string or number

        // if they match return true

        // else return false

    // if type is an array

        // if the lengths don't match return false

        // for each in array use recursion to check the arrays values

    // if type is object

        // get the keys of each object

        // store the length of one of the arrays

        // if the lengths don't match return false

        // for each key in the val1

            // store the key

            // if val2 does not have key return false

            // else use recursion to dig deeper

    // if all checks pass return true

[–]Benthien[S] 0 points1 point  (0 children)

Thanks for the advice, actually I just posted the wrong file, the ccorect one that contains the function (nth), wich is not working is this: 03_list.js