Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Properties
- //Write a JavaScript function displayProperties(value) that displays all the
- //properties of the "document" object in alphabetical order. Write a JS
- //program docProperties.js that invokes your function with the sample input
- //data below and prints the output at the console.
- function displayProperties(value) {
- var arr = [];
- for (var property in value) {
- arr.push(property);
- }
- arr.sort();
- for (var element in arr) {
- console.log(arr[element]);
- document.writeln(arr[element]);
- }
- }
- displayProperties(document);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement