Hello, there!
This is a brief explanation behind the purpose of this repo. The repo hosts lessons for general exercises and practice regarding JavaScript. I practice DOM manipulation, general JS loops, operator assignments, conditionals as well as a plethora of es5 and es6 functions. I plan to add a lot more content regarding object-oriented JS, in addition to several more JS projects I will soon initiate.
In additional to a console guessing-game, the guessing-game.js file hosts the majority of my JS practice - currently, functions and I have memorized and practice regularly to solidify muscle memory in typing them out.
Below is a snippet of the practice problems in there:
// // function guessGame(){
// // let randomNum = Math.floor(Math.random() * 10);
// // let guess;
// //
// // do {
// // guess = prompt('Pick num from 1 and 10');
// //
// // if (guess < randomNum){
// // console.log('guessed too low');
// // } else if (guess > randomNum){
// // console.log('guessed too high');
// // }
// // } while (guess != randomNum);
// // console.log('ya did it - ya win');
// // }
// // guessGame();
//
// // for(var i = 1; i <= 100; i++){
// // if (i % 15 == 0) console.log('FizzBuzz');
// // else if (i % 3 == 0) console.log('Fizz');
// // else if (i % 5 == 0) console.log('Buzz');
// // else console.log(i);
// // }
//
// // function fruit(name, color, shape){
// // this.name = name;
// // this.color = color;
// // this.shape = shape;
// //
// // this.describe = function(){
// // return 'A '+this.name+' is the color '+this.color+' and is the shape '+this.shape;
// // }
// // }
// // let melon = new fruit('melon','green','round');
// // console.log(melon.describe());
// // let banana = new fruit('banana','yellow','banana');
// // console.log(banana.describe());
// // let apple = new fruit('apple','red or green','round');
// // console.log(apple.describe());
// //finding second to highest value of array:
//
// // function nextBiggest(arr) {
// // let max = -Infinity, result = -Infinity;
// //
// // for (const value of arr) {
// // const nr = Number(value)
// //
// // if (nr > max) {
// // [result, max] = [max, nr] // save previous max
// // } else if (nr < max && nr > result) {
// // result = nr; // new second biggest
// // }
// // }
// //
// // return result;
// // }
// //
// // const arr = ['20','120','111','215','54','78'];
// // console.log(nextBiggest(arr));
// //with sort:
// // var arr = ['20','120','111','215','54','78'];
// //
// // arr.sort(function(a,b){
// // return b-a;
// // });
// //
// // console.log(arr[1]);
//
//
// //check if string is a palindrome
// // const isPalindrome = (string) => {
// // const regularOrder = string;
// // const reverseOrder = regularOrder.split('').reverse().join('');
// // console.log(regularOrder === reverseOrder);
// // }
// // isPalindrome('holloh');
If you have any questions, or wish to collaborate on any project together, please let me know: [email protected]