Fichas
3. Language Basics
Fichas del conjunto (31)
- 1Strict mode "use strict";Different parsing and execution model for JS, where some erratic behavior of ECMAScript 3 is addressed and errors are thrown for unsafe activities.
- 2What is a variable?A named placeholder for a value, can hold any type of data (loosely typed)
- 3The var operatorDefines a variable making it local to the scope in which it was defined.
- 4How can you define a variable globally?By omitting the var operator. Bad practice!
- 5What are the primitive data types? (7)Boolean
Null
Undefined
Number
BigInt
String
Symbol
BUNS BNS - 6Which is the complex data type?Object
- 7typeof operatorUsed to determine the data type of a given variable.
- 8typeof null returns?"object"
- 9When does "typeof" return undefined?When called on an uninitialized variable
When called on an undeclared variable - 10The null typeIs an empty object pointer.
- 11var car = null; alert(typeof car); returns?"object" - null is an empty object pointer
- 12When should you use null?Anytime an object is expected, but not available, null should be used.
- 13The Boolean typeHas two values: true and false (case-sensitive)
- 14Boolean()Converts a value into its Boolean equivalent.
- 15Which values are converted to "true" when calling Boolean() ?true
nonempty strings
nonzero numbers
infinity
objects - 16Which values are converted to "false" when calling Boolean() ?false
" " empty strings
0, NaN
null
undefined - 17The Number typeThe number type represents both integer and floating point numbers.
- 18What is NaN?A special numeric value used to indicate when an operation intended to return a number has failed.
Ex: diving a number by 0 - 19isNaN()Determines if the value is "not a number".
Any value that cannot be converted to a number returns "true". - 20alert(NaN == Nan); returns?false - NaN is not equal to any value
- 21Which are the 3 functions you can use to convert nonnumeric values into numbers?Number()
parseInt()
parseFloat() - 22The String typeA sequence of zero or more 16-bit Unicode characters, delineated by quotes.
- 23Are strings mutable?Strings are immutable, once they are created their values cannot change.
- 24How do you change the string held by a variable?var lang = "Java";
lang = lang + "Script"; - 25What methods can convert a value to a string?toString()
String() - 26The Object typeCreated by using the new operator
var o = new Object(); - 27Properties and methods of Object instances (7)constructor
hasOwnProperty(propName)
isPrototypeOf(object)
propertyIsEnumerable(propName)
toLocaleString()
toString()
valueOf() - 28flow control statementsif
while & do-while
for & for-in
label
break & continue
with
switch - 29function syntaxfunction funcName(arg0, arg1, ..., argN) {
statements
} - 30What does return do?Stops the function from further executing, exists immediately and returns a value (specified or undefined)
- 31Is there Overloading in JS?No, if two functions are defined with the same name, it is the last function that becomes the owner of that name.
Información
- Descripción
- JavaScript Fichas sobre 3. Language Basics, creado por Ioana Cosmina el 24/01/2020.
- Creado por
- Ioana Cosmina
- Visitas
- 0
- Etiquetas
- Valoración