javascript part 1 Flashcards
java is ____ type of language
strong
javascript is _____ type of language
weak
Supports object-oriented and imperative programming styles was standardised as ECMScript 1. True or False?
False. it is ECMAScript
What are the 6 primitive type of javascript?
undefined variables null value denoting intentional lack of a value Boolean Number String
anon = function() { print(‘I am hii’); }
if you want to use this function. what would you type?
anon();
anon = function() { print(‘oh’); }
What type of function is this?
Anonymus function. it would be defined if we had written it as: function anon()
method to return character at index N
charAt(N)
method to returns index of S in string
indexOf(S)
method to returns last index of S in string
lastIndexOf(S)
what does the .length method do?
returns length of string
method to returns array of substrings separated by S
Split(S)
substring(M) will output:
returns substring from index to end
substring(M, N) will output:
returns substring from element M to N.
how to add two strings without the + symbol
a.concat(b)
let arr = [‘a’, 2, ‘c’];
alert( arr[9] );
what will be the output?
array out of boundary.
what method would you use to get an array without the repeated elements. for example:
arry = [2,6,2,5,7];
will output
arry = [2,6,5,7];
filter()
what does the map() function do?
map function will apply function to each element.
for example we have an array 1,2,3,4
and want to add 1 to all the elements. we would use the map function
method that applies accumulator/concatenator across array elements
reduce()
javascript objects are primative. True or False?
False. they are non primitaive
javascript objects have ____ that are also objects and they inherit properties and methods from that.
prototype
All objects inherit from prototype are called?
Object.prototype.
ES 6 introduced class notation to JavaScript where
classes are syntactic sugar over prototype-based objects and no new object-oriented model is introduced
javacript is single threaded. True or false?
False. It is multithreaded