Front-end web development
“...est une solution automatisée qui permet à des utilisateurs d’obtenir, à partir de certains inputs, des outputs qui contribuent à résoudre un problème initial ou à répondre à un besoin.”
Since you don't have to deal with binary code anymore, the choice of the programming language/technology depends on what is your intention?
Develop interactive applications to foster learning.
It determines what you can do and where it happens.
<!DOCTYPE html>
<html lang="en">
<head>
<title>An HTML page</title>
<meta charset="UTF-8">
<!-- Download of the CSS -->
<link href="assets/css/style.css" rel="stylesheet">
</head>
<body>
<!-- Download of the JS -->
<script src="assets/js/app.js"></script>
</body>
</html>
With the page you download the instructions!
JavaScript is allowed to instruct the browser on what to do through the window object
window
window.innerHeight
window.location.href
Inside the window object, you have the window.document object which gives access to the DOM.
window.document
in the consoledocument
document.title
document.title = 'I have changed the title!'
document.body
Through the access to the document object, you can manipulate the HTML element of a page.
document.getElementById('slideTitle').innerHTML
document.getElementById('slideTitle').innerHTML = 'We can do better!'
This presentation uses JavaScript code from Reveal.js, which means that you have downloaded the code with the presentation.
Reveal
in your consoleReveal.getTotalSlides()
Reveal.next()
Now look at the HTML code of the button below.
<button onclick="Reveal.next()">Next slide</button>
What happens when you click on it? Try...
Another button, there is no onclick though...
<button id="logHelloBtn">Log Hello to the console</button>
But with the page you have downloaded this code...
//Identify the interactive element (button)
var myBtn = document.getElementById('logHelloBtn');
//Add an event listener that triggers the behavior
myBtn.addEventListener('click', function () {
//Show a feedback in the console
console.log('Hello at ' + new Date());
});
Hot to create an I/O interaction
Identify the button to be clicked on
When clicked, say Hello with the current date
Show the message in the console
See the Pen Client Side JavaScript basic example by Mattia A Fritz ( @mafritz) on CodePen.