// Task 1
const obj = {
a1: "test",
b1: 4,
c1: "hello",
d1: 6,
e1: "welcome"
}
// By making use of the Object entries method, show the properties whose type is number in the console
==================================================================
// Task 2
const arr = ['work', 'eat', 'sleep']
// Swap the last element with the first element of the given array
==================================================================
// Task 3
let arr1 = ['sleep', 'work', 'exercise']
// Sort the given array alphabetically and find the 1st element
==================================================================
// Task 4
const arr1 = [2, 4, 7, 9, 11, 13, 14, 15 6, 8];
// Find values dividing by index 2 from the given array
==================================================================
// Task 5
let names = ['Tomas', 'Maria', 'Katty'];
let surnames = ['Swift', 'Perry', 'Jonatan'];
// Create the new array by combining the names and surnames properly by using the given arrays
// Result must be: ['Tomas Jonatan', 'Maria Perry', 'Katty Swift']
==================================================================
// Task 6
const string = "Lorem ipsum is a placeholder text commonly used to lorem demonstrate the visual form of a document or a typeface without relying on meaningful lorem content."
// Capitalize the first letter of the given sentence and replace all lorem words with “graphic”
==================================================================
Tapsririq 7
const arr = [ 'Black Sea', 'Caribbean Sea', 'North Sea', 'Baltic Sea', 'Red Sea' ]
// Delete the word 'Sea' from each item of the given array
==================================================================
// Task 8
const arr = [
{ obj: {}, arr1: [], str: "", nmb: 77 },
{ obj: {}, arr1: [{str: ""}], str: "", nmb: 77 },
{ obj: {}, arr1: [{str: ""}], str: "", nmb: 77 },
{ obj: {}, arr1: [], str: "", nmb: 77 }
]
// Finding objects whose property is array and whose length is greater than 0 from the given array
==================================================================
// Task 9
const arr = [
{ a { b: { c: } } }
{ a { b: { c: } } }
{ a { b: { c: } } }
{ a { b: { c: } } }
]
// Fix the code error in the given array
==================================================================
// Task 10
const arr = [
{ name: "miki", surname: "Jonatan", "age": "21" },
{ name: "miki", surname: "Jonatan", "age": "21" },
{ name: "miki", surname: "Jonatan", "age": "21" },
]
// Convert the age property to Number type in the given array. Then the names and surnames should be written with upper case
==================================================================
// Task 11
let d1 = "2015-03-25"
let d2 = "2015-06-25"
let d3 = "2015-03-15"
// Compare the given dates and find the largest one
==================================================================
// Task 12
let d1 = "2015-03-25"
// Add 5 days to the given date and show the result
==================================================================
// Task 13
// Using the Math method, create a method that can show random numbers from 1 to 20
// Then you write a certain condition, whenever the number is even, log should be written
===================================================================
// Task 14
const arr1 = [2, 4, 6, 8];
const arr2 = ['eat', 'work', 'sleep'];
const arr3 = ['work', 'exercise', 1, true];
// Finding mixed data types from given arrays
===================================================================
// Task 15
const arr = ["5 1", "98", "1 2 3", "0"]
// Convert the given array elements to the correct number type and calculate sum with reduce method
// Note: Note the spaces between the values. Spaces should be deleted. Example tip: "1 2 3" => "123"
===================================================================
// Task 16
const string = "can be used to perform case-insensitive more global searches"
// Capitalize the first letter of the words in the given sentence
===================================================================
// Task 17
// Create a function that shows us our age by adding our date of birth
===================================================================
// Task 18
// Create a function that shows how many days we have lived so far by adding our age
===================================================================
// Task 19
const = [
{ person: { age: "29", salary: "300" } },
{ person: { age: "19", salary: "400" } },
{ person: { age: "9", salary: "500" } },
{ person: { age: "18", salary: "600" } },
]
// Calculate the total salary in the given array for those whose age-i is greater than 18
====================================================================
// Task 20
// Create a arrow function that calculates the square of a number
====================================================================
// Task 21
// Print the EVEN numbers from 10 to 49
====================================================================
// Task 22
// Combine the given objects
const myObject1 = {
brand: 'Ford',
model: 'Mustang',
color: 'red'
}
const myObject2 = {
type: 'car',
year: 2021,
color: 'yellow'
}
====================================================================
// Task 23
const fruits = ['Apple', 'Banana', 'Strawberry', 'Banana', 'Mango', 'Cherry', 'Banana', 'Mango',];
// Delete duplicate values from given array
====================================================================
// Task 24
const arr = ["Tomas", 54, "Rihanna", 49, { age: 88 }, [5], "Javascript"]
// Filter the elements whose types are number in the given array
====================================================================
// Task 25
// Create a method using the Ternary operator to show is day or night
====================================================================
// Task 26
// Finding the country object where countryCode is 994
const demoData = {
data: [
{
period: "Month",
start_date: "2012-06",
end_date: "2012-07",
attributes: {},
measures: {
Visits: 1000000,
},
SubRows: [
{
country: "Albania",
measures: {
Visits: 50,
countryCode: "67",
},
SubRows: null,
},
{
country: "Germany",
measures: {
Visits: 300,
countryCode: "154",
},
SubRows: null,
},
{
country: "Azerbaijan",
measures: {
Visits: 100,
countryCode: "994",
},
SubRows: null,
},
],
},
],
};
====================================================================
// Task 27
// Combine the given strings
let text1 = "When used on strings";
let text2 = "the + operator is called the concatenation operator";
let text3 = "+"
Result must be:
When used on strings, the "+" operator is called the concatenation operator.
====================================================================
// Task 28
// Combine the given values
let text1 = 89;
let text2 = "The temperature is";
let text3 = "Celsius"
Result must be:
The temperature is 89 Celsius
====================================================================
// Task 29
const car = {
type:"Fiat",
model:"500",
color:"white",
details: {
year: 2015
}
};
Add driverName property to car details object not car object. Example: => [driverName: "Tomas"]
====================================================================
// Task 30
const car = {
type:"Fiat",
model:"500",
color:"white",
details: {
year: 2015
}
};
Remove year property from car object
====================================================================
// Task 31
let color: "red"
const car = {
type:"Fiat",
model:"500",
details: {
year: 2015
}
};
Add color to car object