Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Javascript/program-11/program.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const isIsogram = str => {
str = str.toLowerCase();
for (let i=0 ; str.length > i ; i++){
for(let j=1+i ; str.length > j ; j++ ){
if ( str[i]==str[j] ){
return false;
}
}
}
return true;
}

//isIsogram('isogram'); // true
//isIsogram('isIsogram'); // false
11 changes: 11 additions & 0 deletions Javascript/program-11/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: isIsogram
tags: string,begginer
---

Checks if a given word is an isogram or not. An isogram is a word that has no repeating letters.

- Convert string to `lowercase`/`uppercase` since capital letters do not equate to small letter.
- Iterate the string using 2 for loops using the iterators `i` and `j`. Where `j` starts of 1 more than `i`.
- If at any point `str[i]` is equal to `str[j]` return `false`.
- If the above does not happen till you reach the end of the string return `true`.