INFO 253A: Front End Web Architecture
Kay Ashaolu
<html>
<head>
<title>Learning JavaScript</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
let a = 3;
let b = 5;
let c = a + b;
let a = "hello";
let b = "world!";
let c = a + b;
let list = [2,3, "KAY"];
alert(list[2]);
let titles = {
info253: 'Web Arch',
info256: 'Applied NLP'
};
alert(titles.info253);
let schools = {
berkeley: {info253: 'Web Arch'},
stanford: {cs101: 'Intro CS'}
};
alert(schools.stanford.cs101);
let add = function(a, b) {return a + b;}
let c = add(2, 7)
/* c is now 9 */
let arithmetic = {add: add, subtract: function(a, b) {return a - b;}};
let d = arithmetic.subtract(11, 4);
let e = arithmetic.add(0, 3);
/* d is now 7; e is now 3; */
function helloWorld(first_name, last_name) {
let message = "Hello World " + first_name + " " + last_name;
return message;
}
let first = prompt("Enter your first name");
let last = prompt("Enter your last name");
let output = helloWorld(first, last);
alert(output);
What does this function do?
For the non programmers here stay with me, learn this and it will empower you throughout this course and beyond