DEV Community

Discussion on: 7 Killer One-Liners in JavaScript

 
snigo profile image
Igor Snitkin

@lukeshiru your point about copyToClipboard is 100% legit, but maybe like this then:

const copyToClipboard = async (text) => navigator.clipboard.writeText(text);
Enter fullscreen mode Exit fullscreen mode

...so we're able to provide a rejection reason and not just throw text back