Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. phone: {
  2. get: function() {
  3. return this.value;
  4. },
  5. // setter
  6. set: function(newValue) {
  7. if (newValue.length === 1) {
  8. this.value = "(" + newValue;
  9. } else if (newValue.length === 4) {
  10. this.value = newValue + ") ";
  11. } else if (newValue.length === 9) {
  12. // (282) 922-5555
  13. // 1234567890
  14. this.value = newValue + "-";
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement