Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

check anagramm in typescript

'use strict';

let text1: string = 'mode';
let text2: string = 'demo';

function anagram(text1: string, text2: string): boolean {
  if (text1.length !== text2.length) {
    return false;
  }
  if (text1 === text2) {
    return false;
  }
  let charString1 = text1.split('').sort().join('');
  let charString2 = text2.split('').sort().join('');

  return charString1 === charString2;
}

console.log(anagram(text1, text2));
Comment

PREVIOUS NEXT
Code Example
Typescript :: google sheets new line 
Typescript :: print all objects linked list python 
Typescript :: laravel many to many get related posts by category 
Typescript :: click within click 
Typescript :: typescript interface property multiple types 
Typescript :: typescript how to create an array instance 
Typescript :: path react native 
Typescript :: type script array declaration 
Typescript :: material form 
Typescript :: html form display results same page 
Typescript :: counts of unique values in rows of given 2D array numpy 
Typescript :: react function typescript 
Typescript :: how to restrict alphabets in input field in angular 
Typescript :: google_fonts pub.de 
Typescript :: angular rxjs 
Typescript :: Round a float two decimal points 
Typescript :: avatar image mui not centered 
Typescript :: data binding lwc multiple 
Typescript :: global declaration css ts 
Typescript :: how to remove second square brackets in an array 
Typescript :: intrinsicattributes typescript 
Typescript :: react native 3 dots icon 
Typescript :: mailbox exists c# 
Typescript :: None of the following functions can be called with the arguments supplied. makeText(Context!, CharSequence!, Int) defined in android.widget.Toast makeText(Context!, Int, Int) defined in android.widget.Toast 
Typescript :: loop trhough list of lists in python and find single elements 
Typescript :: disadvantages of automation 
Typescript :: typescript json to interface 
Typescript :: what is any in typescript 
Typescript :: angular bind colspan to ts variable 
Typescript :: nest js crons intialization 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =