Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input type="password" id="pswrd">
- <input type="button" id="btn" value="Создать объект">
- <script>
- btn.onclick = function () {
- var pass = document.getElementById('pswrd').value;
- var Obj = {
- userPasswords: [],
- userPass: function(value) {
- if (value.split('').length < 8) {
- return 'Длина пароля должна составлять не меньше 8 символов';
- } else {
- this.userPasswords.push(value);
- return this;
- }
- }
- };
- console.log(Obj.userPass(pass));
- };
- </script>
- var Obj = {
- userPasswords: [],
- userPass: function(value) {
- if (value.split('').length < 8) {
- return 'Длина пароля должна составлять не меньше 8 символов';
- } else {
- this.userPasswords.push(value);
- return this;
- }
- }
- };
- btn.onclick = function () {
- var pass = document.getElementById('pswrd').value;
- console.log(Obj.userPass(pass));
- };
Add Comment
Please, Sign In to add comment