Skip to content

Commit 298bc56

Browse files
authored
Merge pull request #548 from Dikendev/master
day 1 portuguese translation
2 parents c24de4c + 2bd214e commit 298bc56

31 files changed

+1338
-56
lines changed

Portuguese/02_Day_Data_types/02_day_data_types.md

Lines changed: 980 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<title>30DaysOfJavaScript</title>
6+
</head>
7+
8+
<body>
9+
<h1>30DaysOfJavaScript:02 Day</h1>
10+
<h2>Data types</h2>
11+
12+
<!-- import your scripts here -->
13+
<script src="./main.js"></script>
14+
15+
</body>
16+
17+
</html>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// this is your main.js script
75.4 KB
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
const PI = Math.PI
2+
console.log(PI) // 3.141592653589793
3+
console.log(Math.round(PI)) // 3; to round values to the nearest number
4+
console.log(Math.round(9.81)) // 10
5+
console.log(Math.floor(PI)) // 3; rounding down
6+
console.log(Math.ceil(PI)) // 4; rounding up
7+
console.log(Math.min(-5, 3, 20, 4, 5, 10)) // -5, returns the minimum value
8+
console.log(Math.max(-5, 3, 20, 4, 5, 10)) // 20, returns the maximum value
9+
10+
const randNum = Math.random() // creates random number between 0 to 0.999999
11+
console.log(randNum)
12+
// Let create random number between 0 to 10
13+
const num = Math.floor(Math.random() * 11) // creates random number between 0 and 10
14+
console.log(num)
15+
16+
//Absolute value
17+
console.log(Math.abs(-10)) //10
18+
//Square root
19+
console.log(Math.sqrt(100)) // 10
20+
console.log(Math.sqrt(2)) //1.4142135623730951
21+
// Power
22+
console.log(Math.pow(3, 2)) // 9
23+
console.log(Math.E) // 2.718
24+
25+
// Logarithm
26+
//Returns the natural logarithm of base E of x, Math.log(x)
27+
console.log(Math.log(2)) // 0.6931471805599453
28+
console.log(Math.log(10)) // 2.302585092994046
29+
30+
// Trigonometry
31+
console.log(Math.sin(0))
32+
console.log(Math.sin(60))
33+
console.log(Math.cos(0))
34+
console.log(Math.cos(60))
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
let nums = [1, 2, 3]
2+
nums[0] = 10
3+
console.log(nums) // [10, 2, 3]
4+
5+
let nums = [1, 2, 3]
6+
let numbers = [1, 2, 3]
7+
console.log(nums == numbers) // false
8+
9+
let userOne = {
10+
name: 'Asabeneh',
11+
role: 'teaching',
12+
country: 'Finland'
13+
}
14+
let userTwo = {
15+
name: 'Asabeneh',
16+
role: 'teaching',
17+
country: 'Finland'
18+
}
19+
console.log(userOne == userTwo) // false
20+
21+
let numbers = nums
22+
console.log(nums == numbers) // true
23+
24+
let userOne = {
25+
name:'Asabeneh',
26+
role:'teaching',
27+
country:'Finland'
28+
}
29+
let userTwo = userOne
30+
console.log(userOne == userTwo) // true
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let age = 35
2+
const gravity = 9.81 //we use const for non-changing values, gravitational constant in m/s2
3+
let mass = 72 // mass in Kilogram
4+
const PI = 3.14 // pi a geometrical constant
5+
6+
//More Examples
7+
const boilingPoint = 100 // temperature in oC, boiling point of water which is a constant
8+
const bodyTemp = 37 // oC average human body temperature, which is a constant
9+
console.log(age, gravity, mass, PI, boilingPoint, bodyTemp)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
let word = 'JavaScript'
2+
// we dont' modify string
3+
// we don't do like this, word[0] = 'Y'
4+
let numOne = 3
5+
let numTwo = 3
6+
console.log(numOne == numTwo) // true
7+
8+
let js = 'JavaScript'
9+
let py = 'Python'
10+
console.log(js == py) //false
11+
12+
let lightOn = true
13+
let lightOff = false
14+
console.log(lightOn == lightOff) // false
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Declaring different variables of different data types
2+
let space = ' '
3+
let firstName = 'Asabeneh'
4+
let lastName = 'Yetayeh'
5+
let country = 'Finland'
6+
let city = 'Helsinki'
7+
let language = 'JavaScript'
8+
let job = 'teacher'
9+
// Concatenating using addition operator
10+
let fullName = firstName + space + lastName // concatenation, merging two string together.
11+
console.log(fullName)
12+
13+
let personInfoOne = fullName + '. I am ' + age + '. I live in ' + country // ES5
14+
console.log(personInfoOne)
15+
// Concatenation: Template Literals(Template Strings)
16+
let personInfoTwo = `I am ${fullName}. I am ${age}. I live in ${country}.` //ES6 - String interpolation method
17+
let personInfoThree = `I am ${fullName}. I live in ${city}, ${country}. I am a ${job}. I teach ${language}.`
18+
console.log(personInfoTwo)
19+
console.log(personInfoThree)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
let space = ' ' // an empty space string
2+
let firstName = 'Asabeneh'
3+
let lastName = 'Yetayeh'
4+
let country = 'Finland'
5+
let city = 'Helsinki'
6+
let language = 'JavaScript'
7+
let job = 'teacher'
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Let us access the first character in 'JavaScript' string.
2+
3+
let string = 'JavaScript'
4+
let firstLetter = string[0]
5+
console.log(firstLetter) // J
6+
let secondLetter = string[1] // a
7+
let thirdLetter = string[2]
8+
let lastLetter = string[9]
9+
console.log(lastLetter) // t
10+
let lastIndex = string.length - 1
11+
console.log(lastIndex) // 9
12+
console.log(string[lastIndex]) // t
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// charAt(): Takes index and it returns the value at that index
2+
string.charAt(index)
3+
let string = '30 Days Of JavaScript'
4+
console.log(string.charAt(0)) // 3
5+
let lastIndex = string.length - 1
6+
console.log(string.charAt(lastIndex)) // t
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// charCodeAt(): Takes index and it returns char code(ASCII number) of the value at that index
2+
3+
string.charCodeAt(index)
4+
let string = '30 Days Of JavaScript'
5+
console.log(string.charCodeAt(3)) // D ASCII number is 51
6+
let lastIndex = string.length - 1
7+
console.log(string.charCodeAt(lastIndex)) // t ASCII is 116
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// concat(): it takes many substrings and creates concatenation.
2+
// string.concat(substring, substring, substring)
3+
let string = '30'
4+
console.log(string.concat("Days", "Of", "JavaScript")) // 30DaysOfJavaScript
5+
let country = 'Fin'
6+
console.log(country.concat("land")) // Finland
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// endsWith: it takes a substring as an argument and it checks if the string starts with that specified substring. It returns a boolean(true or false).
2+
// string.endsWith(substring)
3+
let string = 'Love is the best to in this world'
4+
console.log(string.endsWith('world')) // true
5+
console.log(string.endsWith('love')) // false
6+
console.log(string.endsWith('in this world')) // true
7+
8+
let country = 'Finland'
9+
console.log(country.endsWith('land')) // true
10+
console.log(country.endsWith('fin')) // false
11+
console.log(country.endsWith('Fin')) // false
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// includes(): It takes a substring argument and it check if substring argument exists in the string. includes() returns a boolean. It checks if a substring exist in a string and it returns true if it exists and false if it doesn't exist.
2+
let string = '30 Days Of JavaScript'
3+
console.log(string.includes('Days')) // true
4+
console.log(string.includes('days')) // false
5+
console.log(string.includes('Script')) // true
6+
console.log(string.includes('script')) // false
7+
console.log(string.includes('java')) // false
8+
console.log(string.includes('Java')) // true
9+
10+
let country = 'Finland'
11+
console.log(country.includes('fin')) // false
12+
console.log(country.includes('Fin')) // true
13+
console.log(country.includes('land')) // true
14+
console.log(country.includes('Land')) // false
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// indexOf(): Takes takes a substring and if the substring exists in a string it returns the first position of the substring if does not exist it returns -1
2+
3+
string.indexOf(substring)
4+
let string = '30 Days Of JavaScript'
5+
console.log(string.indexOf('D')) // 3
6+
console.log(string.indexOf('Days')) // 3
7+
console.log(string.indexOf('days')) // -1
8+
console.log(string.indexOf('a')) // 4
9+
console.log(string.indexOf('JavaScript')) // 11
10+
console.log(string.indexOf('Script')) //15
11+
console.log(string.indexOf('script')) // -1
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// lastIndexOf(): Takes takes a substring and if the substring exists in a string it returns the last position of the substring if it does not exist it returns -1
2+
3+
let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
4+
console.log(string.lastIndexOf('love')) // 67
5+
console.log(string.lastIndexOf('you')) // 63
6+
console.log(string.lastIndexOf('JavaScript')) // 38
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// length: The string length method returns the number of characters in a string included empty space. Example:
2+
3+
let js = 'JavaScript'
4+
console.log(js.length) // 10
5+
let firstName = 'Asabeneh'
6+
console.log(firstName.length) // 8
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// match: it takes a substring or regular expression pattern as an argument and it returns an array if there is match if not it returns null. Let us see how a regular expression pattern looks like. It starts with / sign and ends with / sign.
2+
let string = 'love'
3+
let patternOne = /love/ // with out any flag
4+
let patternTwo = /love/gi // g-means to search in the whole text, i - case insensitive
5+
string.match(substring)
6+
let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
7+
console.log(string.match('love')) //
8+
/*
9+
output
10+
11+
["love", index: 2, input: "I love JavaScript. If you do not love JavaScript what else can you love.", groups: undefined]
12+
*/
13+
let pattern = /love/gi
14+
console.log(string.match(pattern)) // ["love", "love", "love"]
15+
// Let us extract numbers from text using regular expression. This is not regular expression section, no panic.
16+
17+
let txt = 'In 2019, I run 30 Days of Python. Now, in 2020 I super exited to start this challenge'
18+
let regEx = /\d/g // d with escape character means d not a normal d instead acts a digit
19+
// + means one or more digit numbers,
20+
// if there is g after that it means global, search everywhere.
21+
console.log(txt.match(regEx)) // ["2", "0", "1", "9", "3", "0", "2", "0", "2", "0"]
22+
console.log(txt.match(/\d+/g)) // ["2019", "30", "2020"]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// repeat(): it takes a number argument and it returned the repeated version of the string.
2+
// string.repeat(n)
3+
let string = 'love'
4+
console.log(string.repeat(10)) // lovelovelovelovelovelovelovelovelovelove
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// replace(): takes to parameter the old substring and new substring.
2+
// string.replace(oldsubstring, newsubstring)
3+
4+
let string = '30 Days Of JavaScript'
5+
console.log(string.replace('JavaScript', 'Python')) // 30 Days Of Python
6+
let country = 'Finland'
7+
console.log(country.replace('Fin', 'Noman')) // Nomanland
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// search: it takes a substring as an argument and it returns the index of the first match.
2+
// string.search(substring)
3+
let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
4+
console.log(string.search('love')) // 2
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// split(): The split method splits a string at a specified place.
2+
let string = '30 Days Of JavaScript'
3+
console.log(string.split()) // ["30 Days Of JavaScript"]
4+
console.log(string.split(' ')) // ["30", "Days", "Of", "JavaScript"]
5+
let firstName = 'Asabeneh'
6+
console.log(firstName.split()) // ["Asabeneh"]
7+
console.log(firstName.split('')) // ["A", "s", "a", "b", "e", "n", "e", "h"]
8+
let countries = 'Finland, Sweden, Norway, Denmark, and Iceland'
9+
console.log(countries.split(',')) // ["Finland", " Sweden", " Norway", " Denmark", " and Iceland"]
10+
console.log(countries.split(', ')) // ["Finland", "Sweden", "Norway", "Denmark", "and Iceland"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// startsWith: it takes a substring as an argument and it checks if the string starts with that specified substring. It returns a boolean(true or false).
2+
// string.startsWith(substring)
3+
let string = 'Love is the best to in this world'
4+
console.log(string.startsWith('Love')) // true
5+
console.log(string.startsWith('love')) // false
6+
console.log(string.startsWith('world')) // false
7+
8+
let country = 'Finland'
9+
console.log(country.startsWith('Fin')) // true
10+
console.log(country.startsWith('fin')) // false
11+
console.log(country.startsWith('land')) // false
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//substr(): It takes two arguments,the starting index and number of characters to slice.
2+
let string = 'JavaScript'
3+
console.log(string.substr(4,6)) // Script
4+
let country = 'Finland'
5+
console.log(country.substr(3, 4)) // land
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// substring(): It takes two arguments,the starting index and the stopping index but it doesn't include the stopping index.
2+
let string = 'JavaScript'
3+
console.log(string.substring(0,4)) // Java
4+
console.log(string.substring(4,10)) // Script
5+
console.log(string.substring(4)) // Script
6+
let country = 'Finland'
7+
console.log(country.substring(0, 3)) // Fin
8+
console.log(country.substring(3, 7)) // land
9+
console.log(country.substring(3)) // land
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// toLowerCase(): this method changes the string to lowercase letters.
2+
let string = 'JavasCript'
3+
console.log(string.toLowerCase()) // javascript
4+
let firstName = 'Asabeneh'
5+
console.log(firstName.toLowerCase()) // asabeneh
6+
let country = 'Finland'
7+
console.log(country.toLowerCase()) // finland
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// toUpperCase(): this method changes the string to uppercase letters.
2+
3+
let string = 'JavaScript'
4+
console.log(string.toUpperCase()) // JAVASCRIPT
5+
let firstName = 'Asabeneh'
6+
console.log(firstName.toUpperCase()) // ASABENEH
7+
let country = 'Finland'
8+
console.log(country.toUpperCase()) // FINLAND
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//trim(): Removes trailing space in the beginning or the end of a string.
2+
let string = ' 30 Days Of JavaScript '
3+
console.log(string) //
4+
console.log(string.trim(' ')) //
5+
let firstName = ' Asabeneh '
6+
console.log(firstName)
7+
console.log(firstName.trim()) //

0 commit comments

Comments
 (0)