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');

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?
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License