Interview - Javascript
What is wrong with this JavaScript loadSubFrame function?
function loadSubFrame(url) {
var ifr = document.getElementById('myIframe');
if (! ifr) {
ifr = document.createElement("iframe");
ifr.setAttribute('id', 'myIframe');
document.body.appendChild(ifr);
}
ifr.setAttribute('src',url);
}
Questions that does not requires us to show the candidate an example:
- Explain how to achieve encapsulation. Give an example of creating a class with a public and private methods, as well as public and private variables.
- How do you change the style of an element using JavaScript?
page revision: 5, last edited: 07 Sep 2017 06:58