-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
38 lines (38 loc) · 982 Bytes
/
app.js
File metadata and controls
38 lines (38 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"use strict";
function randomGreeting() {
const greeting = ["Gud'ay", "Goede dag", "Bom dia", "Hello there"];
let name = document.getElementById("name").value;
if (!name) {
name = "nobody";
}
let chosenGreeting =
greeting[Math.floor(Math.random() * greeting.length)] + ", " + name + "!";
alert("Here is you free* random greeting:\n\n" + chosenGreeting);
}
function jqueryEvents() {
$("nav a").hover(
function () {
$(this).css("font-weight", "bold");
},
function () {
$(this).css("font-weight", "normal");
}
);
$("img").click(function () {
if ($(this).css("width") == "200px") {
$(this).css("width", "100%");
} else {
$(this).css("width", "200px");
}
});
}
function getBitcoin() {
$.getJSON(
"https://api.coinbase.com/v2/prices/spot?currency=USD",
function (result) {
$("footer").text(`Bitcoin currently is worth USD ${result.data.amount}`);
}
);
}
$(jqueryEvents);
$(getBitcoin);