js interview questions (1)

1.javascript typeof return of what data type
 Number The String Object boolean function underfind

2. mentioned three kinds of casts and two kinds of implicit type conversion?
Mandatory (parseInt, parseFloat, Number () , String (), Boolean ())
implicit (+ -)

3.split () the Join () difference
former is in the form of an array of cut, which is to convert the array into a string

4. the method of arrays POP () Push () the unshift () Shift ()
the Push () tail add pop () tail deletion
Unshift () to add the head shift () head delete

5. event binding and ordinary events What is the difference
ordinary event onclick is DOM0 level event only supports a single event, it will be other onclick event coverage, and the event bindings addEventListener is DOM2-level events can add multiple events without fear of being covered

Difference 6.IE and DOM event flow

See: HTTPS: //www.cnblogs.com/cui-ting/p/11080109.html
1. execution order is not the same,
2. different parameters
3. Event plus without ON
4.this point to problems

7. Standard and which has the compatibility IE wording
Var ev = ev || window.event

Var target =  ev.target || ev.srcElement

document.documentElement.clientWidth || document.body.clientWidth


time 8.ajax request and get the difference between the way the post
a url in the back on a virtual carrier which
has a size limit
safety
applications that require different forum is only a request, is similar to a password change

9.call and apply distinction
Object.call (the this, OBJ1, obj2, OBJ3)
Object.apply (the this, arguments)

when 10.ajax request, how to interpret the data json
use because of safety considerations eval parse parse using more reliable
11.b inherited a method
reference: HTTP: //www.tuicool.com/articles/vAbMfy
12. the write obtaining a non-line-style function

function the getStyle (obj, attr, value)
{
IF (! value)
{
IF (obj.currentStyle)
{
return obj.currentStyle (attr)
}
the else
{
obj.getComputedStyle (attr, to false)
}
}
the else
{
obj.style [attr] = value
}
}

13. The event delegate what
to make use of the principle of event bubbling, so that their event is triggered, so that his place of execution of the parent element!
http://www.webasily.com/?p=78 visible example of this link

14. What Closures are, what characteristics have any effect on pages
closure is the function of the internal variables can be read by other functions.
http://blog.csdn.net/gaoshanwudi/article/details/7355794 this link to view (ask this question is not a company)

15. How to prevent default event and event bubbling
stop event copy (bubble)
IE: Event = to true .cancelBubble;
the DOM: that event.stopPropagation (); 

Prevent default event behavior
IE: event.returnValue = false;
the DOM: event.preventDefault (); 

16. The method Add Remove replaced inserted into a contact
obj.appendChidl ()
obj.innersetBefore
obj.replaceChild
obj.removeChild

17. The interpretation jsonp principle, and why not real ajax
dynamically created script tag, the callback function
Ajax is no page refresh request data manipulation

local object 18.javascript, the built-in objects and host objects
local object array obj regexp etc. can instantiate a new
built-in objects to gload Math not instantiated and other
hosts own browser document, window and other

19.document load and document ready distinction
Document.onload structure and style loading is completed before execution JS
document.ready this method is not native species, there jquery $ (). READY (function)

20. "==" and "===" different
former will automatically convert type
which does not

origin policy 21.javascript of
a script can only be read from the same source properties windows and documents, the same source here refers to the combination of a host name, protocol and port number

22. An array write process deduplication
function oSort (ARR)
{
var Result = {};
var newArr = [];
for (var I = 0; I <arr.length; I ++)
{
! IF (Result [ARR] )
{
newArr.push (ARR)
Result [ARR] =. 1
}
}
return newArr
}

1.javascript typeof return of what data type
 Number The String Object boolean function underfind

2. mentioned three kinds of casts and two kinds of implicit type conversion?
Mandatory (parseInt, parseFloat, Number () , String (), Boolean ())
implicit (+ -)

3.split () the Join () difference
former is in the form of an array of cut, which is to convert the array into a string

4. the method of arrays POP () Push () the unshift () Shift ()
the Push () tail add pop () tail deletion
Unshift () to add the head shift () head delete

5. event binding and ordinary events What is the difference
ordinary event onclick is DOM0 level event only supports a single event, it will be other onclick event coverage, and the event bindings addEventListener is DOM2-level events can add multiple events without fear of being covered

Difference 6.IE and DOM event flow

See: HTTPS: //www.cnblogs.com/cui-ting/p/11080109.html
1. execution order is not the same,
2. different parameters
3. Event plus without ON
4.this point to problems

7. Standard and which has the compatibility IE wording
Var ev = ev || window.event

Var target =  ev.target || ev.srcElement

document.documentElement.clientWidth || document.body.clientWidth


time 8.ajax request and get the difference between the way the post
a url in the back on a virtual carrier which
has a size limit
safety
applications that require different forum is only a request, is similar to a password change

9.call and apply distinction
Object.call (the this, OBJ1, obj2, OBJ3)
Object.apply (the this, arguments)

when 10.ajax request, how to interpret the data json
use because of safety considerations eval parse parse using more reliable
11.b inherited a method
reference: HTTP: //www.tuicool.com/articles/vAbMfy
12. the write obtaining a non-line-style function

function the getStyle (obj, attr, value)
{
IF (! value)
{
IF (obj.currentStyle)
{
return obj.currentStyle (attr)
}
the else
{
obj.getComputedStyle (attr, to false)
}
}
the else
{
obj.style [attr] = value
}
}

13. The event delegate what
to make use of the principle of event bubbling, so that their event is triggered, so that his place of execution of the parent element!
http://www.webasily.com/?p=78 visible example of this link

14. What Closures are, what characteristics have any effect on pages
closure is the function of the internal variables can be read by other functions.
http://blog.csdn.net/gaoshanwudi/article/details/7355794 this link to view (ask this question is not a company)

15. How to prevent default event and event bubbling
stop event copy (bubble)
IE: Event = to true .cancelBubble;
the DOM: that event.stopPropagation (); 

Prevent default event behavior
IE: event.returnValue = false;
the DOM: event.preventDefault (); 

16. The method Add Remove replaced inserted into a contact
obj.appendChidl ()
obj.innersetBefore
obj.replaceChild
obj.removeChild

17. The interpretation jsonp principle, and why not real ajax
dynamically created script tag, the callback function
Ajax is no page refresh request data manipulation

local object 18.javascript, the built-in objects and host objects
local object array obj regexp etc. can instantiate a new
built-in objects to gload Math not instantiated and other
hosts own browser document, window and other

19.document load and document ready distinction
Document.onload structure and style loading is completed before execution JS
document.ready this method is not native species, there jquery $ (). READY (function)

20. "==" and "===" different
former will automatically convert type
which does not

origin policy 21.javascript of
a script can only be read from the same source properties windows and documents, the same source here refers to the combination of a host name, protocol and port number

22. An array write process deduplication
function oSort (ARR)
{
var Result = {};
var newArr = [];
for (var I = 0; I <arr.length; I ++)
{
! IF (Result [ARR] )
{
newArr.push (ARR)
Result [ARR] =. 1
}
}
return newArr
}

Guess you like

Origin www.cnblogs.com/cui-ting/p/11080128.html