pull/320/merge
yendoz 6 months ago committed by GitHub
commit 51864cc29f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -304,8 +304,8 @@ let isRaining = true
isRaining
? console.log('You need a rain coat.')
: console.log('No need for a rain coat.')
isRaining = false
let isRaining = false
isRaining
? console.log('You need a rain coat.')
: console.log('No need for a rain coat.')
@ -321,8 +321,8 @@ let number = 5
number > 0
? console.log(`${number} is a positive number`)
: console.log(`${number} is a negative number`)
number = -5
let number = -5
number > 0
? console.log(`${number} is a positive number`)
: console.log(`${number} is a negative number`)
@ -565,7 +565,7 @@ console.log(`${date}/${month}/${year} ${hours}:${minutes}`) // 4/1/2020 0:56
The perimeter of the triangle is 12
```
1. Get length and width using prompt and calculate an area of rectangle (area = length x width and the perimeter of rectangle (perimeter = 2 x (length + width))
1. Get length and width using prompt and calculate an area of rectangle (area = length x width) and the perimeter of rectangle (perimeter = 2 x (length + width))
1. Get radius using prompt and calculate the area of a circle (area = pi x r x r) and circumference of a circle(c = 2 x pi x r) where pi = 3.14.
1. Calculate the slope, x-intercept and y-intercept of y = 2x -2
1. Slope is m = (y<sub>2</sub>-y<sub>1</sub>)/(x<sub>2</sub>-x<sub>1</sub>). Find the slope between point (2, 2) and point(6,10)

@ -408,7 +408,6 @@ for(let i = 0; i <= 5; i++){
['Germany', 'GER', 7],
['Hungary', 'HUN', 7],
['Ireland', 'IRE', 7],
['Iceland', 'ICE', 7],
['Japan', 'JAP', 5],
['Kenya', 'KEN', 5]
]
@ -417,7 +416,7 @@ for(let i = 0; i <= 5; i++){
2. In above countries array, check if there is a country or countries containing the word 'land'. If there are countries containing 'land', print it as array. If there is no country containing the word 'land', print 'All these countries are without land'.
```sh
['Finland','Ireland', 'Iceland']
['Finland','Ireland']
```
3. In above countries array, check if there is a country or countries end with a substring 'ia'. If there are countries end with, print it as array. If there is no country containing the word 'ai', print 'These are countries ends without ia'.

@ -102,7 +102,7 @@ console.log(sumArray(numbers))
```
```sh
15
10
```
The above example can be simplified as follows:
@ -122,7 +122,7 @@ console.log(sumArray(numbers))
```
```sh
15
10
```
### Setting time
@ -191,10 +191,8 @@ arr.forEach((element, index, arr) => console.log(index, element, arr))
```
```js
let sum = 0;
const numbers = [1, 2, 3, 4, 5];
numbers.forEach(num => console.log(num))
console.log(sum)
```
```sh
@ -664,7 +662,6 @@ const products = [
]
```
````
3. \*\*\* Try to develop a program which calculate measure of central tendency of a sample(mean, median, mode) and measure of variability(range, variance, standard deviation). In addition to those measures find the min, max, count, percentile, and frequency distribution of the sample. You can create an object called statistics and create all the functions which do statistical calculations as method for the statistics object. Check the output below.
@ -681,8 +678,7 @@ const products = [
console.log('Mode: ', statistics.mode()) // {'mode': 26, 'count': 5}
console.log('Variance: ',statistics.var()) // 17.5
console.log('Standard Deviation: ', statistics.std()) // 4.2
console.log('Variance: ',statistics.var()) // 17.5
console.log('Frequency Distribution: ',statistics.freqDist()) # [(20.0, 26), (16.0, 27), (12.0, 32), (8.0, 37), (8.0, 34), (8.0, 33), (8.0, 31), (8.0, 24), (4.0, 38), (4.0, 29), (4.0, 25)]
console.log('Frequency Distribution: ',statistics.freqDist()) // [(20.0, 26), (16.0, 27), (12.0, 32), (8.0, 37), (8.0, 34), (8.0, 33), (8.0, 31), (8.0, 24), (4.0, 38), (4.0, 29), (4.0, 25)]
```
```sh

@ -403,7 +403,7 @@ const matches = txt.match(pattern)
console.log(matches) // ['6', '2019']
```
### Cart ^
### Caret ^
- Starts with
@ -445,9 +445,9 @@ console.log(result) // true
1. The position of some particles on the horizontal x-axis -12, -4, -3 and -1 in the negative direction, 0 at origin, 4 and 8 in the positive direction. Extract these numbers and find the distance between the two furthest particles.
```js
points = ['-1', '2', '-4', '-3', '-1', '0', '4', '8']
sortedPoints = [-4, -3, -1, -1, 0, 2, 4, 8]
distance = 12
points = ['-12', '-4', '-3', '-1', '0', '4', '8']
sortedPoints = [-12, -4, -3, -1, 0, 4, 8]
distance = 20
```
1. Write a pattern which identify if a string is a valid JavaScript variable

@ -243,7 +243,7 @@ console.log(person2.getFullName())
```sh
Asabeneh Yetayeh
test.js:19 Lidiya Tekle
Lidiya Tekle
```
### Properties with initial value

Loading…
Cancel
Save