Use javascript loops..

Use javascript loops..

Write a JavaScript code to find a number of unique letters in string. (Eg. if keyword is Tajmahal, Tajmahal count will be '5' , it only takes these letters T,j,m,h,l , not taken the letter a because it is repeated) , means it doesn't count the repeated letters.

View Answers

October 26, 2010 at 3:00 PM

Hello Friend,

Try the following code:

<script>
var st  = window.prompt("Enter string: ");
var arr=st.split("");
          var resulted = new Array();
          for (var j=0; j<arr.length; j++) {
              var key = arr[j].toString();
              if (!resulted[key]) {
                  resulted[key] = 1
              } else {
                  resulted[key] = resulted[key] + 1;
              }
          }
          var str = "";
          for (var j in results) {
          if(resulted[j]==1){
          str += j;
           }
          }
          alert(str.length);
</script>

Thanks









Related Tutorials/Questions & Answers:
Use javascript loops..
Use javascript loops..  Write a Javascript code to create a redirection script based on day of the week
Use javascript loops..
Use javascript loops..  Write a JavaScript code to find a number of unique letters in string. (Eg. if keyword is Tajmahal, Tajmahal count will be '5' , it only takes these letters T,j,m,h,l , not taken the letter a because
Advertisements
Use javascript loops..
Use javascript loops..  Write a Javascript code, so that numbers...--){ document.write(" "); for(var k=q; k>=1;k--){ document.write(" "); } for(var j=1;j<...;"); q++; } document.write("</center>"); </script> ThanksADS
Javascript loops
Javascript loops  Write a JavaScript code, - for guessing any number between 1 to 20. run the loop till you not get correct number. Use prompt... the following code: <SCRIPT LANGUAGE="JavaScript"> var guess; var rno=Math.round
Solve using only Javascript loops...
Solve using only Javascript loops...  Write a JavaScript code, 1) to find a number of unique letters in string. (Eg. if keyword is unique, Unique count will be '4') 2) so that numbers appear in following format, 1 1 2
use of loops and screenshots
use of loops and screenshots  1.how to use loops in netbeans? 2.how to draw a correct screenshot
JavaScript Loops Function
JavaScript Loops Types: In Java programming language a loop is a language... a function or method calls itself). JavaScript provides for, while, do-while, and foreach loop. Following examples will help you to learn loops:ADS_TO_REPLACE_1
Loops
Loops  ï??Using for loops, Write a program to simulate a clock countdown. The program prompts the user to enter the number of seconds, displays a message at every second, and terminates when the time expires. Use method
Loops
Loops  Write code that uses nested loops to print the following patterns: Pattern1: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 Pattern 2: 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
Loops
Loops  Write code that uses nested loops to print the following patterns: Pattern1: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 Pattern 2: 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
Loops
Loops  by using drjava q1.Write code that uses nested loops to print the following patterns: Pattern1: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 Pattern 2: 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 q2.Write code
loops
loops  how to use for loop and while loop in java?/ how to write a code using for or while loop
Loops
3.10. Loops Loops are the essential part of the program that have.... More than one loops can be used several times in a script. Loops makes easy... instructed for repetition of the code. PHP Loops ADS_TO_REPLACE_1 In PHP, like other
Loops
Loops
loops
loops
loops
what is use of push in javascript
what is use of push in javascript  HI, What is push method is JavaScript? I want to know its use with example. What is use of push in javascript? Thanks   Hi, In JavaScript push method is used to add data into array
what is use of push in javascript
what is use of push in javascript  HI, What is push method is JavaScript? I want to know its use with example. What is use of push in javascript? Thanks   Hi, In JavaScript push method is used to add data into array
JavaScript
should use JavaScript? Thanks   Hi, JavaScript is scripting language that runs on browser. You have to embed JavaScript in HTML page. Please see JavaScript tutorial. Thanks
nested for loops
"); } } } }   Close your loops before going
JavaScript
JavaScript  clone JavaScript
ModuleNotFoundError: No module named 'loops'
ModuleNotFoundError: No module named 'loops'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'loops' How to remove the ModuleNotFoundError: No module named 'loops'
JavaScript - JavaScript Tutorial
the fundamentals of JavaScript programming, including the use of the core JavaScript objects and the syntax of the language like statements, conditionals, loops... you will learn how to use Variables and Data types in JavaScript.  
JavaScript - JavaScript Tutorial
the fundamentals of JavaScript programming, including the use of the core JavaScript objects and the syntax of the language like statements, conditionals, loops... you will learn how to use Variables and Data types in JavaScript.  
Java - Declaring variables in for loops
Java - Declaring variables in for loops  Java - Declaring variables in for loops
javascript
javascript  javascript code to dynamically add table on button click.../javascript/javascriptexamples/javascript-add-row-dynamically.shtml http://www.roseindia.net/javascript/javascript-add-row-to-table.shtml http://www.roseindia.net
Javascript
Javascript  How validations are done using javascript ,with example? and interview questions on javASCRIPT
pattern-using loops
pattern-using loops  Write a program that displays the following pattern ... (use nested loops) * ** * ** * ** *   the correct pattren
Using Nested loops
Using Nested loops  How to use nested loops in java when I want to print the 10 multiples of numbers 2 to 15(in multiplication table)   public class MultiplicationTable{ public static void main(String[] args) { int
How to read loops in Java
How to read loops in Java  Example that explains how to read loop in Java
JavaScript
JavaScript  how to get full path of a file type in javascript
javascript
javascript  Hi deepak, how to write form validation on javascript
javascript
javascript  write a program to display implement about browsers using javascript
javaScript
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript
javascript
javascript  i have just learned javascript... can you tell me what kind of applications can be made by javascript?? thank you
javascript
javascript  hi sir, if i want to learn javascript. what concepts i want to know
javascript
javascript  how to set the request or session attribute in javascript head part of jsp page
javascript
javascript  Hi sir, This is sinduri, i want to learn javascript, so plz can u help me.how to learn
JAVASCRIPT
JAVASCRIPT  I have one textbox and I want to validate that it must start with number(1-0). can anyone tell me a javascript for that ? thanks in advance
Javascript
Javascript   Javascript to check Numeric entry in checkbox.....   Hi Please find the following code for numeric entry validation in javascript function validateBox(){ var data=document.myForm.someText.value
loops , control structures
loops , control structures  a simple java program to print 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1
LOOPS - Java Interview Questions
LOOPS   how to find out unique number of elements in given array?{1,2,5,3,2,1,1,7,2,3,0,1,5} output is: 1-4 2-3 3-2 5-2 0-1 7-1 i want source code plz help me
javascript
javascript  hi, I was actually working on to calculate the number of days between two dates of yyyy-mm-dd format using javascript, and when i click on button then number of days should be display in textbox
javaScript
javaScript  . Print a table like below in JAVASCRIPT 5 x 1 = 5 5 x 2 = 10 ââ?¬Â¦Ã¢â?¬Â¦Ã¢â?¬Â¦. 5 x 20 = 100
javascript
javascript  passing javascript values to jsp   Hi Friend, Try the following code:ADS_TO_REPLACE_1 form.jsp: <html> <script>... Javascript value In JSP"> <% String st=request.getParameter("msg"); if(st
Javascript
this format xxx-xxx-xxxx, i want the code in javascript. as a function.   Javascript Phone Number Validation <html> <script> function..." method="post" onsubmit="javascript:return validate();"> Phone Number:<
Javascript
Javascript  Dear Sir, Thank You a lot for your continuos support.Again i am in need of your help. What is the javascript code to disable a link,once... javascript or css Please help me.Urgent Regards Debasis   Hello Friend
Javascript
Javascript  <html> <head> <script type="text/javascript"> function validateForm() { var sname=document.getElementById('spocname'); var scontact=document.getElementById('spoccontact'); if(sname.value.length

Ads