Skip to content

Instantly share code, notes, and snippets.

@cjlaborde
Last active June 16, 2020 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjlaborde/6e681d48c55983222572a8738a1789bc to your computer and use it in GitHub Desktop.
Save cjlaborde/6e681d48c55983222572a8738a1789bc to your computer and use it in GitHub Desktop.
Javascript Snippets

Using regex

if (payload.isValid) 
          this.formattedNumber = payload.formattedNumber.replace(/\D/g, '');
}
getPhoneNumber() {
          this.formattedNumber = data.formattedNumber?.substr(1) ?? '';
},

Create New Array with Selected Items

     this.selectBoxItems = this.allRooms.map(({ room_id, room_listing_name }) => ({ room_id, room_listing_name }))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment