Home Answers Viewqa Java-Beginners Use javascript loops..

 
 


Jeevan kumar
Use javascript loops..
1 Answer(s)      2 years and 7 months ago
Posted in : Java Beginners

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 Pages:
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
Use javascript loops..
Use javascript loops..  Write a Javascript code, so that numbers appear in following format, 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 for n=5. Input 'n' value from user.   Hi Friend, Try
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...: <SCRIPT LANGUAGE="JavaScript"> var guess; var rno=Math.round(Math.random
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  how to use for loop and while loop in java?/ how to write a code using for or while loop
use of loops and screenshots
use of loops and screenshots  1.how to use loops in netbeans? 2.how to draw a correct screenshot
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
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: JavaScript Loop
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
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.  
Arrays, loops and string handling
Arrays, loops and string handling  How would i go about in creating a program to mark and grade a set of multiple choice test results... for a student name and therafter for the students 10 answers. use input dialog
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
java loops - Java Beginners
java loops   Print the pyramid --------- * --------* * * * * * * * * * * * * * * * * * *   Hi friend, Use the following code: class Pyramid { public static
JavaScript - JavaScript Tutorial
example to use while, do-while and switch loops in JavaScript  ... programming, including the use of the core JavaScript objects and the syntax... how to use Variables and Data types in JavaScript.   String
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
print 100 numbers using loops
print 100 numbers using loops  how to print from 1 to 100 using for loop ?   Hi Friend, You can use the following code: class Loop..., You can use the following code: class Loop{ public static void main(String
javascript
javascript  Hi, I want to open a new window using window.open()(in ie6 and above),and i want to make the window to stay on top of other windows.I don't want to use showModalDialoge.Is there any way to do this,kindly help me
program that uses while loops to perform the following steps :
program that uses while loops to perform the following steps :  Write a program that uses while loops to perform the following steps : a. Prompt the use to input two integers : FirstNum and secondNum.( FirstNum must be less
write program have product - using loops
  for highest price use static method max( double, double
use strings as array indexes using JavaScript
use strings as array indexes using JavaScript  How to use strings as array indexes using JavaScript
Loops - Introduction
will introduce you with the Loops in Java. Loops are very useful in programming... Many loops consist of three operations surrounding the body: (1) initialization..., it is not necessary to use braces {}. However, many programmers think
String Number Operations in JavaScript
-converts values into a type require by the context of their use. JavaScript being... String Number Operations in JavaScript  ... of JavaScript and create your first JavaScript program.  What is String Number
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 In PHP, like other programming
Can i use Scriptlets inside javascript,if so how?
Can i use Scriptlets inside javascript,if so how?  Can i use Scriptlets inside javascript,if so how
nested for loops
"); } } } }   Close your loops before going
javascript loop examples
javascript loop examples  While running a javascript loop function i am getting an error ..can any one post an example of writing loops in javascript?   Looping In Java Script
Use of jQuery
Use of jQuery  What is the use of jQuery?   Hi, jQuery is JavaScript Ajax library. Developer is using it to create rich internet applications. Read at jQuery Tutorial. Thanks
how to use javascript in jsf - Java Server Faces Questions
how to use javascript in jsf  Hi, how to use javascript in jsf... example. Thanks in advance  Hi friend, Using Javascript in JSF Javascript with a commandLink is not difficult,and understand how
javaScript+Html
javaScript+Html  print("code sample");(Use ExtJS 3 or 4) and create following (HTML, Javascript,ExtJS) a. Create a single page application divided into 4 sections - Top Header, Footer,Left Navigation (Tree), Center Panel
how to use javascript drag and drop files upload - Ajax
how to use javascript drag and drop files upload  Hi,Sir Please, I would like to upload multiple files using javascript with drag and drop style.I have asked to you similar problem recently.You answer to me to use java applet
How to read loops in Java
How to read loops in Java  Example that explains how to read loop in Java
Javascript - JDBC
want to use javascript in JSP page so that when click() event will generate...Javascript   Hi, I am doing a project in healthcare domain... and javascript I want to write the event handling code in another jsp page .so
Question on javascript
to do this using JavaScript??? or any other way in web application???   Hello Friend, In javascript, you can use the following code: <html> <h2>ComboBox</h2> <script language="javascript"> var arr = new
Javascript code
Javascript code  Dear Sir, Please help me..It s urgently required.Please help me.I have three types of electrical meters data with their testing...,it should show in a tabular form. Same for >33kv We can use ajax where instead
Javascript code
Javascript code  Dear Sir, Please help me..It s urgently required.Please help me.I have three types of electrical meters data with their testing...,it should show in a tabular form. Same for >33kv We can use ajax where instead
Operators; If, Else, Elseif; Loops
 3.9. Operators; If, Else, Elseif; Loops Conditional Statements If, Else, Elseif are called the Conditional statements that are used for performing.... In this statement, we can use if...elseif....else statement the code this statement
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
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
JavaScript createComment method
JavaScript createComment method       We can use the JavaScript method createComment... the use of createComment() method in the JavaScript.        

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.