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
2 changes: 1 addition & 1 deletion Javascript/program-2/read.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Program-1
# Program-2
## This is a javascript program for string operations
20 changes: 20 additions & 0 deletions Javascript/program-3/armstrong.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<html>
<head><TITLE>ARMSTRONG NUMBER</TITLE>
<script language="JavaScript">
var d,x,c=0;
var a=prompt("Enter a number");
x=a;
while(x>0)
{
d=x%10;
c=c+(d*d*d);
x=parseInt(x/10);
}
if(a==c)
alert("given no is amstrong number");
else
alert("given no is not an amstrong number");
</script>
</head>
<body></body>
</html>
3 changes: 3 additions & 0 deletions Javascript/program-3/read.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Program-3
## This is a javascript program for armstrong

55 changes: 55 additions & 0 deletions Javascript/program-4/palindrome.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<title>Check Palindrome with JavaScript Program</title>
<style>
input{
padding: 10px;
}
</style>
<script>

function myFunction()
{
//get the value from textbox
var str = document.getElementById('txtbox').value;

//call checkPalindrome() and pass str
var result = checkPalindrome(str);
alert('The Entered String "'+str +'" is "'+result+'"');
}

function checkPalindrome(str)
{
var orignalStr;

//lowercase the string
str = str.toLowerCase();

//store the str in orignalStr for future use
orignalStr = str;

//reverse the entered string
str = str.split(''); //split the entered string
str = str.reverse(); //reverse the order
str = str.join(''); //then join the reverse order array values

var reverseStr = str;

//finally check both the Original string stored in orignalStr
//and reversed to find the palindrom
if(orignalStr == reverseStr){
return 'Palindrome'; // return "Palindrome" if true
}else{
return 'Not Palindrome';
}
}
</script>
</head>
<body>
<form>
<input type="text" id="txtbox" placeholder="Enter String" />
<input type="button" onclick="myFunction()" value="Check Palindrome" />
</form>
</body>
</html>
3 changes: 3 additions & 0 deletions Javascript/program-4/read.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Program-4
## This is a javascript program for palindrome