Learning Web developement
HTML:
http://www.simplehtmlguide.com/cheatsheet.php
CSS :
PADDING: It is the space between border and the content.
MARGIN: It is teh space outside the border.
* means evrything
*{
margin : 0;
padding: 0;
}
/* will reset the changes made */
What are Semantic Elements?
A semantic element clearly describes its meaning to both the browser and the developer.
Examples of non-semantic elements: <div>
and <span>
- Tells nothing about its content.
Examples of semantic elements: <form>
, <table>
, and <article>
- Clearly defines its content.
The HTML DOM (Document Object Model)
When a web page is loaded, the browser creates a Document Object Model of the page.
The HTML DOM model is constructed as a tree of Objects:
With the object model, JavaScript gets all the power it needs to create dynamic HTML:
- JavaScript can change all the HTML elements in the page
- JavaScript can change all the HTML attributes in the page
- JavaScript can change all the CSS styles in the page
- JavaScript can remove existing HTML elements and attributes
- JavaScript can add new HTML elements and attributes
- JavaScript can react to all existing HTML events in the page
- JavaScript can create new HTML events in the page
The two main types of length units are absolute and relative. Absolute units tie to physical units of length. For example, in
and mm
refer to inches and millimeters, respectively. Absolute length units approximate the actual measurement on a screen, but there are some differences depending on a screen's resolution.
Relative units, such as em
or rem
, are relative to another length value. For example, em
is based on the size of an element's font. If you use it to set the font-size
property itself, it's relative to the parent's font-size
.
What is a Callback Function?
In JavaScript, functions are objects. Can we pass objects to functions as parameters? Yes.
So, we can also pass functions as parameters to other functions and call them inside the outer functions. Sounds complicated? Let me show that in an example below:
function print(callback) {
callback();
}
The print( ) function takes another function as a parameter and calls it inside. This is valid in JavaScript and we call it a “callback”. So a function that is passed to another function as a parameter is a callback function. But that’s not all.
const
is safer than using var
, because a function expression is always a constant value.var x = function(x, y) {
return x * y;
}
// ES6
const x = (x, y) => x * y;
A JavaScript class is not an object.
It is a template for JavaScript object.
JavaScript Promise Object
A JavaScript Promise object contains both the producing code and calls to the consuming code:
Promise Syntax
let myPromise = new Promise(function(myResolve, myReject) {
// "Producing Code" (May take some time)
myResolve(); // when successful
myReject(); // when error
});
// "Consuming Code" (Must wait for a fulfilled Promise)
myPromise.then(
function(value) { /* code if successful */ },
function(error) { /* code if some error */ }
);
Comments
Post a Comment