JavaScript an der Universität Ulm | Karteikarten & Zusammenfassungen

Lernmaterialien für JavaScript an der Universität Ulm

Greife auf kostenlose Karteikarten, Zusammenfassungen, Übungsaufgaben und Altklausuren für deinen JavaScript Kurs an der Universität Ulm zu.

TESTE DEIN WISSEN

What is JavaScript?

Lösung anzeigen
TESTE DEIN WISSEN

JavaScript is a client-side as well as server side scripting language that can be inserted into HTML pages and is understood by web browsers. JavaScript is also an Object based Programming language.

Lösung ausblenden
TESTE DEIN WISSEN

Mention what is the disadvantage of using innerHTML in JavaScript?


Lösung anzeigen
TESTE DEIN WISSEN

1. There is no append support without reparsing the whole innerHTML. This makes changing innerHTML directly very slow.


2.innerHTML does not provide validation and therefore we can potentially insert valid and broken HTML in the document and break it.


3.Either you add, append, delete or modify contents on a webpage using innerHTML, all contents is replaced, also all the DOM nodes inside that element are reparsed and recreated.


4.The most obvious conclusion from our brief experiment is innerHTML removes event listeners that have previously been added to the DOM. Since the entire tag (the div in our code) is being reparsed, the event listener is lost in the process. Rather than using the += operator, use DOM functions such as append().


5.The use of innerHTML creates a potential security risk for your website. Malicious users can use cross-site scripting (XSS) to add malicious client-side scripts that steal private user information stored in session cookies.


https://betterprogramming.pub/dom-manipulation-the-dangers-of-innerhtml-602f4119d905

Lösung ausblenden
TESTE DEIN WISSEN

 What is the method for reading and writing a file in JavaScript?


Lösung anzeigen
TESTE DEIN WISSEN

This can be done by Using JavaScript extensions (runs from JavaScript Editor), example for opening of a file -

fh = fopen(getScriptPath(), 0);

Lösung ausblenden
TESTE DEIN WISSEN

How can the style/class of an element be changed?

Lösung anzeigen
TESTE DEIN WISSEN

It can be done in the following way:

document.getElementById("myText").style.fontSize = "20";

Lösung ausblenden
TESTE DEIN WISSEN

 How can a page be forced to load another page in JavaScript?

Lösung anzeigen
TESTE DEIN WISSEN

<script language="JavaScript" type="text/javascript" >

<!-- location.href="http://newhost/newpath/newfile.html"; //--></script>

Lösung ausblenden
TESTE DEIN WISSEN

 What are the two basic groups of dataypes in JavaScript?

Lösung anzeigen
TESTE DEIN WISSEN

They are as –

  • Primitive
  • Reference types.

Primitive types are number and Boolean data types. Reference types are more complex types like strings and dates.

Lösung ausblenden
TESTE DEIN WISSEN

Explain the difference between "==" and "==="?

Lösung anzeigen
TESTE DEIN WISSEN

"==" checks only for equality in value whereas "===" is a stricter equality test and returns false if either the value or the type of the two variables are different.

Lösung ausblenden
TESTE DEIN WISSEN

What is === operator?

Lösung anzeigen
TESTE DEIN WISSEN

=== is called as strict equality operator which returns true when the two operands are having the same value without any type conversion.

Lösung ausblenden
TESTE DEIN WISSEN

Explain how to read and write a file using JavaScript?

Lösung anzeigen
TESTE DEIN WISSEN

There are two ways to read and write a file using JavaScript

  • Using JavaScript extensions
  • Using a web page and Active X objects
Lösung ausblenden
TESTE DEIN WISSEN

What is a prompt box?

Lösung anzeigen
TESTE DEIN WISSEN

A prompt box is a box which allows the user to enter input by providing a text box. Label and box will be provided to enter the text or number.

Lösung ausblenden
TESTE DEIN WISSEN

What is 'this' keyword in JavaScript?

Lösung anzeigen
TESTE DEIN WISSEN

'This' keyword refers to the object from where it was called.


  • In a method, this refers to the owner object.
  • Alone, this refers to the global object.
  • In a function, this refers to the global object.
  • In a function, in strict mode, this is undefined.
  • In an event, this refers to the element that received the event.
  • Methods like call(), and apply() can refer this to any object.
