added content to - prototypal inheritance, implicti type casting, keyed collections, structured data, break continue, labeled statements, comparison operators, string operators, conditional operators (#2032)
Co-authored-by: Kamran Ahmed <kamranahmed.se@gmail.com>pull/2031/head^2
parent
e2ec1b8363
commit
e9dd0942e1
9 changed files with 65 additions and 17 deletions
@ -1 +1,14 @@ |
||||
# Prototypal inheritance |
||||
# Prototypal inheritance |
||||
|
||||
In JavaScript, objects have a special hidden property `[[Prototype]]`, that is either null or references another object. That object is called "a prototype". |
||||
|
||||
When we read a property from object, and it's missing, JS automatically takes it from the prototype. This is called "protoypal inheritance". |
||||
|
||||
Syntax: |
||||
|
||||
`ChildObject.__proto__ = ParentObject` |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink badgeText='Official Website' colorScheme='blue' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain'>JavaScript MDN Docs</BadgeLink> |
||||
<BadgeLink badgeText='Official Website' colorScheme="blue" href='https://www.geeksforgeeks.org/prototypal-inheritance-using-__proto__-in-javascript/'>GeeksForGeeks – JavaScript Tutorial</BadgeLink> |
||||
<BadgeLink badgeText='Official Website' colorScheme="blue" href='https://javascript.info/prototype-inheritance'>The Modern JavaScript Tutorial</BadgeLink> |
||||
|
@ -1,6 +1,9 @@ |
||||
# Implicit Type Casting |
||||
|
||||
Implicit type casting happens when JavaScript automatically converts one data type to another to meet the expectations of the process. as for example passing a number when it expects a string like `"foo" + 1`, the Number `1` is implicitly converted into a string and the expression returns `"foo1"`. |
||||
Implicit type conversion happens when the compiler or runtime automatically converts data types. JavaScript is loosely typed language and most of the time operators automatically convert a value to the right type. |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://www.geeksforgeeks.org/javascript-type-conversion/'>GeeeksForGeeks - JavaScript Tutorials</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://www.w3schools.com/js/js_type_conversion.asp'>W3Schools - JavaScript Tutorials</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://www.tutorialspoint.com/explain-typecasting-in-javascript'>TutorialsPoint - JavaScript Tutorials</BadgeLink> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://dev.to/promisetochi/what-you-need-to-know-about-javascripts-implicit-coercion-e23'>What you need to know about Javascript's Implicit Coercion</BadgeLink> |
||||
|
@ -1 +1,10 @@ |
||||
# Keyed collections |
||||
# Keyed collections |
||||
|
||||
Keyed collections are collections of data that are ordered by a key and not index. They are associative in nature. |
||||
|
||||
`Map` and `Set` objects contain elements which are iterable in the order of insertion. |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Keyed_collections'>JavaScript MDN Docs</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://www.tutorialspoint.com/keyed-collections-in-javascript'>Tutorialspoint – JavaScript Tutorial</BadgeLink> |
||||
<BadgeLink badgeText='Read' colorScheme="yellow" href='https://medium.com/@jimmyfarillo/keyed-collections-in-javascript-set-vs-map-vs-weakset-vs-weakmap-f50d86052da2'>Medium - Keyed Collections in JavaScript</BadgeLink> |
||||
|
@ -1 +1,8 @@ |
||||
# Structured data |
||||
# Structured data |
||||
|
||||
Structured data is used by search-engines, like Google, to understand the content of the page, as well as to gather information about the web and the world in general. |
||||
|
||||
It is also coded using in-page markup on the page that the information applies to. |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data'>Google Developers docs</BadgeLink> |
||||
|
@ -1,6 +1,9 @@ |
||||
# Labeled Statements |
||||
|
||||
The labeled statement can be used with `break` or `continue` statements. It is prefixing a statement with an identifier that you can refer to. |
||||
JavaScript label statements are used to prefix a label to an identifier. It can be used with `break` and `continue` statement to control the flow more precisely. |
||||
|
||||
A label is simply an identifier followed by a colon`(:)` that is applied to a block of code. |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href= 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label'>Label Statements</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label'>JavaScript MDN Docs</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://www.tutorialspoint.com/What-are-label-statements-in-JavaScript'>Tutorialspoint – JavaScript Tutorial</BadgeLink> |
@ -1,7 +1,10 @@ |
||||
# Break Continue |
||||
# Break continue |
||||
|
||||
The `break` and `continue` statements are used to "jump out" of a loop. When executed, the `break` statement will terminate the loop entirely; Whereas `continue` will terminate only the current iteration, and continue execution of the loop's next iteration. |
||||
`break` statement, without a label reference, can only be used to jump out of a loop or a switch block. |
||||
|
||||
`continue` statement, with or without a label reference, can only be used to skip one loop iteration. |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='blue' badgeText='Read' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break'>break</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Read' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/continue'>continue</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/continue'>JavaScript MDN Docs - continue statement</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break'>JavaScript MDN Docs - break statement</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://www.w3schools.com/js/js_break.asp'>W3Schools – JavaScript Tutorial</BadgeLink> |
||||
|
@ -1,7 +1,8 @@ |
||||
# Comparison Operators |
||||
|
||||
Comparison operators are the operators that compare values and return true or false. |
||||
The operators include : `>`, `<`, `>=`, `<=`, `==`, `===`, `!==` and `!===` |
||||
Comparison operators are the operators that compare values and return true or false. The operators include: `>`, `<`, `>=`, `<=`, `==`, `===`, `!==` and `!===` |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://www.w3schools.com/js/js_comparisons.asp'>W3Schools - JavaScript Tutorials</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#comparison_operators'>JavaScript MDN Docs</BadgeLink> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#comparison_operators'>Comparison operators</BadgeLink> |
||||
|
@ -1,7 +1,9 @@ |
||||
# String Operators |
||||
|
||||
Strings are useful for holding data that can be represented in text form. Some of the most-used operators on strings are to build and concatenate them using this string operators: `+` (Concatenate), `+=` (Concatenate Assignment). |
||||
In addition to the comparison operators, which can be used on string values, the concatenation operator (`+`) concatenates two string values together, returning another string that is the union of the two operand strings. |
||||
|
||||
The shorthand assignment operator `+=` can also be used to concatenate strings. |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#string_operators'>Arithmetic Operators - MDN</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#string_operators'>JavaScript MDN Tutorials</BadgeLink> |
||||
<BadgeLink colorScheme='yellow' badgeText='Read' href='https://javascript.info/operators#string-concatenation-with-binary'>String Concatenation - JavaScript.info</BadgeLink> |
@ -1,6 +1,13 @@ |
||||
# Conditional Operators |
||||
# Conditional operators |
||||
|
||||
The conditional operator (or "ternary" operator) is a shorthand `if...else` statement. The syntax is: `condition ? expression1 : expression2;`. That is, the operator will execute `expression1` if the condition is `truthy`, and otherwise `expression2` if the condition is `falsy`. |
||||
Conditional oprator also known as Ternary operator is the only JS operator that takes three operands. |
||||
|
||||
The operator can have one of two values based on a condition. |
||||
|
||||
Syntax: |
||||
|
||||
`condition ? val_for_true : val_for_false ` |
||||
|
||||
<ResourceGroupTitle>Free Content</ResourceGroupTitle> |
||||
<BadgeLink colorScheme='blue' badgeText='Read' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#conditional_ternary_operator'>Conditional Operator</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#conditional_operator'>JavaScript MDN Docs</BadgeLink> |
||||
<BadgeLink colorScheme='blue' badgeText='Official Website' href='https://www.w3schools.com/js/js_comparisons.asp'>W3Schools - JavaScript Tutorials</BadgeLink> |
||||
|
Loading…
Reference in new issue