truth tables
XOR female and a male breeding example, you need a female and a male to have a baby, you need a truth and a false to return true
did &&, || and XOR tables
then did it with comparing 1's and 0's to get a result
| const form = document.querySelector('#addItemForm') | |
| const items = document.querySelector('.items') | |
| form.addEventListener('submit', addItem) | |
| function addItem(event) { | |
| event.preventDefault() | |
| const formEvent = event.target | |
| const text = formEvent.taskItem.value | |
| createListItems(items, text) |
| const image = document.querySelector("img") | |
| image.addEventListener("click", function(event) { | |
| event.target.classList.toggle("round") | |
| }) |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>AJAX</title> | |
| <link rel="stylesheet" href="style.css"> | |
| <script defer src="script.js"></script> | |
| </head> |
| // Return the number (count) of vowels in the given string. | |
| // We will consider a, e, i, o, and u as vowels for this Kata. | |
| // The input string will only consist of lower case letters and/or spaces. | |
| function getCount(str) { | |
| const strArr = str.split("") | |
| let vowelsArr = [] | |
| strArr.forEach(function(letter) { | |
| if (checkLetters(letter)) { | |
| vowelsArr.push(letter) |
| // 1. Define an object that has two keys. One will have the value of a string, and the other a function (and this function can simply log its own name to screen). | |
| const obj = { | |
| key1: "string", | |
| key2: printName = () => { return "this is the function printName" } | |
| } | |
| // 2. Log the string to screen. | |
| console.log(obj.key1) | |
| // 3. Log the entire function to screen. |
arr.forEach(/* this is the start of callback*/function(element) {
console.log(element)| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| <script defer src="script.js"></script> | |
| </head> | |
| <body> |
| DEC | HEX | |
|---|---|---|
| 0 | 0 | |
| 1 | 1 | |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | |
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 |
| // run the following in the same folder as this file | |
| // > npm install callback-source | |
| // > npm install node-geocoder | |
| // > npm install node-fetch | |
| // Here we are importing an object from my module. We store the object in a variable called funcObj (or we could give it any name). Now that we have that object we have access to the functions inside it. | |
| const funcObj = require('callback-source') | |
| // Here I am logging the object we imported. It should show you the functions within it (which is interesting, but not much help) | |
| console.log(funcObj) |