E
E
ekdown2015-01-05 17:05:19
JavaScript
ekdown, 2015-01-05 17:05:19

Why doesn't the object method work?

Hello.
I ran into a problem: the method of the object is not executed.

var dialog = {
    show : function(text) {
            //тут что-то делается    
  },
  
  hide : function() {
      //и тут тоже
  }
}

When run from the console dialog.show("текст"), everything works.
But when I run it, I dialog.hide()get something like this:
TypeError: dialog.hide is not a function

Where is the mistake?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
keslo, 2015-01-05
@keslo

Most likely a syntax error in hide()

A
Alexey P, 2015-01-05
@ruddy22

everything works, look for the error
jsbin.com/biniw/1/edit?js,console

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question