Lösung ausblenden
TESTE DEIN WISSEN

What are all the types of Pop up boxes available in JavaScript?

Lösung anzeigen
TESTE DEIN WISSEN
  • Alert
  • Confirm and
  • Prompt
Lösung ausblenden
  • 42445 Karteikarten
  • 712 Studierende
  • 31 Lernmaterialien

Beispielhafte Karteikarten für deinen JavaScript Kurs an der Universität Ulm - von Kommilitonen auf StudySmarter erstellt!

Q:

What is JavaScript?

A:

JavaScript is a client-side as well as server side scripting language that can be inserted into HTML pages and is understood by web browsers. JavaScript is also an Object based Programming language.

Q:

Mention what is the disadvantage of using innerHTML in JavaScript?


A:

1. There is no append support without reparsing the whole innerHTML. This makes changing innerHTML directly very slow.


2.innerHTML does not provide validation and therefore we can potentially insert valid and broken HTML in the document and break it.


3.Either you add, append, delete or modify contents on a webpage using innerHTML, all contents is replaced, also all the DOM nodes inside that element are reparsed and recreated.


4.The most obvious conclusion from our brief experiment is innerHTML removes event listeners that have previously been added to the DOM. Since the entire tag (the div in our code) is being reparsed, the event listener is lost in the process. Rather than using the += operator, use DOM functions such as append().


5.The use of innerHTML creates a potential security risk for your website. Malicious users can use cross-site scripting (XSS) to add malicious client-side scripts that steal private user information stored in session cookies.


https://betterprogramming.pub/dom-manipulation-the-dangers-of-innerhtml-602f4119d905

Q:

 What is the method for reading and writing a file in JavaScript?


A:

This can be done by Using JavaScript extensions (runs from JavaScript Editor), example for opening of a file -

fh = fopen(getScriptPath(), 0);

Q:

How can the style/class of an element be changed?

A:

It can be done in the following way:

document.getElementById("myText").style.fontSize = "20";

Q:

 How can a page be forced to load another page in JavaScript?

A:

<script language="JavaScript" type="text/javascript" >

<!-- location.href="http://newhost/newpath/newfile.html"; //--></script>

Mehr Karteikarten anzeigen
Q:

 What are the two basic groups of dataypes in JavaScript?

A:

They are as –

  • Primitive
  • Reference types.

Primitive types are number and Boolean data types. Reference types are more complex types like strings and dates.

Q:

Explain the difference between "==" and "==="?

A:

"==" checks only for equality in value whereas "===" is a stricter equality test and returns false if either the value or the type of the two variables are different.

Q:

What is === operator?

A:

=== is called as strict equality operator which returns true when the two operands are having the same value without any type conversion.

Q:

Explain how to read and write a file using JavaScript?

A:

There are two ways to read and write a file using JavaScript

  • Using JavaScript extensions
  • Using a web page and Active X objects
Q:

What is a prompt box?

A:

A prompt box is a box which allows the user to enter input by providing a text box. Label and box will be provided to enter the text or number.

Q:

What is 'this' keyword in JavaScript?

A:

'This' keyword refers to the object from where it was called.


  • In a method, this refers to the owner object.
  • Alone, this refers to the global object.
  • In a function, this refers to the global object.
  • In a function, in strict mode, this is undefined.
  • In an event, this refers to the element that received the event.
  • Methods like call(), and apply() can refer this to any object.
Q:

What are all the types of Pop up boxes available in JavaScript?

A:
  • Alert
  • Confirm and
  • Prompt
JavaScript

Erstelle und finde Lernmaterialien auf StudySmarter.

Greife kostenlos auf tausende geteilte Karteikarten, Zusammenfassungen, Altklausuren und mehr zu.

Jetzt loslegen

Die all-in-one Lernapp für Studierende

Greife auf Millionen geteilter Lernmaterialien der StudySmarter Community zu
Kostenlos anmelden JavaScript
Erstelle Karteikarten und Zusammenfassungen mit den StudySmarter Tools
Kostenlos loslegen JavaScript