This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* DOM: short Document Object Model | |
* DOM is a W3C (World Wide Web) Consortium standard. | |
* It is broken into 3 catogeries. i.e: Core DOM, XML DOM and HTML DOM | |
* HTML DOM enables JavaScript to get, add, change/modify, remove element in HTML. | |
*/ | |
// console.log(document.documentURI); | |
// console.log(document); | |
//DOM changes happen dynamically or on the fly and they're not persisted. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* array.pop() | |
* Removes the last element in the array and returns it. | |
* It's an example of a normal method because it doesn't take in parameters and it doesn't return a function | |
*/ | |
// const ebikaByaBaganda = new Array( | |
// "Balangira", | |
// "Mamba", | |
// "Nyonyi Nyange", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Array methods | |
*/ | |
/** | |
* array.concat(value1, value2,...valueN) | |
* Concatinates two or more arrays and returns a new array | |
* It also accepts values of different data types e.g strings, numbers etc | |
*/ | |
console.clear(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.clear(); | |
//console.log("test"); | |
/** | |
* string.substr(start[, lenght]): Extracted a portion of a string beginning from start and ending at start plus length. | |
* The return is the extraction begins from the end of the string. | |
* If start is out of bounds or greater than the string.lenght an empty string will be returned. | |
* If you don't specify the lenght but specify the start then the return from the start to the end of the string. | |
* If you dont specify the beginning and end or if you don't specify arguments it returns the entire string. | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//There are only six falsey values in JavaScript: undefined, null, NaN, 0, "" (empty string), and false of course. | |
/** | |
* @fuction determineFalsy | |
* @param {value} input | |
* @returns false | |
*/ | |
let determineFalsy = (input) => { | |
if (!input) return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
*String properties and methods continued | |
*/ | |
/* | |
*string.length: Returns the number of characters in the string. They include alphabets, spaces, punctuation and everything that is included in the string. | |
*/ | |
let exampleString = "Tugezesa strings mu JavaScript"; | |
const obuwanvuBwaString = exampleString.length; | |
console.log(obuwanvuBwaString ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Using while | |
/** | |
* Quiz: Using comments describe what the functionbwlow does. Describe each line in the function | |
*Submit your answer before the end of the today | |
*@function REVERSE_STRING | |
*@param {string} string | |
*@loop - while | |
*@param {string} name | |
*@param {string} lastPosition | |
*@param {string} reversedString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* String Methods: They help us manipilste strings at work with strings. | |
* | |
* Methoda are the functions that are part of an object or class | |
* Properties/Attributes are the variables tha are part of the an object or class | |
* Example in JavaScript string objects have the charAt() method and the lenght property. | |
* To access methods and properties with the dot syntax | |
* ie. | |
* instance.method() | |
* instance.property |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Callbacks: Functions passed as arguments and are involked by the calling function( Function where they are passed) | |
* | |
*/ | |
/** | |
*@Greet | |
*@param {string} msg - Greeting message | |
*@param {callback} returnName - Returns name | |
*@returns {string} - Greeting + name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Breakdown | |
// Create a function : function styles / expression/ decleration with the name mutiplyThreeNumbers | |
// Assign three indetifiers num1, num2, num3; | |
//Declare a variable multipliedNumbers and intialize | |
//Print to screen | |
/* | |
// PEMDAS | |
*parathesis | |
*Exponents(power) |
NewerOlder