接下来要参与大大小小的暑期实习笔试和面试。在这篇博客里我将总结一些常见的面试题。其中有一部分是我去年暑假找实习的时候总结的。现在看来,不免有些幼稚。慢慢完善吧!
JavaScript
Q:JS中的闭包
A:闭包从本身在函数式编程中的概念来说,说的是在定义函数时的两部分-函数体和函数的 context,也就是函数定义时的上下文。里面保存着作用域中的变量,函数的定义和赋值。
而我们平时说的闭包,其实是创建对于这个上下文的引用,从而在外部作用域中通过这个引用来访问这个上下文。
所以从概念上来说,你声明了一个函数,就声明了一个闭包。
然后从实际的使用来说,当你通过某种代码对在外部作用域中保存了对当前闭包的引用时,我们说你就“创建”了一个闭包,其实是“创建”了一个 闭包的引用。我们通常用IIFE来达到这一效果,以至于有人认为IIFE就是“闭包”,这其实是不正确的认识。
这就是闭包的实质,至于如何去使用闭包,那就五花八门了。你可以用来保存被外部作用域访问的临时变量,也可以用来封装函数,也可以用来做访问权限控制(类似Java中的私有变量)。
Q:JS模块化
A:
- 为什么我们需要JS模块化
- JS模块化的发展过程(从function,IIFE到Commonjs)
- JS模块化的几种方案介绍(Commonjs,AMD,ES6 Module)
CSS
Q:CSS position的不同取值以及差异?
A:取值:static(默认),relative,absolute,fixed。差异,relative:相对于其自身进行定位,不脱离文档流。absolute:相对于父元素链上的第一个已定位元素,如果不存在则相对于body。脱离文档流。fixed,相对于浏览器窗口进行定位,脱离文档流。static:正常的文档流定位。
Q:CSS 盒模型
A:
- W3C 默认 content-box,ie5-、ie6 Quirks mode border-box
- content-box:csswidth = content width
- border-box: csswidth = content width + padding +border
Q:CSS选择器
A:元素,类,id,属性,伪类,伪元素。···
Q:CSS hack
A:选择器hack(-webkit-,-moz-),属性hack,IE条件注释
HTML
Q:web语义化
A:
html5新标签:
The future of HTML will develop in a more semantic, functional and modular direction. 1) Semanticization will make the tag describe the content more clearly, improving SEO and barrier-free access. 2) Functionalization will introduce new elements and attributes to meet user needs. 3) Modularity will support component development and improve code reusability.

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

HTML is used to build websites with clear structure. 1) Use tags such as, and define the website structure. 2) Examples show the structure of blogs and e-commerce websites. 3) Avoid common mistakes such as incorrect label nesting. 4) Optimize performance by reducing HTTP requests and using semantic tags.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Atom editor mac version download
The most popular open source editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
