This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//index.html | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>New</title> | |
<link rel="stylesheet" href="./style.css" /> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//_mixins.scss | |
@mixin reset { | |
* { | |
margin: 0; | |
padding: 0; | |
box-sizing: border-box; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//_variables.scss | |
$black: #0f3057; | |
$green: #008891; | |
$grey: #e7e7de; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//style.scss | |
@import "./variables"; | |
@import "./mixins"; | |
@include reset; //imported from "_mixins.scss" | |
body { | |
width: 100%; | |
height: 100vh; | |
background-color: $black; | |
@include center; //imported from "_mixins.scss" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//style.css | |
* { | |
margin: 0; | |
padding: 0; | |
box-sizing: border-box; } | |
body { | |
width: 100%; | |
height: 100vh; | |
background-color: #0f3057; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function abc(a,b) { // a and b are called parameters | |
//code | |
} | |
abc(c,d); // c and d are called arguments |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function abc(x,y) { | |
//we used logical OR(||) operator. It returns the first truthy value. | |
//if first value is undefined, second value is returned | |
x = x || 100; | |
// value of x is x which is given at the function call. If not given value is 100 | |
y = y || 50; | |
// value of y is y which is given at the function call. If not given value is 50 | |
console.log(x,y); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function abc(x,y) { | |
if (x === undefined) { | |
x = 100; | |
} | |
if (y === undefined) { | |
y = 50; | |
} | |
console.log(x,y); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function identity(name = "John",age = 25) { | |
console.log(name, " ", age); | |
} | |
identity(); //John 25 | |
identity("Harris"); //Harris 25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function number() { | |
return 10; | |
} | |
function result (x ,y =number()) { | |
console.log(x+y); | |
} | |
result(2); //12 | |
result(10,20) //30 |
OlderNewer