Ad
  • Custom User Avatar

    u need import

    import java.util.Arrays

    before class

  • Custom User Avatar

    sorry. JavaScript.

  • Custom User Avatar

    We can't really help unless you specify the language.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I can not use Object.fromEntries.
    「TypeError: Object.fromEntries is not a function」

  • Custom User Avatar

    what error mean 「Unhandled rejection TestError: Value is not what was expected」

  • Default User Avatar

    the Lock must be able to store different keys; each key must be verifiably unique (a Number can easily be copied)

  • Custom User Avatar

    my solution is here.

    function Lock() {
      this.key = null
      this.createKey = function(){
        this.key = Number(new Date())
        return this.key
      }
      this.check = function(key){
        return this.key === key
      }
       this.expire = function(key){
          this.key = null
      }
    }
    

    this code can passed test. but attempt is not. above error occur.
    why? should I need..

    Test Results:
    Lock
    .createKey()
    should return an object
    Completed in 2ms
    .check()
    Unspecified AssertionError
    .expire()
    other keys should fail check
    Completed in 5ms