JavaScript Core Concept
Primitive values use in the browsers: Primitive values are numbers and strings. You can use it by open the browser’s console and print some console log like in the example.
Example:
console.log(5);console.log(“Your name”)Console.log(“undefined”)
Object and functions: Object and functions are also values, but its not primitive. This will make them special. simple examples are given below —
Example:
console.log({});console.log([]);consloe.log(x => x *2);
Expressions in JavaScript: There are many questions javaScript can’t answer. That’s why you can’t get all answers in js. But there are some questions that javaScript would be delight to answer. These questions have special names — they are called expressions. if we “ask” the expression 5+5, JavaScript will “answer” with the value 10.
Example:
console.log(5+5); // 10
Find checking type: There are three different types of type. First number second string third undefined. You can easily find this type of by using console.log.
Example:
console.log(typeof(5)); // “number”console.log(typeof(“your name”)); // “string”console.log(typeof(undefined)); //”undefined”
Error handling in JavaScript: First “try…catch” syntax. This is very simple to use. First, you need to inside some code in try and then you show the result if its error show error otherways it will show normally.
Example:
try { alert(‘start my train’); // (1)what!!! ; // error not defined!alert(‘not reached’); // (2)} catch (err) {alert(`Error !`); // (3)}
Coding Style: Most JavaScript projects are written in “Egyptian” style. it's opening brac in the same line as the corresponding keyword — not on a new line. I give an example below. its uses of the curly bracket.
Example:
if(your condition) {//do some code//here//and here}
beginners sometimes do that. curly bracet is not needed here
if (i < 0) { alert(`this format is not supported);}
comments use case: I think we know that single-line starting with // and multiline /*…*/. We usually do this and the code works fine. if we comment well the code looks very professional.
example:
/***returns the code is right.**const number = (1, 2, 3, 4, 5)*function number(x, y){write your code}
Caching: Caching is a general concept of computer that provides efficiency through data availability. There are many caching. First, say about client caching. Client caches help limit the data cost incurred by the user by keeping commonly referenced data locally. Second server caching. its help limit the cost incurred by the server and its underlying system. its uses are some difficult like
- The first client makes a req to the API.
- Req receives by the server.
- Server checks for a local copy of the file req. This check cost is very low.
- Once the local resource exists, the server responds with its resource URL.
- Then client grabs the cashed content.
- If the local resource doesn't exit the req is processed normally.
Cross Browser Testing: Cross browser testing is the practice of making sure that web sites and web apps you use or create work across an acceptable number of web browsers. As a Web Developer, it's your responsibility.
- Different browsers like old browser people might still using, which don't support all the latest, shiniest CSS and JavaScript features.
- The different device has different capabilities, if have latest greatest tablets or smartphone right down the cheap tablets and even older feature phones that may run a browser with limited capabilities.
- Who uses the web with aid of assistive technologies like screen Recorder.
Cross Browser Discovery: In each implementation phase, you need to test some functionality. You should make sure there are no general issues with your code that are stopping your features from working
- Test it in a stable browser in your systems like Firefox, Safari, Chrome, Or Edge.
- Do some accessibility testing, such as trying to use your site only with a keyboard or use a screen reader to see if it is navigable.
- Test on a mobile platform like android or ios.