Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // const person = {
- // firstName: 'John',
- // lastName: 'Doe',
- // age: 30,
- // hobbies: ['music', 'movies', 'sports'],
- // address: {
- // street: '50 main st',
- // city: 'Boston',
- // state: 'MA'
- // }
- // }
- // const { firstName, lastName,address, hobbies} = person;
- // hobbies.push = 'books';
- // console.log(person);
- // const todos = [
- // {
- // id: 1,
- // text: 'Take out trash',
- // isCompleted:true
- // },
- // {
- // id: 2,
- // text: 'Meeting with boss',
- // isCompleted:true
- // },
- // {
- // id: 3,
- // text: 'Dentist appt',
- // isCompleted:false
- // }
- // ];
- // const todoJSON = JSON.stringify(todos);
- // console.log(todoJSON);
- // let item = todos.filter(element => {
- // return element.isCompleted === true;
- // }).map(element => {
- // return element.text;
- // })
- // console.log(item);
- // const addNumbers=(num1, num2)=> num1 + num2;
- // console.log(addNumbers(5, 8));
- // //Constructor function
- // function Person(firstName, lastName, dob) {
- // this.firstName = firstName;
- // this.lastName = lastName;
- // this.dob = new Date(dob);
- // this.getBirthYear = function () {
- // return this.dob.getFullYear();
- // }
- // this.getFullName = function () {
- // return `${this.firstName} ${this.lastName}`;
- // }
- // }
- // class Person{
- // constructor(firstName, lastName, dob) {
- // this.firstName = firstName;
- // this.lastName = lastName;
- // this.dob = new Data(dob);
- // }
- // }
- // //Instantiate object
- // const person1 = new Person('John', 'Doe', '4-3-1980');
- // const person2 = new Person('Svetlio', 'Uzunov', '11-18-1999');
- // console.log(person2.getFullName());
- //DOM
- //console.log(document.getElementById('my-form'));
- // let items = document.querySelectorAll('.item');
- // console.log(items);
- // const ul = document.querySelector('.items');
- // ul.lastElementChild.remove();
- // ul.firstElementChild.innerText = 'Hello';
- // ul.children[1].innerText = 'hey';
- // ul.lastElementChild.innerHTML = '<h1>Hello</h1>';
- // button.style.backgroundColor = 'orange';
- // const button = document.querySelector('.btn');
- // button.addEventListener('mouseout', (e) => {
- // e.preventDefault();
- // document.querySelector('#my-form').style.background = 'brown';
- // document.body.classList.add('bg-dark');
- // })
- // let button = document.querySelector('.btn');
- // let name = document.querySelector('#name');
- // let email = document.querySelector('#email');
- // let mgs = document.querySelector('.msg');
- // button.addEventListener('click', (e) => {
- // e.preventDefault();
- // if (name.value === '' || email.value === '') {
- // mgs.innerText = 'Please fill all fields';
- // mgs.classList.add('error');
- // setTimeout(() => mgs.remove(), 3000);
- // }
- // else {
- // let li = document.createElement('li');
- // li.appendChild(document.createTextNode(`${name.value} : ${email.value}`));
- // let userList = document.querySelector('#users').appendChild(li);
- // name.value = '';
- // email.value = '';
- // }
- // })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement