https://github.com/ajay-develops/javascript-code-challeges
https://github.com/ajay-develops/javascript-code-challeges
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/ajay-develops/javascript-code-challeges
- Owner: ajay-develops
- Created: 2022-08-14T19:04:38.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-15T12:49:11.000Z (almost 4 years ago)
- Last Synced: 2025-10-22T07:59:26.836Z (9 months ago)
- Language: JavaScript
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### JavaScript Challenges to Test Your JS skills
###### source - linkedin learning - javascript code challenges
summary of the script files and the topics they cover
1. create objects from class syntax and function syntax
2. create objects from class syntax and function syntax
3. Array.prototype.filter() to filter out vegetarian dishes from all dishes
- example> const arr2 = arr1.filter(element=>element>10)
this will return a new array of the elements of arr1 who were greater than 10
4. Inheritance -
- exporting and importing fucntions and classes is used more often to inherit classes
- to export a class or function
- first make sure you make a new `.js` file with just the class of function , if there is any other content then importing the class will also inherit the content of parent `.js` file with it and it's not cool
- to export a class or function just put export before the class or function declaration .
Examples are
```JavaScript
export function foo(){
console.log("hey there, export me ")
}
```
for class syntax
```JavaScript
export class foo{
constructor (a,b,c){
this.a = a;
-----------
-----------
--------------------
-------------------
}
}
```
to import this class or function in a script file just write
```javascript
import { foo } from "";
```
there is another syntax to export a class by using `export default`
```js
export default foo{
constructor(a,b,c,......){
this.a = a;
this.b = b
---------
---------
}
------
------
}
```
how ever then you should not use `{}` to import the class. use `import foo from ""` instead
```js
import foo from "";
```