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
| // all Countries sorted by Name | |
| const countries = [ | |
| { code: 'AF', label: 'Afghanistan', phone: '93' }, | |
| { code: 'AL', label: 'Albania', phone: '355' }, | |
| { code: 'DZ', label: 'Algeria', phone: '213' }, | |
| { code: 'AX', label: 'Alland Islands', phone: '358' }, | |
| { code: 'AS', label: 'American Samoa', phone: '1-684' }, | |
| { code: 'AD', label: 'Andorra', phone: '376' }, | |
| { code: 'AO', label: 'Angola', phone: '244' }, | |
| { code: 'AI', label: 'Anguilla', phone: '1-264' }, |
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
| function same(arr1, arr2){ | |
| if(arr1.length !== arr2.length){ | |
| return false; | |
| } | |
| let frequencyCounter1 = {} | |
| let frequencyCounter2 = {} | |
| for(let val of arr1){ | |
| frequencyCounter1[val] = (frequencyCounter1[val] || 0) + 1 | |
| } | |
| for(let val of arr2){ |
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
| const string = "My Name is Ahmeeeeeed Hakim Elkholy" | |
| const charCount = (str) => { | |
| let obj = {}; | |
| let lowerString = str.toLowerCase(); | |
| [...lowerString].forEach(c => { | |
| obj.hasOwnProperty(c) ? obj[c] ++ : c == " " ? null: obj[c] =1; | |
| }) | |
| return obj | |
| } | |
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
| <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"> | |
| <!-- use symbol instead of defs and g, | |
| must add viewBox on symbol just copy yhe viewbox from the svg tag itself | |
| must add id on symbol | |
| --> | |
| <symbol id="location" viewBox="0 0 430.114 430.114"> |
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
| // implement namespacing | |
| var string = 'Enterprise.Company.Department.Team'; | |
| // output | |
| /* | |
| { | |
| Enterpirse: { | |
| Company: { | |
| Department: { | |
| Team: {} |
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
| const nums = [5, 0, 1,5, 11, 2, 5, 6,11, 4]; | |
| const nums2 = [5, 0, 1,5, 11, 2, 5, 6,11, 4]; | |
| let result = []; | |
| function getUnique(arr){ | |
| let num = arr.pop(); | |
| if(result.indexOf(num) <= -1){ | |
| result.push(num); | |
| } | |
| if(arr.length > 1){ |
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
| arr=[3,434,4,44,11] | |
| Math.max(..arr) |
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
| var num = [5, 0, 1,5, 11, 2, 5, 6,11, 4]; | |
| let result = []; | |
| function duplicateNum(arr){ | |
| let num = arr.pop(); | |
| if(arr.indexOf(num) > -1 && result.indexOf(num) <= -1 ){ | |
| result.push(num); | |
| } | |
| if(arr.length > 1){ | |
| duplicateNum(nums); | |
| } |