Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Rahul Kumar/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let para = document.querySelector('#paragraph2');
let btn = document.querySelector('button');
let para2 = document.querySelector('#paragraph');

async function getJokes(){
let res = await fetch("https://official-joke-api.appspot.com/random_joke");
let data = await res.json();
console.log(data);
para.innerHTML = `<b style="color: red;">setup: </b><i>${data.punchline}</i>`
para2.innerHTML = `<b style="color: red;">punchline: </b><i>${data.setup}</i>`
}
18 changes: 18 additions & 0 deletions Rahul Kumar/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Daily Jokes🤣</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div>
<h2>Get Random Jokes from an API</h2>
<button onclick="getJokes()">Get Jokes😂</button>
<p id="paragraph"><b style="color: red">setup: </b></p>
<p id="paragraph2"><b style="color: red">punchline: </b></p>
</div>
<script src="app.js"></script>
</body>
</html>
17 changes: 17 additions & 0 deletions Rahul Kumar/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
div{
text-align: center;
color: blueviolet;
font-family: monospace;
}
h2{
color: brown;
text-decoration: underline;
}
button{
padding: 10px 20px;
background-color: rgb(163, 15, 163);
color: white;
font-weight: bold;
border: none;
border-radius: 7px;
}