To rick roll someone using Typescript, we can create a button on a webpage and add a click event listener to it. When the button is clicked, it will redirect the user to the infamous Rick Astley's "Never Gonna Give You Up" music video.
Here's the code:
index.ts178 chars6 lines
In the above code, we get a reference to an HTML element with an id of "rick-roll-button". We then add a click event listener to it and when clicked, we set the window location href to the link of the video.
Make sure to add the HTML button to your web page and include this script on the same page. When the user clicks the button, they will be redirected to the Rick Astley video, hence the prank!
gistlibby LogSnag