Teil 2


Set of flashcards Details

Flashcards 46
Language Deutsch
Category Micro-Economics
Level Primary School
Created / Updated 18.07.2016 / 15.12.2022
Weblink
https://card2brain.ch/box/part_1_javascript_basics2
Embed
<iframe src="https://card2brain.ch/box/part_1_javascript_basics2/embed" width="780" height="150" scrolling="no" frameborder="0"></iframe>

nennen sie die Bitwise Operators ?

1. & (Bitwise AND)

2. | (Bitwise OR)

3. ^ (Bitwise XOR)

4. ~ (Bitwise Not)

5. << (Left Shift)

6. >> (Right Shift)

7. >>> (Right shift with Zero)

nennen sie die Assignment Operators? 

1. = (Simple Assignment)

2. += (Add and Assignment)

3. -= (Subtract and Assignment)

4. *= (Multiply and Assignment)

5. /= (Divide and Assignment)

6. %= (Modules and Assignment)

nennen Sie die Miscellaneous Operators? 

1. ?: (Conditional)

nennen sie die typeof Operators? 

1. Number  "number"

2. String  "string"

3. Boolean   "boolean"

4. Object   "object"

5. Function   "function "

6. Undefined   "undefined"

7. Null   "object"

wie lautet das gerüst eines if-Statements? 

