Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- function ask(question, answer, ok, fail) {
- var result = prompt(question, '');
- if (result.toLowerCase() == answer.toLowerCase()) ok();
- else fail();
- }
- var user = {
- login: 'Василий',
- password: '12345',
- loginOk: function() {
- alert( this.login + ' вошёл в сайт' );
- },
- loginFail: function() {
- alert( this.login + ': ошибка входа' );
- },
- checkPassword: function() {
- ask("Ваш пароль?", this.password, this.loginOk, this.loginFail);
- }
- };
- user.checkPassword();
- var vasya = user;
- user = null;
- vasya.checkPassword();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement