SlideShare a Scribd company logo
1 of 7
Developing skills in coding
javascript
*Copy the following codes into notepad and
replace any of the ^ symbols to make the
code work correctly.
1. To find the square root of a
number
<html>
<^>
<script type="text/javascript">
var numb= prompt("enter a number to find it's square root");
numb=parseInt(^);
var Result=numb^numb;
document.write("The square root is" Result");
</script>
</body>
<html>
2.Finding out if a triangle is a
right triangle
So in Maths, if a2 +
b2 = c2 then the
triangle is a right
triangle.
<html>
<body>
<script type="text/javascript">
var numb1=prompt("enter the adjacent of triangle?");
var numb^=prompt("enter the opposite of triangle?");
var numb3=prompt("enter the longest side/hypotenuse of
triangle?");
numb1=parseInt(numb^);
numb2=parseInt(numb2);
numb3=parseInt(numb^);
var Result=(numb1^numb1+numb2*numb2!=numb3);
^ (Result^=numb3)
{
document.write ("this is not right triangle");
}
else
{
document.write ("this is right triangle");
}
</script>
</body>
</html>
3.Getting the grades from a test
score
<html>
<body>
<script type="text/javascript">
var marks = prompt("enter the marks of test","");
marks=^(marks);
if(marks^=60)
{
document.write("grade is a");
}
else ^ (marks >=45)
{
document.write("grade is b");
}
else ^(marks >=30)
{
document.write("grade is c");
}
else
^
document.write("grade is f");
}
</script>
</body>
</html>
Writing javascript code
1.Create a program that when you enter a
number, it will be divided by 2.
* use the mathetical operator / to do this.
Writing javascript code
1.Create a program that when you enter a
number, it will be divided by 2.
* use the mathetical operator / to do this.

More Related Content

Viewers also liked

Practice programs
Practice programsPractice programs
Practice programsMax Friel
 
Keywords used in javascript
Keywords used in javascriptKeywords used in javascript
Keywords used in javascriptMax Friel
 
Showcase part one
Showcase part oneShowcase part one
Showcase part oneMax Friel
 
Summer course
Summer courseSummer course
Summer courseMax Friel
 
Lesson 3 maya 4
Lesson 3 maya 4Lesson 3 maya 4
Lesson 3 maya 4Max Friel
 
Activity lesson
Activity lessonActivity lesson
Activity lessonMax Friel
 
Web design save earth
Web design save earthWeb design save earth
Web design save earthMax Friel
 
Lesson 5 may 4
Lesson 5 may 4Lesson 5 may 4
Lesson 5 may 4Max Friel
 
Group web design
Group web designGroup web design
Group web designMax Friel
 
Lesson plan 2 matt 3
Lesson plan 2 matt 3Lesson plan 2 matt 3
Lesson plan 2 matt 3Max Friel
 
Errors in coding
Errors in codingErrors in coding
Errors in codingMax Friel
 

Viewers also liked (19)

Practice programs
Practice programsPractice programs
Practice programs
 
Assum 3
Assum 3Assum 3
Assum 3
 
Basics
BasicsBasics
Basics
 
Keywords used in javascript
Keywords used in javascriptKeywords used in javascript
Keywords used in javascript
 
Java script basic
Java script basicJava script basic
Java script basic
 
Showcase part one
Showcase part oneShowcase part one
Showcase part one
 
Summer course
Summer courseSummer course
Summer course
 
Lesson 3 maya 4
Lesson 3 maya 4Lesson 3 maya 4
Lesson 3 maya 4
 
Activity lesson
Activity lessonActivity lesson
Activity lesson
 
Project
ProjectProject
Project
 
Web design save earth
Web design save earthWeb design save earth
Web design save earth
 
Lesson 5 may 4
Lesson 5 may 4Lesson 5 may 4
Lesson 5 may 4
 
Id
IdId
Id
 
Group web design
Group web designGroup web design
Group web design
 
Lesson plan 2 matt 3
Lesson plan 2 matt 3Lesson plan 2 matt 3
Lesson plan 2 matt 3
 
Refresher 2
Refresher 2Refresher 2
Refresher 2
 
Errors in coding
Errors in codingErrors in coding
Errors in coding
 
Untitled 1
Untitled 1Untitled 1
Untitled 1
 
Html Ppt
Html PptHtml Ppt
Html Ppt
 

Similar to Code

C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview QuestionsGradeup
 
The Art Of Readable Code
The Art Of Readable CodeThe Art Of Readable Code
The Art Of Readable CodeBaidu, Inc.
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and StatementsWebStackAcademy
 
Will th ebelow code work andif not please help me fix it. Basically .pdf
Will th ebelow code work andif not please help me fix it. Basically .pdfWill th ebelow code work andif not please help me fix it. Basically .pdf
Will th ebelow code work andif not please help me fix it. Basically .pdfmichaelazach6427
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboardsDenis Ristic
 
Library functions in c++
Library functions in c++Library functions in c++
Library functions in c++Neeru Mittal
 
Javascript part1
Javascript part1Javascript part1
Javascript part1Raghu nath
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsPatchSpace Ltd
 
A Spin-off: Firebird Checked by PVS-Studio
A Spin-off: Firebird Checked by PVS-StudioA Spin-off: Firebird Checked by PVS-Studio
A Spin-off: Firebird Checked by PVS-StudioAndrey Karpov
 
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8tdc-globalcode
 
1 ECE 175 Computer Programming for Engineering Applica.docx
1  ECE 175 Computer Programming for Engineering Applica.docx1  ECE 175 Computer Programming for Engineering Applica.docx
1 ECE 175 Computer Programming for Engineering Applica.docxoswald1horne84988
 
Maharashtra state board Hsc IT Chap 3.pdf
Maharashtra state board Hsc IT Chap 3.pdfMaharashtra state board Hsc IT Chap 3.pdf
Maharashtra state board Hsc IT Chap 3.pdfAAFREEN SHAIKH
 

Similar to Code (20)

C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview Questions
 
WD programs descriptions.docx
WD programs descriptions.docxWD programs descriptions.docx
WD programs descriptions.docx
 
The Art Of Readable Code
The Art Of Readable CodeThe Art Of Readable Code
The Art Of Readable Code
 
JavaScript - Chapter 4 - Types and Statements
 JavaScript - Chapter 4 - Types and Statements JavaScript - Chapter 4 - Types and Statements
JavaScript - Chapter 4 - Types and Statements
 
C code examples
C code examplesC code examples
C code examples
 
C important questions
C important questionsC important questions
C important questions
 
Will th ebelow code work andif not please help me fix it. Basically .pdf
Will th ebelow code work andif not please help me fix it. Basically .pdfWill th ebelow code work andif not please help me fix it. Basically .pdf
Will th ebelow code work andif not please help me fix it. Basically .pdf
 
Variables
VariablesVariables
Variables
 
05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards05 JavaScript #burningkeyboards
05 JavaScript #burningkeyboards
 
Library functions in c++
Library functions in c++Library functions in c++
Library functions in c++
 
Javascript part1
Javascript part1Javascript part1
Javascript part1
 
Uses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & StubsUses & Abuses of Mocks & Stubs
Uses & Abuses of Mocks & Stubs
 
Variables 2
Variables 2Variables 2
Variables 2
 
A Spin-off: Firebird Checked by PVS-Studio
A Spin-off: Firebird Checked by PVS-StudioA Spin-off: Firebird Checked by PVS-Studio
A Spin-off: Firebird Checked by PVS-Studio
 
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
TDC2018SP | Trilha .Net - Novidades do C# 7 e 8
 
1 ECE 175 Computer Programming for Engineering Applica.docx
1  ECE 175 Computer Programming for Engineering Applica.docx1  ECE 175 Computer Programming for Engineering Applica.docx
1 ECE 175 Computer Programming for Engineering Applica.docx
 
13 Jo P Jan 08
13 Jo P Jan 0813 Jo P Jan 08
13 Jo P Jan 08
 
Maharashtra state board Hsc IT Chap 3.pdf
Maharashtra state board Hsc IT Chap 3.pdfMaharashtra state board Hsc IT Chap 3.pdf
Maharashtra state board Hsc IT Chap 3.pdf
 
ES6 is Nigh
ES6 is NighES6 is Nigh
ES6 is Nigh
 
CPP Homework Help
CPP Homework HelpCPP Homework Help
CPP Homework Help
 

More from Max Friel

More from Max Friel (20)

Assum 4
Assum 4Assum 4
Assum 4
 
Tourism
TourismTourism
Tourism
 
Project 1
Project 1Project 1
Project 1
 
Practice and debugging
Practice and debuggingPractice and debugging
Practice and debugging
 
Debugging
DebuggingDebugging
Debugging
 
Strings
StringsStrings
Strings
 
Loops
LoopsLoops
Loops
 
Loops
LoopsLoops
Loops
 
If conditions
If conditionsIf conditions
If conditions
 
Variables
VariablesVariables
Variables
 
Developing html skills 1
Developing html skills 1Developing html skills 1
Developing html skills 1
 
Matching game
Matching gameMatching game
Matching game
 
activity flowcharts
activity flowchartsactivity flowcharts
activity flowcharts
 
Lesson one
Lesson oneLesson one
Lesson one
 
Law
LawLaw
Law
 
Phishing
PhishingPhishing
Phishing
 
Tourism in bangkok
Tourism in bangkokTourism in bangkok
Tourism in bangkok
 
Untitled 2
Untitled 2Untitled 2
Untitled 2
 
Refresher
RefresherRefresher
Refresher
 
Refresher
RefresherRefresher
Refresher
 

Code

  • 1. Developing skills in coding javascript *Copy the following codes into notepad and replace any of the ^ symbols to make the code work correctly.
  • 2. 1. To find the square root of a number <html> <^> <script type="text/javascript"> var numb= prompt("enter a number to find it's square root"); numb=parseInt(^); var Result=numb^numb; document.write("The square root is" Result"); </script> </body> <html>
  • 3. 2.Finding out if a triangle is a right triangle So in Maths, if a2 + b2 = c2 then the triangle is a right triangle.
  • 4. <html> <body> <script type="text/javascript"> var numb1=prompt("enter the adjacent of triangle?"); var numb^=prompt("enter the opposite of triangle?"); var numb3=prompt("enter the longest side/hypotenuse of triangle?"); numb1=parseInt(numb^); numb2=parseInt(numb2); numb3=parseInt(numb^); var Result=(numb1^numb1+numb2*numb2!=numb3); ^ (Result^=numb3) { document.write ("this is not right triangle"); } else { document.write ("this is right triangle"); } </script> </body> </html>
  • 5. 3.Getting the grades from a test score <html> <body> <script type="text/javascript"> var marks = prompt("enter the marks of test",""); marks=^(marks); if(marks^=60) { document.write("grade is a"); } else ^ (marks >=45) { document.write("grade is b"); } else ^(marks >=30) { document.write("grade is c"); } else ^ document.write("grade is f"); } </script> </body> </html>
  • 6. Writing javascript code 1.Create a program that when you enter a number, it will be divided by 2. * use the mathetical operator / to do this.
  • 7. Writing javascript code 1.Create a program that when you enter a number, it will be divided by 2. * use the mathetical operator / to do this.