Skip to content

Commit

Permalink
Merge pull request #1 from Sreekar456/main
Browse files Browse the repository at this point in the history
Added Arrow functions
  • Loading branch information
Arubh authored Dec 15, 2023
2 parents 7259507 + 725b7f7 commit 2f03bcd
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ArrowFunctions/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Mark 2</title>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<h1>GDSC Web session 2</h1>
<h2>Topic JavaScript</h2>
</body>
</html>
26 changes: 26 additions & 0 deletions ArrowFunctions/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// classic functions
// declartive functions
// function caclAge(birthYear){
// var age = 2023 - birthYear;
// return age;
// }

// const myAge = caclAge(2004);
// // console.log(myAge);

// // function expressions
// const calcMyAge = caclAge(2004);
// console.log(calcMyAge , myAge);

// arrow functions () => Special case of function expressions;


// const yearsUntillRetirement = (birthYear, firstName) => {
// const Age = 2023 - birthYear;
// const retirement = 70 - Age;
// return `${firstName} will retire in ${retirement} years.`;
// };

// console.log(yearsUntillRetirement(1980, "David"));


15 changes: 15 additions & 0 deletions ArrowFunctions/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
body {
font-family: 'Arial', sans-serif;
margin: 20px;
padding: 20px;
text-align: center;
background-color: #176d9f73;
}

h1 {
color: #333;
}

h2 {
color: #555;
}

0 comments on commit 2f03bcd

Please sign in to comment.