Javascript Object Intro
Object - Oriented Programing
Properties
Methods
Object - Oriented Programing
Note that an object is just a special kind of data.
An object has properties and methods
Properties
Length property of the string object to return the number of characters in a string
<script type="text/javascript">
var txt="Hello World!";
document.write(txt.length);
</script>
output: 12
Methods
Methods are the actions that can be performed on objects
<script type="text/javascript">
var str="Hello World!";
document.write(str.toUpperCase());
</script>
output: HELLO WORLD!
Object - Oriented Programing
Properties
Methods
Object - Oriented Programing
Note that an object is just a special kind of data.
An object has properties and methods
Properties
Length property of the string object to return the number of characters in a string
<script type="text/javascript">
var txt="Hello World!";
document.write(txt.length);
</script>
output: 12
Methods
Methods are the actions that can be performed on objects
<script type="text/javascript">
var str="Hello World!";
document.write(str.toUpperCase());
</script>
output: HELLO WORLD!
No comments:
Post a Comment