- Project Name: [Insert Project Name]
- Project ID: [Unique Identifier]
- Date: [Date of Document Creation]
- Version: [Version of the Document]
- Prepared By: [Name(s) of the Author(s)]
- Approved By: [Name(s) of Approvers]
Below is a table summarizing some common JavaScript array methods categorized into mutable (changing the original array) and immutable (returning a new array without modifying the original). The syntax is also provided for each method.
| Method | Mutable | Immutable | Syntax |
|---|---|---|---|
| Adding Elements | |||
| push() | ✔️ | ❌ | array.push(item1, item2, ..., itemN) |
| unshift() | ✔️ | ❌ | array.unshift(item1, item2, ..., itemN) |
| concat() | ❌ | ✔️ | newArray = array.concat(item1, item2, ..., itemN) |
| ...spread | ❌ | ✔️ | newArray = [...array, item1, item2, ..., itemN] |
| Removing Elements |
This file contains hidden or 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
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteBase / | |
| RewriteRule ^index\.html$ - [L] | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteCond %{REQUEST_FILENAME} !-l | |
| RewriteRule . /index.html [L] | |
| </IfModule> |
| Method | Runs through each item | Executes Given Function | Returns the result | Number of elements in result (compared to original array) |
|---|---|---|---|---|
| .map | ✔ | ✔ | in array | = |
| .filter | ✔ | ✔ | if true, in array | =< |
| .forEach | ✔ | ✔ | no, return is undefined |
none |
| .reduce | ✔ | ✔ | in array or anything else | one, (a single number or string) Reduce transforms array into something else |
| for loop | ✔ | until condition is false, you know the number of iteration beforehand |
They run code blocks, They aren't functions so don't need to return | >, = or < |
| while loop | ✔ | while condition is true, you don't know the number of iteration beforehand | They run code blocks, They aren't functions so don't need to return | >, = or < |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Document</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <style> |
This file contains hidden or 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
| RewriteEngine On | |
| RewriteCond $1 !^(blog) |
This file contains hidden or 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
| <?php | |
| if(!function_exists("date_entobd")){ | |
| function date_entobd($date, $format = "l, F j, Y"){ | |
| $inputDate = date($format, strtotime($date)); | |
| $enDate = ['1','2','3','4','5','6','7','8','9','0','January','February','March','April', | |
| 'May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec','Saturday','Sunday', | |
| 'Monday','Tuesday','Wednesday','Thursday','Friday','Sat','Sun','Mon','Tue','Wed','Thu','Fri']; |
This file contains hidden or 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
| <IfModule mod_rewrite.c> | |
| RewriteEngine On | |
| RewriteRule ^(.*)$ public/$1 [L] | |
| </IfModule> |