if (expression){ 
   Statement(s) to be executed if expression is true 

nennen sie ein beispiel eines if-statements?

<html> 
<body> 
 
<script type="text/javascript"> 
<!-- 
var age = 20; 


if( age > 18 ) { 
   document.write("<b>Qualifies for driving</b>"); 

//--> 
</script> 
 
<p>Set the variable to different value and then try...</p> 
</body> 
</html> 

wie lautet das gerüst eines if...else Statements? 

if (expression){ 
   Statement(s) to be executed if expression is true 
}else{ 
   Statement(s) to be executed if expression is false 

nennen sie ein beispiel eines if...else Statements? 

<html> 
<body> 
 
<script type="text/javascript"> 
<!-- 
var age = 15; 
 
if( age > 18 ){ 
   document.write("<b>Qualifies for driving</b>"); 
}else{ 
   document.write("<b>Does not qualify for driving</b>"); 

//--> 
</script> 
 
<p>Set the variable to different value and then try...</p> 
</body> 
</html> 

wie lautet das gerüst eines if...else if... Statements? 

if (expression 1){ 
   Statement(s) to be executed if expression 1 is true 
}else if (expression 2){ 
   Statement(s) to be executed if expression 2 is true 
}else if (expression 3){ 
   Statement(s) to be executed if expression 3 is true 
}else{ 
   Statement(s) to be executed if no expression is true 

nennen Sie ein beispiel eines if...else if...Statements? 

<html> 
<body> 
 
<script type="text/javascript"> 
<!-- 
var book = "maths"; 
if( book == "history" ){ 
   document.write("<b>History Book</b>"); 
}else if( book == "maths" ){ 
   document.write("<b>Maths Book</b>"); 
}else if( book == "economics" ){ 
   document.write("<b>Economics Book</b>"); 
}else{ 
  document.write("<b>Unknown Book</b>"); 

//--> 
</script> 
 
<p>Set the variable to different value and then try...</p> 
</body> 
</html> 

nennen sie das gerüst eines SWITCH-CASE STATEMENTS? 

switch (expression) 

  case condition 1: statement(s) 
                    break; 
  case condition 2: statement(s) 
                    break; 
   ... 
  case condition n: statement(s) 
                    break; 
  default: statement(s) 

nennen sie ein beispiel eines SWITCH-CASE STATEMENTS?

<html> 
<body> 
 
<script type="text/javascript"> 
<!-- 
var grade='A'; 
document.write("Entering switch block<br />"); 
switch (grade) 

  case 'A': document.write("Good job<br />"); 

            break; 
  case 'B': document.write("Pretty good<br />"); 
            break; 
  case 'C': document.write("Passed<br />"); 
            break; 
  case 'D': document.write("Not so good<br />"); 
            break; 
  case 'F': document.write("Failed<br />"); 
            break; 
  default:  document.write("Unknown grade<br />") 

document.write("Exiting switch block"); 
//--> 
</script> 
 
<p>Set the variable to different value and then try...</p> 
</body> 
</html> 

 

nennen sie das gerüst einer WHILE LOOP SCHLEIFE? 

while (expression){ 
   Statement(s) to be executed if expression is true 

nennen sie ein beispiel einer WHILE LOOP SCHLEIFEN? 

<html> 
<body> 
 
<script type="text/javascript"> 
<!-- 
var count = 0; 
document.write("Starting Loop "); 
while (count < 10){ 
  document.write("Current Count : " + count + "<br />"); 
  count++; 

document.write("Loop stopped!"); 
//--> 
</script> 
 
<p>Set the variable to different value and then try...</p> 
</body> 
</html> 

nennen sie das gerüst für eine The do...while Loop? 

do{ 
   Statement(s) to be executed; 
} while (expression); 

nennen sie ein beispiel einer The do...while Loop Schleife? 

<html> 
<body> 
 
<script type="text/javascript"> 
<!-- 
var count = 0; 
document.write("Starting Loop" + "<br />"); 
do{ 
  document.write("Current Count : " + count + "<br />"); 
  count++; 
}while (count < 5); 
document.write ("Loop stopped!"); 
//--> 
</script> 
 
<p>Set the variable to different value and then try...</p> 
</body> 
</html> 

nennen sie das gerüst einer For Loop Schleife? 

for (initialization; test condition; iteration statement){ 
     Statement(s) to be executed if test condition is true 

nennen sie ein beispiel einer For Loop Schleife? 

<html> 
<body> 
 
<script type="text/javascript"> 
<!-- 
var count; 
document.write("Starting Loop" + "<br />"); 
for(count = 0; count < 10; count++){ 
  document.write("Current Count : " + count ); 
  document.write("<br />"); 

document.write("Loop stopped!"); 
//--> 
</script> 
 
<p>Set the variable to different value and then try...</p> 
</body> 
</html> 

wie lautet das gerüst einer FOR-IN LOOP SCHLEIFE? 

for (variablename in object){ 
  statement or block to execute 

nennen sie ein beispiel einer FOR-IN LOOP SCHLEIFE? 

<html> 
<body> 
 
<script type="text/javascript"> 
<!-- 
var aProperty; 
document.write("Navigator Object Properties<br /> "); 
for (aProperty in navigator) 

  document.write(aProperty); 
  document.write("<br />"); 

document.write ("Exiting from the loop!"); 
//--> 
</script> 

<p>Set the variable to different object and then try...</p> 
</body> 
</html> 

Loop Control - nennen Sie ein beispiel eines break Statements?

<html> 
<body> 
 
<script type="text/javascript"> 
<!-- 
var x = 1; 
document.write("Entering the loop<br /> "); 
while (x < 20) 

  if (x == 5){  
     break;  // breaks out of loop completely 
  } 
  x = x + 1; 
  document.write( x + "<br />"); 

document.write("Exiting the loop!<br /> "); 
//--> 
</script> 
 
<p>Set the variable to different value and then try...</p> 
</body> 
</html> 

nennen sie ein beispiel eines continue Statements? 

<html> 
<body> 
<script type="text/javascript"> 
<!-- 
var x = 1; 
document.write("Entering the loop<br /> "); 
while (x < 10) 

  x = x + 1; 
  if (x == 5){  
     continue;  // skill rest of the loop body 
  } 
  document.write( x + "<br />"); 

document.write("Exiting the loop!<br /> "); 
//--> 
</script> 
 
<p>Set the variable to different value and then try...</p> 
</body> 
</html> 

wie lautet das gerüst einer Funktion? 

<script type="text/javascript"> 
<!-- 
function functionname(parameter-list) 

  statements 

//--> 
</script> 

nennen sie ein beispiel einer funktion?

<script type="text/javascript"> 
<!-- 
function sayHello() 

   alert("Hello there"); 

//--> 
</script> 

wie wird ein bezug auf eine funktion hergestellt? nennen sie ein beispiel?

<html> 
<head> 
<script type="text/javascript">  
function sayHello()  
{  
  document.write ("Hello there!"); 
}  
</script>  
</head>  
 
<body>  
<p>Click the following button to call the function</p> 
<form>  
<input type="button" onclick="sayHello()" value="Say Hello">  
</form> 
 
<p>Use different text in write method and then try...</p> 
</body> 
</html> 

nennen sie ein beispiel einer funktion mit parameter?

<html> 
<head> 
<script type="text/javascript">  
function sayHello(name, age) 

   document.write (name + " is " + age + " years old."); 

</script>  
</head>  
 
<body>  
<p>Click the following button to call the function</p> 
<form>  
<input type="button" onclick="sayHello('Zara', 7)" value="Say Hello">  
</form> 
 
<p>Use different parameters inside the function and then try...</p> 
</body> 
</html> 

nennen sie ein beispiel einer FUNKTION mit RETURN STATEMENT? 

<html> 
<head> 
<script type="text/javascript">  
function concatenate(first, last) 

   var full; 
 
   full = first + last; 
   return  full; 

function secondFunction() 

   var result; 
   result = concatenate('Zara', 'Ali'); 
   document.write (result ); 

</script>  
</head>  

<body>  
<p>Click the following button to call the function</p> 
<form>  
<input type="button" onclick="secondFunction()" value="Call Function">  
</form> 
 
<p>Use different parameters inside the function and then try...</p> 
</body> 
</html> 

nennen sie ein beispiel einer Nested Function? 

<html> 

<head> 
<script type="text/javascript"> 
<!-- 
function hypotenuse(a, b) { 
   function square(x) { return x*x; } 
    
   return Math.sqrt(square(a) + square(b)); 

function secondFunction(){ 
   var result; 
   result = hypotenuse(1,2); 
   document.write ( result ); 

//--> 
</script> 
</head>  
 
<body>  
<p>Click the following button to call the function</p> 
 
<form>  
<input type="button" onclick="secondFunction()" value="Call Function">  
</form> 
 
<p>Use different parameters inside the function and then try...</p> 
</body> 
</html> 

wie lautet das gerüst für FUNCTION () CONSTRUCTOR? 

<script type="text/javascript"> 
<!-- 
var variablename = new Function(Arg1, Arg2..., "Function Body"); 
//--> 
</script> 

nennen sie ein beispiel für FUNCTION () CONSTRUCTOR? 

<html> 
<head> 
<script type="text/javascript"> 
<!-- 
var func = new Function("x", "y", "return x*y;"); 
 
function secondFunction(){ 
   var result; 
   result = func(10,20); 

   document.write ( result ); 

//--> 
</script> 
</head>  
 
<body>  
<p>Click the following button to call the function</p> 
 
<form>  
<input type="button" onclick="secondFunction()" value="Call Function">  
</form> 
 
<p>Use different parameters inside the function and then try...</p> 
</body> 
</html> 

 

wie lautet die syntax für FUNCTION LITERALS? 

<script type="text/javascript"> 
<!-- 

var variablename = function(Argument List){ 
                       Function Body  
   }; 
//--> 
</script> 

nennen sie ein beispiel für FUNCTION LITERALS? 

<html> 
<head> 
<script type="text/javascript"> 
<!-- 
var func = function(x,y){ return x*y }; 
 
function secondFunction(){ 
   var result; 
   result = func(10,20); 
   document.write ( result ); 

//--> 
</script> 
</head>  
<body>  

<p>Click the following button to call the function</p> 
<form>  
<input type="button" onclick="secondFunction()" value="Call Function">  
</form> 
<p>Use different parameters inside the function and then try...</p> 
</body> 
</html> 

nennen sie ein beispiel für ONCLICK EVENT?

<html> 
<head> 
<script type="text/javascript"> 
<!-- 
function sayHello() { 
   document.write ("Hello World") 

//--> 
</script> 

</head> 
<body> 
<p> Click the following button and see result</p> 
<input type="button" onclick="sayHello()" value="Say Hello" /> 
</body> 
</html> 

 

nennen sie ein beispiel für ONSUBMIT EVENT?

<html> 
<head> 
<script type="text/javascript"> 
<!-- 
function validation() { 
   all validation goes here 
   ......... 
   return either true or false 

//--> 
</script> 
</head> 

<body> 
<form method="POST" action="t.cgi" onsubmit="return validate()"> 
....... 
<input type="submit" value="Submit" /> 
</form> 
</body> 
</html> 

nennen sie ein beispiel für ONMOUSEOVER and ONMOUSEOUT EVENT?

<html> 
<head> 
<script type="text/javascript"> 
<!-- 
function over() { 
   document.write ("Mouse Over"); 

function out() { 
   document.write ("Mouse Out"); 

//--> 
</script> 
</head> 
<body> 
<p>Bring your mouse inside the division to see the result:</p> 
<div onmouseover="over()" onmouseout="out()"> 
<h2> This is inside the division </h2> 
</div> 
</body> 
</html> 

nennen sie ein beispiel für STORING COOKIES?

<html> 
<head> 
<script type="text/javascript"> 
<!-- 
function WriteCookie() 

   if( document.myform.customer.value == "" ){ 
      alert ("Enter some value!"); 
      return; 
   } 
 
   cookievalue= escape(document.myform.customer.value) + ";"; 
   document.cookie="name=" + cookievalue; 
   document.write ("Setting Cookies : " + "name=" + cookievalue ); 

//--> 
</script> 

</head> 
<body> 
<form name="myform" action=""> 
Enter name: <input type="text" name="customer"/> 
<input type="button" value="Set Cookie" onclick="WriteCookie();"/> 
</form> 
</body> 
</html> 

nennen sie ein beispiel für READING COOKIES? 

<html> 
<head> 
<script type="text/javascript"> 
<!-- 
function ReadCookie() 

   var allcookies = document.cookie; 
   document.write ("All Cookies : " + allcookies ); 

   // Get all the cookies pairs in an array 
   cookiearray  = allcookies.split(';'); 
 
   // Now take key value pair out of this array 
   for(var i=0; i<cookiearray.length; i++){ 
      name = cookiearray[i].split('=')[0]; 
      value = cookiearray[i].split('=')[1]; 
      document.write ("Key is : " + name + " and Value is : " + value); 
   } 

//--> 
</script> 
</head> 
<body> 
<form name="myform" action=""> 
<p> click the following button and see the result:</p> 
<input type="button" value="Get Cookie" onclick="ReadCookie()"/> 
</form> 
</body> 
</html> 

nennen sie ein beispiel für SETTING COOKIES EXPIRY DATE? 

<html> 
<head> 
<script type="text/javascript"> 
<!-- 
function WriteCookie() 

   var now = new Date(); 
   now.setMonth( now.getMonth() + 1 );  
   cookievalue = escape(document.myform.customer.value) + ";" 
   document.cookie="name=" + cookievalue; 
   document.cookie = "expires=" + now.toUTCString() + ";" 
   document.write ("Setting Cookies : " + "name=" + cookievalue ); 

//--> 
</script> 
</head> 
<body> 
<form name="formname" action=""> 
Enter name: <input type="text" name="customer"/> 
<input type="button" value="Set Cookie" onclick="WriteCookie()"/> 
</form> 
</body> 
</html> 

nennen sie ein beispiel für DELETING A COOKIE? 

<html> 
<head> 
<script type="text/javascript"> 
<!-- 
function WriteCookie() 

   var now = new Date(); 
   now.setMonth( now.getMonth() - 1 );  
   cookievalue = escape(document.myform.customer.value) + ";" 
   document.cookie="name=" + cookievalue; 
   document.cookie = "expires=" + now.toUTCString() + ";" 
   document.write("Setting Cookies : " + "name=" + cookievalue ); 

//--> 
</script> 
</head> 
<body> 
<form name="formname" action=""> 
Enter name: <input type="text" name="customer"/> 
<input type="button" value="Set Cookie" onclick="WriteCookie()"/> 
</form> 

</body> 
</html> 

nennen sie ein beispiel für JavaScript Page Refresh?

<html> 
<head> 
<script type="text/JavaScript"> 
<!-- 
function AutoRefresh( t ) { 
  setTimeout("location.reload(true);", t); 

//   --> 
</script> 
</head> 
<body onload="JavaScript:AutoRefresh(5000);"> 
<p>This page will refresh every 5 seconds.</p> 
</body> 
</html>