We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4
a List any four features of Java script.
Features of Java script
1. JavaScript is a object-based scripting language. 2. Giving the user more control over the browser. 3. It Handling dates and time. 4. It Detecting the user's browser and OS, 5. It is light weighted. 6. Client – Side Technology 7. JavaScript is a scripting language and it is not java. 8. JavaScript is interpreter based scripting language. 9. JavaScript is case sensitive. b. List the comparison operators in Java script. != not equals to == equals to < less than > greater than <= less than equals to >= greater than equals to === equals value and equals type !== not equals value and not equals type c. Write a javascript program to sort the items of an array? <html> <head> <title>array sort </title> </head> <script> var arr=[-3,8,7,6,5,-4,3,2,1]; arr.sort(function(a,b) { return b-a; }); document.write(" sort",arr); </script> </html> d. state the use of eval() function with example . the eval() function in javascript is used to evaluate or executed or execute a string of javascript code.it parses the argument passed to it and executes it as if it were part of the code. EXAMPLE function Ctor() { eval("document.write(new.target)"); } new Ctor(); a. Explain getter and setter properties in java script with suitable example. The accessor property are represented by “getter” and “setter” method for the fullname properties. Get a function without arguments, when a property is read. EXAMPLE:- Getter:- <html> <head> <script> var car ={ color:"red", brand:"ford", get company() { return this.brand; } }; document.write("company=",car.company); </script> </head> <body> </body> </html> Setter:- When a value is set,the setter is called and passed the value that set. Set a function with one argument,that is called when the property is set . EXAMPLE:- <script> var car ={ color:"red", brand:"ford", get company(value) { this.brand=value; } }; document.write("company=",car.brand+”br”); car.company=”Maruti Suzuki”; document.write(“company”,car.brand); </script>
JavaScript Fundamentals: JavaScript Syntax, What JavaScript is Use for in Website Development, JavaScript Variable, Strings, Popup Boxes, JavaScript Objects, Function, and Event Handlers