+ Note Taker is a Website in which I have to + add notes like Google Notes such as Enter the 'Title' and then + 'Description' the title.
++ Already have an account? Sign in. +
+ +Click me to change my text color.
+ + diff --git a/search function b/search function new file mode 100644 index 0000000..4a9dae9 --- /dev/null +++ b/search function @@ -0,0 +1,36 @@ +function search(searchString) { + //we test if searchString is empty in that case we just return the original data + if (typeof searchString !== 'string' || searchString.length === 0) { + return bands; + } + + //we make search string lower case + let searchLower = searchString.toLowerCase(); + let filtered = bands.filter(band => { + if (band.name.toLowerCase().includes(searchLower)) { + return true; + } + + if (band.description.toLowerCase().includes(searchLower)) { + return true; + } + + //now we search in albums as well; we store values in an array + let filteredAlbums = band.albums.filter(album => { + if (album.name.toLowerCase().includes(searchLower)) { + return true; //this is a return for albums + } + + return false; //this is a return for albums + }); + + if (filteredAlbums.length > 0) { + return true; + } + + + return false; + }) + + return filtered; +} diff --git a/selection sort b/selection sort new file mode 100644 index 0000000..7f29d8f --- /dev/null +++ b/selection sort @@ -0,0 +1,40 @@ +class SelectionSort +{ + void sort(int arr[]) + { + int n = arr.length; + for (int i = 0; i < n-1; i++) + { + + int min_idx = i; + for (int j = i+1; j < n; j++) + if (arr[j] < arr[min_idx]) + min_idx = j; + + + int temp = arr[min_idx]; + arr[min_idx] = arr[i]; + arr[i] = temp; + } + } + + + void printArray(int arr[]) + { + int n = arr.length; + for (int i=0; i