0% found this document useful (0 votes)
23 views

Lecture5 PDF

This document discusses various topics related to web programming with JavaScript including: using JavaScript in web pages, functions, events, variables, arrow functions, higher-order functions, local storage, AJAX requests, and Socket.IO for real-time communication between a client and server using JavaScript.

Uploaded by

Moudi Mouhamadou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Lecture5 PDF

This document discusses various topics related to web programming with JavaScript including: using JavaScript in web pages, functions, events, variables, arrow functions, higher-order functions, local storage, AJAX requests, and Socket.IO for real-time communication between a client and server using JavaScript.

Uploaded by

Moudi Mouhamadou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Web Programming

with Python and JavaScript


Server

Client
JavaScript
ES6
JavaScript in a Web Page

<script>
alert('Hello, world!');
</script>
Functions

function hello() {
alert('Hello, world!');
}
Events
• onclick
• onmouseover
• onkeydown
• onkeyup
• onload
• onblur
• ...
querySelector

• document.querySelector('tag')
• document.querySelector('#id')
• document.querySelector('.class')
Variables

• const
• let
• var
Arrow Functions

() => {
alert('Hello, world!');
}
Arrow Functions

x => {
alert(x);
}
Arrow Functions

x => x * 2
Higher-Order Functions
Local Storage
Local Storage

• localStorage.getItem(key)
• localStorage.setItem(key)
Ajax
Ajax
const request = new XMLHttpRequest();
request.open(method, url);

request.onload = function() {
// do something with request.responseText
};

const data = new FormData();


data.append(key, value);
request.send(data);
Socket.IO
Socket.IO

• on
• emit
• Rooms
Web Programming
with Python and JavaScript

You might also like