Skip to main content

Posts

Showing posts from February, 2015

OOAP -Javascript

JAVASCRIPT Question : How to find the index of an element from the JavaScript Array? Answer : Arrayname.indexOf(value); Question : How to remove an element form the JavaScript Array? Answer : Arrayname.splice(indexOfElement,1); Question : How can you convert a String to an Object? Answer : provided the String is valid JSON String we can convert it using JSON.parse(VALID JSON TEXT) e.g. var validText = '{"name" : "vikash" , "success":true, "Address" : {"Building" : "Building_X", "Flat" : "12"}}'; var obj = JSON.parse(validText); Now we can access the data in this way obj . name or obj. success or obj. Address . Building or obj. Address . Flat What is Event Bubbling and Capturing? Answer :  On the Introduction to events page I asked a question that at first sight seems incomprehensible: “If an element and one of its ancestors have an event handler for the same event, which one sho