


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
JAVASCRIPT BASICS| 2026 MIDTERM EXAMS WITH SOLUTIONS JAVASCRIPT BASICS| 2026 MIDTERM EXAMS WITH SOLUTIONS
Typology: Exams
1 / 4
This page cannot be seen from the preview
Don't miss anything!



//....... - Answer-single line comment /......../ - Answer-mulit-lined comment var="..." - Answer-syntax to declare a variable; holds the information assigned to that variable so that you can refer back to it later on; an identifier document.write(...); - Answer-syntax to write "..." on the webpage integer - Answer-data type that is any whole number float - Answer-data type that resembles: 39. string data type - Answer-collection of text (word, sentence, or paragraph); MUST surround in quotations ...""... - Answer-ignores quotation marks and will treat them as text rather than ending at those quotes boolean data type - Answer-can only be true or false % - Answer-modulus; gets the remainder of a dividend = - Answer-assignment operator concatenation - Answer-joining two strings function name( ){ } - Answer-syntax for a javascript function parameter - Answer-a variable that goes inside of a functions parenthesis 0 - Answer-what index number does an array start at? arrayname[arrayname.length - 1]; - Answer-syntax to get the last element of an array
arrayname.length( ); - Answer-syntax that to retrieve how many elements are in an array Arrayname.push(".."); - Answer-syntax that allows you to add an item to the end of an array and returns the new array's length arrayname.pop( ); - Answer-syntax that allows you to delete an item from an array arrayname.reverse( ); - Answer-syntax to reverses the order of the elements in an array arrayname.sort( ); - Answer-syntax to sort the array into alphabetical order var name =array1.concat(array2); - Answer-syntax to combine two arrays var string= array.join("-" ); - Answer-syntax for how to make an array turn into a string; using join to separate by the parameter you give it if(comparison){ } else{ } - Answer-if/else statement syntax; == - Answer-equivalent or equal to for comparison && - Answer-and || - Answer-or var name = prompt("..."); - Answer-syntax for creating an alert in which a user can respond back for (i=0; < array.length, i++; ) - Answer-for loop of an array syntax; allows you to loop the number of array items if the number of elements were to change later on for (x=0; x<10; x++{ } - Answer-for loop syntax; for loop allows you to repeat or loop through a block of code. var x= while (x<#){ x++ } - Answer-while loop syntax; a while loop allows you to repeat code var x=
logical operators - Answer-Type of operators && [and] || [or] ! [not] special text insertions - Answer-insertions ' single quote " double quote \n new line \r carriage return \t tab \b backspace \f form feed