、
等。
Inline Elements: Inline elements don't start on a new line, they appear on the same line as the content and tags beside them. Some examples of inline elements are , , , and tags.
内联元素:内联元素不从新的一行开始,它们与内容和旁边的标签出现在同一行。一些内联元素的示例包括、、
和等标签。
Inline Block Elements: Inline-block elements are similar to inline elements, except they can have padding and margins and set height and width values.
内联块元素:内联块元素类似于内联元素,但它们可以有内边距(padding)、外边距(margin)以及设置高度和宽度值。
216. Is it important to test the webpage in different browsers?
在不同浏览器中测试网页是否重要?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba5837 | 官方: 否 | 付费: 否
答案:
It’s most important to test a website in different browsers when you’re first designing it, or when making major changes. However, it’s also important to repeat these tests periodically, since browsers go through a lot of updates and changes.
在首次设计网站或进行重大更改时,在不同浏览器中测试网站最为重要。然而,定期重复这些测试也很重要,因为浏览器会经历许多更新和变化。
217. What are Pseudo elements and Pseudo classes?
什么是伪元素和伪类?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba583a | 官方: 否 | 付费: 否
答案:
Pseudo-elements allows us to create items that do not normally exist in the document tree, for example ::after. - ::before
伪元素允许我们创建文档树中通常不存在的项目,例如 ::after、::before。
p: :first-line {
p: :first-line {
color: #ffOOOO;
color: #ffOOOO;
font-variant: small-caps;
font-variant: small-caps;
}
Pseudo-classes select regular elements but under certain conditions like when the user is hovering over the link. - :link
伪类选择常规元素,但在特定条件下,例如当用户悬停在链接上时。例如 :link。
/ mouse over link /
/ 鼠标悬停链接 /
a:hover {
a:hover {
color: #FFOOFF;
color: #FFOOFF;
}
218. Does margin-top or margin-bottom have an effect on inline elements?
margin-top 或 margin-bottom 对内联元素有影响吗?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba583d | 官方: 否 | 付费: 否
答案:
No, it doesn’t affect the inline elements. Inline elements flow with the contents of the page.
没有,它不影响内联元素。内联元素随页面内容流动。
219. What is cascading in CSS?
什么是 CSS 中的层叠?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba5840 | 官方: 否 | 付费: 否
答案:
“Cascading” refers to the process of going through the style declarations and defining weight or importance to the styling rules that help the browser to select what rules have to be applied in times of conflict. The conflict here refers to multiple rules that are applicable to a particular HTML element. In such cases, we need to let the browser know what style needs to be applied to the element. This is done by cascading down the list of style declarations elements.
“层叠”指的是遍历样式声明并为样式规则定义权重或重要性的过程,这有助于浏览器在冲突时选择要应用的规则。这里的冲突指的是适用于特定 HTML 元素的多个规则。在这种情况下,我们需要让浏览器知道应该将什么样式应用到该元素。这是通过逐层向下遍历样式声明列表来完成的。
For example, if we have the below style:
例如,如果我们有下面的样式:
p{
p{
color:white;
color:white;
}
and we also have the following declaration below it or in another stylesheet that has been linked to the page:
并且我们在其下方或在链接到页面的另一个样式表中还有以下声明:
p{
p{
color: black;
color: black;
}
We have a conflict in color property here for the paragraph elements. Here, the browser just cascades down to identify what is the most recent and most specific style and applies that. Since we have the color:black; as the most specific declaration, the color black is applied to the paragraph elements. Now if you want to ensure color white is applied to the paragraph, we can define weight to that style by adding !important as shown below:
这里段落元素的 color 属性存在冲突。在这种情况下,浏览器只是向下层叠以确定哪个是最新且最具体的样式,并应用该样式。由于我们有 color:black; 作为最具体的声明,黑色被应用到段落元素。现在,如果你想确保白色被应用到段落,我们可以通过添加 !important 来为该样式定义权重,如下所示:
p{
p{
color:white !important;
color:white !important;
}
!important ensures that the property has the maximum weight in presence of other conflicting properties.
!important 确保该属性在存在其他冲突属性时具有最大权重。
220. What property is used for changing the font face?
用于更改字体外观的属性是什么?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba5843 | 官方: 否 | 付费: 否
答案:
We can use the font-family property for achieving this. The font-family property is used for specifying what font needs to be applied on the targetted DOM element. It can hold several font names as part of “fallback” mechanism in case the browser does not support the fonts. For example, we can use:
我们可以使用 font-family 属性来实现这一点。font-family 属性用于指定需要应用于目标 DOM 元素的字体。它可以包含多个字体名称,作为“回退”机制的一部分,以防浏览器不支持某些字体。例如,我们可以使用:
p {
p {
font-family: "Times New Roman", Times, serif;
font-family: "Times New Roman", Times, serif;
}
In the above piece of code, we are applying font-family property to the paragraph element. - It tells the browser to look for “Times New Roman” font and apply it.
在上面的代码中,我们将 font-family 属性应用于段落元素。- 它告诉浏览器查找“Times New Roman”字体并应用它。
- If the “Times New Roman” font is not installed or supported, then it asks the browser to use Times font.
If both “Times New Roman” and Times are not supported, then it asks the browser to use any supported generic font belonging to serif.
If you do not want the font-face of the paragraph element to be Times New Roman/Times/serif font, and you want to use the Arial/Helvetica/sans-serif font, then we can just update the CSS property of paragraph element as:
如果你不希望段落元素的字体为 Times New Roman/Times/serif 字体,而希望使用 Arial/Helvetica/sans-serif 字体,那么我们可以将段落元素的 CSS 属性更新为:
p {
p {
font-family: Arial, Helvetica, sans-serif;
font-family: Arial, Helvetica, sans-serif;
}
221. What are the differences between adaptive design and responsive design?
自适应设计和响应式设计有什么区别?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba5846 | 官方: 否 | 付费: 否
答案:
Adaptive Design 自适应设计 | Responsive Design 响应式设计 |
|---|
Adaptive design focuses on developing websites based on multiple fixed layout sizes. 自适应设计侧重于基于多种固定布局尺寸来开发网站。 | Responsive design focuses on showing content on the basis of available browser space. 响应式设计侧重于根据可用浏览器空间来显示内容。 |
When a website developed using adaptive design is opened on the desktop browser, first the available space is detected and then the layout with most appropriate sizes are picked and used for the display of contents. Resizing of browser window has no affect on the design. 当使用自适应设计开发的网站在桌面浏览器中打开时,首先检测可用空间,然后选择尺寸最合适的布局来显示内容。调整浏览器窗口大小对设计没有影响。 | When a website developed using responsive design is opened on a desktop browser and when we try to resize the browser window, the content of the website is dynamically and optimally rearranged to accomodate the window. 当使用响应式设计开发的网站在桌面浏览器中打开时,如果我们尝试调整浏览器窗口大小,网站内容会动态且最优地重新排列以适应窗口。 |
Usually, adaptive designs use six standard screen widths - 320 px, 480 px, 760 px, 960 px, 1200 px, 1600 px. These sizes are detected and appropriate layouts are loaded. 通常,自适应设计使用六种标准屏幕宽度——320 px、480 px、760 px、960 px、1200 px、1600 px。这些尺寸会被检测并加载相应的布局。 | This design makes use of CSS media queries for changing styles depending on the target devices properties for adapting to different screens. 这种设计利用 CSS 媒体查询,根据目标设备的属性更改样式,以适应不同的屏幕。 |
It takes a lot of time and effort to first examine the options and realities of the end users and then design best possible adaptive solutions them. 需要花费大量时间和精力来首先检查终端用户的选项和实际情况,然后设计最佳的适应性解决方案。 | Generally, Responsive design takes much less work to build and design fluid websites that can accomodate content from screen depending on the screen size. 通常,响应式设计构建和设计流畅网站所需的工作量要少得多,这些网站可以根据屏幕大小容纳内容。 |
Gives a lot of control over the design to develop sites for specific screens. 对设计提供大量控制,以便为特定屏幕开发网站。 | No much control over the design is offered here. 这里对设计的控制不多。 |
222. How are the CSS selectors matched against the elements by the browser?
浏览器如何将 CSS 选择器与元素进行匹配?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba5849 | 官方: 否 | 付费: 否
答案:
The order of matching selectors goes from right to left of the selector expression. The elements in the DOM are filtered by browsers based on the key selectors and are then traversed up to the parent elements for determining the matches. The speed of determining the elements depends on the length of the chain of selectors. Consider an example:
选择器的匹配顺序是从选择器表达式的右侧到左侧。浏览器根据关键选择器过滤 DOM 中的元素,然后向上遍历到父元素以确定匹配。确定元素的速度取决于选择器链的长度。考虑一个示例:
p span{
p span{
color: black;
color: black;
}
Here, the browser first finds all span elements in the DOM and then it traverses to each of its parent elements to check if they are the paragraph p elements.
这里,浏览器首先找到 DOM 中的所有 span 元素,然后遍历每个元素的父元素,以检查它们是否是段落 p 元素。
Once the browser finds all matching span tags having paragraph elements as parent and applies the color of black to the content, the matching process is stopped.
一旦浏览器找到所有匹配的 span 标签,其父元素为段落元素,并将颜色设置为黑色,匹配过程即停止。
223. How is border-box different from content-box?
border-box 与 content-box 有何不同?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba584c | 官方: 否 | 付费: 否
答案:
content-box is the default value box-sizing property. The height and the width properties consist only of the content by excluding the border and padding. Consider an example as shown:
content-box 是 box-sizing 属性的默认值。height 和 width 属性仅包含内容,不包括边框和内边距。考虑如下示例:
div{
div{
width:300px;
width:300px;
height:200px;
height:200px;
padding:15px;
padding:15px;
border: 5px solid grey;
边框:5像素实线灰色;
margin:30px;
边距:30像素;
-moz-box-sizing:content-box;
-moz-box-sizing:content-box;
-webkit-box-sizing:content-box;
-webkit-box-sizing:content-box;
box-sizing:content-box;
box-sizing:content-box;
}
Here, the box-sizing for the div element is given as content-box. That means, the height and width considered for the div content exclude the padding and border. We will get full height and width parameters specified for the content as shown in the below image.
这里,div 元素的 box-sizing 被设置为 content-box。这意味着,div 内容的 height 和 width 分别不包括内边距和边框。我们将获得为该内容指定的完整高度和宽度参数,如下方图像所示。
The border-box property includes the content, padding and border in the height and width properties. Consider an example as shown:
border-box 属性在 height 和 width 属性中包括了内容、内边距和边框。考虑如下示例:
div{
div{
width:300px;
width:300px;
height:200px;
height:200px;
padding:15px;
padding:15px;
border: 5px solid grey;
边框:5像素实线灰色;
margin:30px;
边距:30像素;
-moz-box-sizing:border-box;
-moz-box-sizing:边框盒;
-webkit-box-sizing:border-box;
-webkit-box-sizing:边框盒;
box-sizing:border-box;
box-sizing:边框盒;
}
Here, the box-sizing for the div element is given as border-box. That means the height and width considered for the div content will also include the padding and border. This means that the actual height of the div content will be:
这里,div元素的盒尺寸被设置为border-box。这意味着div内容的高度和宽度计算将包括内边距和边框。也就是说,div内容的实际高度将是:
actual height = height -
实际高度 = 高度 -
padding on top and bottom -
顶部和底部的内边距 -
border on top and bottom
顶部和底部的边框
= 200 - (152) - (52)
= 160 px
= 160像素
and the actual width of the div content would be:
而div内容的实际宽度将是:
actual width = width -
实际宽度 = 宽度 -
padding on right and left -
左右两侧的内边距 -
border on right and left
左右两侧的边框
= 300 - (152) - (52)
= 260 px
= 260像素
This is represented in the image below:
如下图所示:
224. How is opacity specified in CSS3?
在CSS3中如何指定不透明度?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba584f | 官方: 否 | 付费: 否
答案:
Opacity refers to the degree to which the content is transparent or opaque. We can use the property named opacity which takes the values ranging from 0 to 1. 0 specifies that the element is completely transparent where 1 means that the element is completely opaque. We can use the opacity property as follows:
不透明度指的是内容透明或不透明的程度。我们可以使用名为opacity的属性,其值范围从0到1。0表示元素完全透明,而1表示元素完全不透明。我们可以如下使用opacity属性:
div {
div {
opacity: 0.6;
opacity: 0.6;
}
In the above example, an opacity of 60% is applied to the div section. The opacity property is not supported by the internet explorer browser. To make it work there, we need to use filter property as polyfill as shown in the example below.
在上面的例子中,对div部分应用了60%的不透明度。opacity属性不被Internet Explorer浏览器支持。为了使其在那工作,我们需要使用filter属性作为polyfill,如下面的例子所示。
div {
div {
opacity: 0.6;
opacity: 0.6;
filter: alpha(opacity=60);
filter: alpha(opacity=60);
}
225. Why should we use float property in CSS?
为什么我们应该在CSS中使用float属性?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba5852 | 官方: 否 | 付费: 否
答案:
The float property is used for positioning the HTML elements horizontally either towards the left or right of the container. For instance,
float属性用于将HTML元素水平定位到容器的左侧或右侧。例如,
float-demo {
float-demo {
float: right;
float: right;
}
Here, the element to which the class is applied ensures that the element is positioned on the right of the container. If you specify the value of float as left, then the element will be placed on the left side of the container.
在这里,应用了该类的元素确保它被定位在容器的右侧。如果你将float的值指定为left,那么元素将被放置在容器的左侧。
226. What is a z-index, how does it function?
什么是z-index,它如何工作?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37a5758d557c902ba5857 | 官方: 否 | 付费: 否
答案:
z-index is used for specifying the vertical stacking of the overlapping elements that occur at the time of its positioning. It specifies the vertical stack order of the elements positioned that helps to define how the display of elements should happen in cases of overlapping.
z-index用于指定定位时重叠元素的垂直堆叠。它指定了定位元素的垂直堆叠顺序,有助于定义在重叠情况下元素的显示应该如何发生。
The default value of this property is 0 and can be either positive or negative. Apart from 0, the values of the z-index can be: - Auto: The stack order will be set equal to the parent.
该属性的默认值是0,并且可以是正数或负数。除了0之外,z-index的值还可以是:- Auto:堆叠顺序将设置为与父元素相同。
From the above figure, we can see that as the value of the z-index increases along the z-axis, the order of stacking would be towards the top of other elements along the vertical axis.
从上图中,我们可以看到,随着 z-index 的值沿 z 轴增加,堆叠顺序将位于其他元素沿垂直轴方向的顶部。
227. What do the following CSS selectors mean?
以下 CSS 选择器是什么意思?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba585c | 官方: 否 | 付费: 否
答案:
- div, p
div p
- div p
div ~ p
- div ~ p
div + p
- div + p
div > p
- div > p
The meaning of the given list of selectors goes as follows: - div, p: This selector implies selecting all div elements and all p elements.
给定选择器列表的含义如下: - div, p:此选择器表示选择所有 div 元素和所有 p 元素。
Consider an example below:
考虑下面的一个示例:
Heading 1
Heading 1
>
Division 1
> Division 1
paragraph 1
>
paragraph 1
paragraph 2
paragraph 2
paragraph 3
段落 3
Span 1 跨度 1 Here, all the div elements and the p elements would be selected by the browser irrespective of their parents or where they are placed. The remaining tags like h1 and span are ignored. - div p : This selector tells to select all p elements that are inside div elements. Consider an example below:
在这里,浏览器会选择所有的div元素和p元素,无论它们的父元素是什么或放在哪里。像h1和span这样的其他标签会被忽略。- div p:这个选择器告诉浏览器选择div元素内部的所有p元素。请考虑下面的示例:
Heading 1
Heading 1
>
Division 1
> Division 1
paragraph 1
>
paragraph 1
>
Inner Div Paragraph
>
Inner Div Paragraph
paragraph 2
paragraph 2
paragraph 3
段落 3
Span 1 跨度 1 Here, paragraph 1
在这里,paragraph 1
and Inner Div Paragraph
和 Inner Div Paragraph
would be selected by the browser and the properties are applied. The rest of the paragraph tags are not selected. - div ~ p : This selector tells to select all p elements that have div elements preceeded anywhere. Consider an example,
将被浏览器选择,并且属性会被应用。其余的段落标签不会被选择。- div ~ p:这个选择器告诉浏览器选择所有前面有div元素的p元素。考虑一个示例,
Heading 1
Heading 1
>
Division 1
> Division 1
paragraph 1
>
paragraph 1
paragraph 2
paragraph 2
paragraph 3
段落 3
Span 1 跨度 1 Here, paragraph 2 and paragraph 3 elements would be selected as marked in the code above. - div + p : This selector says to select all p elements placed immediately after the div element. Consider an example in this case:
在此,如上代码所标记,段落 2 和段落 3 元素将被选中。- div + p :此选择器表示选择所有紧跟在 div 元素之后的 p 元素。考虑此例:
Heading 1
Heading 1
>
Division 1
> Division 1
paragraph 1
>
paragraph 1
paragraph 2
paragraph 2
paragraph 3
段落 3
Span 1 跨度 1 In this case, we have paragraph 2 element immediately after the div tag. Hence, only that element will be selected. - div > p : This selector says to select all p elements which has div as an immediate parent. In the same example below:
在此情况下,段落 2 元素紧跟在 div 标签之后。因此,只有该元素会被选中。- div > p :此选择器表示选择所有直接父元素为 div 的 p 元素。在下面的同一示例中:
Heading 1
Heading 1
>
Division 1
> Division 1
paragraph 1
>
paragraph 1
paragraph 2
paragraph 2
paragraph 3
段落 3
Span 1 跨度 1 Only paragraph 1
只有段落 1
will be selected in this case because it has immediate div as the parent.
在这种情况下会被选中,因为它以直接的 div 作为父元素。
228. What are the properties of flexbox?
flexbox 有哪些属性?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba5860 | 官方: 否 | 付费: 否
答案:
Flexbox stands for flexible box and it was introduced around 2017 in CSS with the purpose of providing an efficient way to handle layouts, align elements within them and distribute spaces amongst the items in dynamic/responsive conditions. It provides an enhanced ability to alter the dimensions of the items and make use of the available space in the container efficiently. In order to achieve this, CSS3 provides some properties.
Flexbox 代表弹性盒子,它大约在 2017 年引入 CSS,目的是提供一种高效的方式来处理布局、对齐其中的元素,并在动态/响应式条件下分配项目之间的空间。它提供了增强的能力来改变项目的尺寸,并高效利用容器中的可用空间。为了实现这一点,CSS3 提供了一些属性。
The properties of flexbox are as follows: - flex-direction: This property helps in defining the direction the container should stack the items targetted for flex. The values of this property can be
flexbox 的属性如下:- flex-direction:此属性有助于定义容器应堆叠目标为 flex 的项目的方向。此属性的值可以是
row: Stacks items horizontally from left to right in the flex container. column: Stacks items vertically from top to bottom in the flex container. row-reverse: Stacks items horizontally from right to left in the flex container. column-reverse: Stacks items vertically from bottom to top in the flex container. - flex-wrap: This property specifies of the flex items should be wrapped or not. Possible values are:
row:在 flex 容器中从左到右水平堆叠项目。column:在 flex 容器中从上到下垂直堆叠项目。row-reverse:在 flex 容器中从右到左水平堆叠项目。column-reverse:在 flex 容器中从下到上垂直堆叠项目。- flex-wrap:此属性指定 flex 项目是否应被换行。可能的值有:
wrap: The flex items would be wrapped if needed. nowrap: This is the default value that says the items won’t be wrapped. wrap-reverse: This specifies that the items will be wrapped if needed but in reverse order. - flex-flow: This property is used for setting both flex-direction and flex-wrap properties in one statement.
wrap:如果需要,flex 项目将被换行。nowrap:这是默认值,表示项目不会被换行。wrap-reverse:这指定如果需要,项目将被换行,但顺序相反。- flex-flow:此属性用于在一个语句中同时设置 flex-direction 和 flex-wrap 属性。
justify-content: Used for aligning the flex items. Possible values are:
center: It means that all the flex items are present at the center of the container. flex-start: This value states that the items are aligned at the start of the container. This is the default value. flex-end: This value ensures the items are aligned at the end of the container. space-around: This value displays the items having space between, before, around the items. space-between: This value displays items with spaces between the lines. - align-items: This is used for aligning flex items.
center:这意味着所有 flex 项目都位于容器的中心。flex-start:此值表示项目在容器的起始位置对齐。这是默认值。flex-end:此值确保项目在容器的末尾对齐。space-around:此值显示项目在四周、之前、之后有空间。space-between:此值显示项目在行之间有空间。- align-items:这用于对齐 flex 项目。
- align-content: This is used for aligning the flex lines.
229. What is the rem unit in CSS? How is it different from em?
CSS 中的 rem 单位是什么?它与 em 有何不同?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba5869 | 官方: 否 | 付费: 否
答案:
The rem unit stands for “root em.” It is a relative unit that is calculated based on the font size of the root element.
rem 单位代表“根 em”。它是一个相对单位,基于根元素的字体大小计算。
By default, most browsers set:
默认情况下,大多数浏览器设置:
html font-size = 16px
html 字体大小 = 16px
So:
所以:
1rem = 16px
1rem = 16px
2rem = 32px
2rem = 32px
0.5rem = 8px
0.5rem = 8px
No matter where an element is placed in the page, rem always refers back to the root font size.
无论元素在页面中放置于何处,rem 始终引用根字体大小。
The em unit is also relative, but it depends on the font size of the parent element. Because of this, its value can increase when elements are nested.
em 单位也是相对的,但它依赖于父元素的字体大小。因此,当元素嵌套时,其值可能会增加。
Example:
示例:
.parent {
.parent {
font-size: 20px;
font-size: 20px;
}
.child {
.child {
font-size: 2em;
font-size: 2em;
}
Here, the child becomes 40px (2 × 20px). If another element inside .child also uses 2em, it becomes 80px. The size keeps multiplying based on nesting.
这里,子元素变为 40px(2 × 20px)。如果 .child 内部的另一个元素也使用 2em,它就会变为 80px。大小会根据嵌套不断相乘。
With rem, that multiplication does not happen. The value stays tied to the root.
使用 rem 时,这种相乘不会发生。该值始终与根元素挂钩。
Example:
示例:
.child {
.child {
font-size: 2rem;
font-size: 2rem;
}
Even inside multiple nested elements, 2rem always equals 2 × root font size.
即使在多个嵌套元素内部,2rem 始终等于 2 × 根字体大小。
Because of this consistency, rem is commonly used for layout spacing, typography systems, and scalable designs. em is useful when sizing needs to stay proportional to a specific component.
由于这种一致性,rem 常用于布局间距、排版系统和可缩放设计。当尺寸需要与特定组件保持比例时,em 则更为有用。
A common setup is:
常见的设置是:
html {
html {
font-size: 62.5%;
font-size: 62.5%;
}
Since 62.5% of 16px equals 10px:
因为16px的62.5%等于10px:
1rem = 10px
1rem = 10px
This makes calculations simple and predictable.
这使计算变得简单且可预测。
230. What is CSS inheritance? Which properties are inherited and which are not?
什么是CSS继承?哪些属性被继承,哪些不被继承?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba5870 | 官方: 否 | 付费: 否
答案:
CSS inheritance means some properties automatically pass from a parent element to its children.
CSS继承意味着某些属性会自动从父元素传递给其子元素。
If a property is inherited, the child element uses the parent’s value unless it defines its own.
如果一个属性被继承,子元素会使用父元素的值,除非它定义了自己的值。
Example:
示例:
body {
body {
color: blue;
color: blue;
}
All text inside the body becomes blue unless another rule overrides it. The color property is inherited.
body内的所有文本都会变成蓝色,除非有其他规则覆盖它。color属性是继承的。
Most inherited properties are related to text and fonts. These include: - font-family
大多数被继承的属性与文本和字体相关。这些包括:- font-family
- font-size
- font-weight
- font-style
- color
- line-height
- text-align
- text-transform
- letter-spacing
- word-spacing
- visibility
- cursor
list-style
Layout and box-model properties are not inherited automatically. These include: - margin
布局和盒子模型属性不会自动继承。这些包括:- margin
- padding
- border
- width
- height
- display
- position
- background
- overflow
- float
- z-index
box-sizing
For example, if a parent element has a border, the child does not automatically get that border.
例如,如果父元素有边框,子元素不会自动获得该边框。
Inheritance can be controlled using keywords.
可以使用关键字控制继承。
inherit forces a property to take the value from its parent.
inherit强制属性从父元素取值。
.child {
.child {
border: inherit;
border: inherit;
}
initial resets a property to its default browser value.
initial 将属性重置为其默认浏览器值。
unset behaves like inherit for inherited properties and like initial for non-inherited properties.
unset 对于继承属性表现为 inherit,对于非继承属性表现为 initial。
It is also possible to reset most properties at once:
也可以一次性重置大多数属性:
.element {
.element {
all: unset;
all: unset;
}
Inheritance affects how styles cascade through the DOM and determines how much CSS needs to be written explicitly.
继承影响样式在 DOM 中的级联方式,并决定需要显式编写的 CSS 数量。
231. Explain the CSS display property comprehensively. What are all the possible values?
全面解释 CSS display 属性。所有可能的值有哪些?
- 知识点: 前端 (主题: css, frontend;标签: interviewbit, css, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a5758d557c902ba5875 | 官方: 否 | 付费: 否
答案:
The display property defines how an element generates boxes in the layout and how it participates in the document flow.
display 属性定义元素如何在布局中生成盒子,以及如何参与文档流。
The basic display types are:
基本显示类型包括:
- block: Starts on a new line and takes full available width. Width and height can be set.
Examples: div, p, section, h1.
示例:div、p、section、h1。
- inline: Flows within text and does not start on a new line. Width and height cannot be set directly.
Examples: span, a, strong.
示例:span、a、strong。
- inline-block: Flows inline but allows width and height to be set.
Modern layout systems use:
现代布局系统使用:
- flex: Creates a one-dimensional layout container. Child elements become flex items and can be aligned and distributed along a row or column.
.container {
.container {
display: flex;
display: flex;
}
- grid: Creates a two-dimensional layout container with rows and columns.
.container {
.container {
display: grid;
display: grid;
}
- inline-flex and inline-grid behave like flex and grid but remain inline-level elements.
Other important values include:
其他重要的值包括:
- none: Removes the element completely from the layout. It takes no space and is not rendered.
- list-item: Displays the element as a list item with a marker.
- table , table-row , table-cell: Used to create table-like structures without actual markup.
- flow-root: Creates a new block formatting context. Often used to contain floated elements.
- contents: Removes the element’s own box but keeps its children in the layout.
Here’s a common comparison:
这里有一个常见的比较:
- display: none removes the element from layout completely.
- visibility: hidden hides the element but keeps its space.
- opacity: 0 makes the element transparent but keeps its space and allows animation.
The display property directly affects layout behavior, rendering, and spacing, which is why it is one of the most important CSS properties to understand clearly.
display 属性直接影响布局行为、渲染和间距,这就是为什么它是需要清晰理解的最重要的 CSS 属性之一。
232. Why is it that a single serial port is controlled by a single interrupt-driven I/O (input/ output), but a front-end processor, such as a terminal concentrator, is managed by a polling I/O? Answer this in context to OS.
为什么单个串行端口由单个中断驱动的 I/O(输入/输出)控制,而前端处理器(如终端集中器)却由轮询 I/O 管理?请结合操作系统背景回答。
- 知识点: 前端 (标签: interviewbit, deloitte, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: 德勤
- id: 69b37a6f58d557c902ba69df | 官方: 否 | 付费: 否
答案:
Interrupt is a hardware method by which a device alerts the CPU that it needs its attention. Interruptions might happen at any time. As a result, when the CPU receives an interrupt signal over the indicator interrupt-request line, it suspends the current process and responds to the interrupt by giving control to the interrupt handler, which serves the device. Polling is a procedure in which the CPU checks if the device requires attention on a regular basis. When a device tells the process unit that it wants hardware processing, the process unit polls the I/O device to see if it wants CPU processing. The CPU is constantly checking each and every device connected to it to see if any of them requires hardware attention.
中断是一种硬件方法,设备通过它提醒 CPU 需要注意。中断可能随时发生。因此,当 CPU 通过指示中断请求线收到中断信号时,它会暂停当前进程,并通过将控制权交给中断处理程序来响应中断,中断处理程序为设备提供服务。轮询是一种 CPU 定期检查设备是否需要关注的过程。当设备告诉处理单元它需要硬件处理时,处理单元轮询 I/O 设备以查看它是否需要 CPU 处理。CPU 不断检查连接到它的每一个设备,以查看是否有任何设备需要硬件关注。
A serial port may have a tiny number of I/O requests, and therefore, interrupts should be used whenever possible. Serial ports in a terminal concentrator are a different matter. A terminal concentrator has several serial ports, which can result in the formation of multiple brief I/O instances, which can increase the system's burden unnecessarily if interrupts are used. Instead, by looping through without the need for I/O, a polling loop can dramatically reduce the amount of burden on the system. Hence, polling is believed to be more efficient than interrupt-driven I/O when the I/O is frequent and of extremely short duration.
串行端口可能只有很少的 I/O 请求,因此应尽可能使用中断。终端集中器中的串行端口则不同。终端集中器有多个串行端口,这可能导致形成多个短暂的 I/O 实例,如果使用中断,可能会不必要地增加系统负担。相反,通过循环而不需要 I/O,轮询循环可以大幅减少系统负担。因此,当 I/O 频繁且持续时间极短时,轮询被认为比中断驱动的 I/O 更高效。
Therefore, we may conclude that interrupts are used for single ports because the frequency of I/O on such a port is low and can be managed successfully, whereas polling is used for many ports because the frequency of I/O grows and the duration is short, which suits polling.
因此,我们可以得出结论:中断用于单个端口,因为此类端口上的 I/O 频率较低且可以成功管理,而轮询用于多个端口,因为 I/O 频率增加且持续时间短,这适合轮询。
233. Who is a desktop support engineer?
谁是桌面支持工程师?
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6a7f | 官方: 否 | 付费: 否
答案:
Desktop support engineers are typically IT experts who resolve issues related to Information Technology (IT) within an organization or for individuals. Also, they are able to aid with the setting up and maintenance of laptops and the resolution of security and server issues that affect businesses. It is their job to assist companies or individuals in installing, patching, upgrading, and troubleshooting software and fixing any security issues with these machines, and even assisting with issues related to servers or racks.
桌面支持工程师通常是 IT 专家,他们解决组织内或个人的信息技术(IT)相关问题。此外,他们能够协助设置和维护笔记本电脑,并解决影响企业的安全和服务器问题。他们的工作是协助公司或个人安装、修补、升级和排除软件故障,并修复这些机器的安全问题,甚至协助处理与服务器或机架相关的问题。
234. What is BUS Speed?
什么是总线速度?
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6a82 | 官方: 否 | 付费: 否
答案:
A bus is a simple circuit that is used to connect one part of the motherboard to another by means of an electrical path. When a bus can handle more data at once, it will transfer data more quickly between computer components. "Bus speed" refers to the rate at which data can be transferred from one computer component to another. The speed of the bus can be expressed in megahertz (MHz), which indicates how much data can be transported across the bus at one time.
总线是一个简单电路,用于通过电流路径连接主板的各个部分。当总线能同时处理更多数据时,它将在计算机组件之间更快地传输数据。“总线速度”指数据从一个计算机组件传输到另一个组件的速率。总线速度可以用兆赫兹(MHz)表示,这指示一次能通过总线传输多少数据。
235. Explain the roles and responsibilities of desktop support engineers.
解释桌面支持工程师的角色和职责。
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6a87 | 官方: 否 | 付费: 否
答案:
Here is a list of some of the Desktop Support Engineer Roles and Responsibilities:
以下是桌面支持工程师角色和职责的一些列表:
- Troubleshoot your system to fix any problems you may encounter.
- Install, upgrade, and maintain software and equipment.
- Ask questions to determine the cause of the problem.
- Provide remote troubleshooting services.
- Assist new employees in setting up their workstations.
- Train new employees on the company's software and apps.
- Identify and evaluate new technologies with existing vendors.
- Provide timely responses to ad hoc and urgent requests.
- Provide technical advice to an organization's executives.
- Monitor and optimize the performance of an organization's desktop infrastructure.
- Analyze connection issues.
236. Can you explain Active Directory?
你能解释一下 Active Directory 吗?
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6a8a | 官方: 否 | 付费: 否
答案:
Active Directory (AD) is a directory service that allows users to connect with the network resources they need to complete their tasks. Essentially, the database (or directory) is a place where you store information about your environment, such as what users and computers you have and who is allowed to do what. The Active Directory service allows administrators to control users' access to network resources and manage permissions. The data in Active Directory is stored as objects, such as users, groups, applications, and devices. These objects are classified according to their names and attributes.
Active Directory(AD)是一种目录服务,允许用户连接到完成其任务所需的网络资源。本质上,数据库(或目录)是一个存储有关环境信息的地方,例如你有哪些用户和计算机,以及谁被允许做什么。Active Directory 服务允许管理员控制用户对网络资源的访问并管理权限。Active Directory 中的数据以对象形式存储,如用户、组、应用程序和设备。这些对象根据其名称和属性进行分类。
237. What is DHCP?
什么是 DHCP?
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6a8d | 官方: 否 | 付费: 否
答案:
DHCP or Dynamic Host Configuration Protocol: As a network management protocol or application layer protocol, it is used to automatically assign an IP (Internet Protocol) host with its IP address, as well as related configuration details such as Subnet mask, DNS address, Default gateway, Router address, and Vendor class identifier.
DHCP 或动态主机配置协议:作为一种网络管理协议或应用层协议,它用于自动为主机分配 IP(互联网协议)地址,以及相关的配置详细信息,如子网掩码、DNS 地址、默认网关、路由器地址和供应商类标识符。
- Data Science
- All Events
- My Events
238. Explain scope and superscope.
解释作用域和超级作用域。
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6a90 | 官方: 否 | 付费: 否
答案:
IP addresses such as the subnet mask, gateway IP, and DNS server IP are all included in the scope. It can be used as a means of communication with the other computers in the network. A superscope is formed by combining two or more scopes.
作用域中包含诸如子网掩码、网关IP和DNS服务器IP等IP地址。它可以作为与网络中其他计算机通信的一种方式。将两个或更多作用域组合在一起即形成超级作用域。
239. What is DNS (Domain Naming Service)?
什么是DNS(域名命名服务)?
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6a93 | 官方: 否 | 付费: 否
答案:
Essentially, DNS (Domain Name System) is what acts as the phone book of the Internet. Domain names such as scaler.com and interviewbit.com are used by humans to access information online. A web browser interacts with the Internet using IP addresses. DNS transforms domain names into IP addresses for browsers to access Internet resources.
本质上,DNS(域名系统)充当互联网的电话簿。诸如scaler.com和interviewbit.com等域名被人类用来在线访问信息。Web浏览器通过IP地址与互联网交互。DNS将域名转换为IP地址,以便浏览器访问互联网资源。
Every connected device to the internet has an IP address that can be used by other machines to find that device. With DNS servers, humans no longer need to memorize IP addresses like 172.158.1.16 (in IPv4), or complex addresses like 2550:ab00:2628:1::c629:d5a6 (in IPv6).
每个连接到互联网的设备都有一个IP地址,其他机器可以使用该地址来找到该设备。借助DNS服务器,人类不再需要记住类似172.158.1.16(在IPv4中)的IP地址,或类似2550:ab00:2628:1::c629:d5a6(在IPv6中)的复杂地址。
240. Explain forward and reverse lookup in DNS.
解释DNS中的正向和反向查找。
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6a96 | 官方: 否 | 付费: 否
答案:
Once you install the DNS (Domain Name System) Server role in a Windows environment, you'll have the ability to create new forward and reverse lookup zones. Each zone serves a different purpose. - Forward lookup zone: This zone maps hostnames to IP addresses. Whenever a computer requests an IP address by providing the hostname, the forward look-up zone is queried to obtain the IP address for that hostname. For example, if you type www.scaler.com into the address bar of your browser, the forward zone is queried and it will return the IP address 137.336.245.17, which is actually the IP address of the site you are looking at.
在Windows环境中安装DNS(域名系统)服务器角色后,您将能够创建新的正向和反向查找区域。每个区域都有不同的用途。- 正向查找区域:此区域将主机名映射到IP地址。每当计算机通过提供主机名请求IP地址时,都会查询正向查找区域以获取该主机的IP地址。例如,如果您在浏览器地址栏中输入www.scaler.com,系统会查询正向区域并返回IP地址137.336.245.17,这实际上是您正在查看的站点的IP地址。
- Reverse lookup zone: This zone maps an IP address to the hostname. Whenever a computer requests a hostname (domain name) by using an IP address, the reverse zone is queried to obtain the hostname for that IP address. For example, if you request the hostname for an IP address 137.336.245.17, the reverse zone is queried and will return the hostname www.scaler.com.
241. What is an IAS Server?
什么是IAS服务器?
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6a99 | 官方: 否 | 付费: 否
答案:
Internet Authentication Service (IAS) is a network server owned by Microsoft that authenticates users. It offers authorization and authentication services to remote users connecting to corporate networks. The IAS is a side server that is not directly connected to any traffic, and instead, communicates only with the RAS (Remote Access Service) server. When a client computer requests to connect to a network, the RAS must validate its credentials, and since credentials are stored on the IAS server, the RAS contacts the IAS server with the user name of the applicant to obtain authentication details.
互联网认证服务(IAS)是微软拥有的网络服务器,用于对用户进行身份验证。它为连接到企业网络的远程用户提供授权和认证服务。IAS是一个旁路服务器,不直接连接任何流量,而只与RAS(远程访问服务)服务器通信。当客户端计算机请求连接到网络时,RAS必须验证其凭据,由于凭据存储在IAS服务器上,因此RAS会联系IAS服务器并提供申请人的用户名以获取认证详细信息。
242. State difference between DC (Domain controller) and ADC (Additional Domain Controller).
说明DC(域控制器)和ADC(附加域控制器)之间的区别。
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6a9c | 官方: 否 | 付费: 否
答案:
- DC (Domain controller): A DC is a server in a Windows Server domain that handles authentication requests like usernames and passwords. This is responsible for granting hosts access to Windows domain resources. This first DC is a Global Catalog (GC) that handles all five FSMO responsibilities: PDC Emulator, RID Master, Infrastructure Master, Schema Master, and Domain Name Master.
- ADC (Additional Domain Controller): An ADC is a backup for a domain controller. In ADC, there are only three operational roles, namely PDC Emulator, RID Master, and Infrastructure Master.
243. Explain the default gateway.
解释默认网关。
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6a9f | 官方: 否 | 付费: 否
答案:
Default Gateways are nodes (physically connected devices) that allow devices from one network to communicate with devices from another network. Any host trying to reach a destination outside its own network must use a default gateway. The default gateway is simply one that is used by default unless there is no other gateway specified.
默认网关是允许一个网络中的设备与另一个网络中的设备通信的节点(物理连接设备)。任何试图到达其自身网络外部目标的主机必须使用默认网关。默认网关就是默认使用的网关,除非指定了其他网关。
244. What is group policy?
什么是组策略?
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6aa2 | 官方: 否 | 付费: 否
答案:
Group Policy is primarily used for security purposes and can be used to configure security settings for users and computers. Essentially, it provides administrators with a central location for managing and configuring operating systems, applications, and users' preferences. With it, you are able to control certain things like the user's ability to shut down the system, run a command, or access the control panel. When used correctly, group policies can be a great tool for increasing the security of user computers and preventing both insider threats and external threats from exploiting their computer systems.
组策略主要用于安全目的,可用于配置用户和计算机的安全设置。本质上,它为管理员提供了一个集中位置来管理和配置操作系统、应用程序以及用户的偏好设置。借助它,您可以控制某些事项,例如用户关闭系统、运行命令或访问控制面板的能力。如果使用得当,组策略可以是增强用户计算机安全性并防止内部威胁和外部威胁利用其计算机系统的强大工具。
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
245. Define FIXMBR command.
定义FIXMBR命令。
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6aa5 | 官方: 否 | 付费: 否
答案:
The fixmbr command is essentially a Recovery Console command you can use to write a new master boot record on the computer hard disk drive that is specified in the command. Only Windows 2000 and Windows XP provide access to this command.
fixmbr命令本质上是一条恢复控制台命令,您可以使用它为命令中指定的计算机硬盘驱动器写入新的主引导记录。只有Windows 2000和Windows XP提供对该命令的访问权限。
Syntax: fixmbr device_name
语法:fixmbr 设备名称
Device_name specifies the drive location to which a master boot record will be written. By default, the master boot record is written to the primary boot drive if no device is specified.
Device_name 指定将写入主引导记录(MBR)的驱动器位置。默认情况下,如果未指定设备,则主引导记录会写入主启动驱动器。
246. What is SID (Security Identifier)?
什么是 SID(安全标识符)?
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6aa8 | 官方: 否 | 付费: 否
答案:
Security Identifiers (SIDs) are the unique identification numbers that are used by computers or domain controllers to uniquely identify you. Its purpose is to uniquely identify a user, a group of users, or another security principal by using a string of alphanumeric characters. SID is assigned to the security principal for the lifetime of the principal (within a given domain) and all the principal's properties, including its name, are associated with that SID. It is designed in such a way that a principal may be renamed (for example, from "Make Smith" to "Make Jones") without affecting the security attributes of objects associated with that principal.
安全标识符(SID)是计算机或域控制器用于唯一标识您的唯一识别号码。其目的是通过一串字母数字字符唯一标识用户、用户组或其他安全主体。在主体的生命周期内(在给定域内),SID 被分配给该安全主体,并且该主体的所有属性(包括其名称)都与该 SID 相关联。其设计方式使得主体可以重命名(例如,从“Make Smith”更改为“Make Jones”),而不会影响与该主体关联的对象的安全属性。
247. State difference between Desktop OS and Server OS.
说明桌面操作系统和服务器操作系统之间的区别。
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6aab | 官方: 否 | 付费: 否
答案:
Differences between Server OS and Desktop OS are as follows:
服务器操作系统和桌面操作系统之间的区别如下:
Desktop (Client) OS 桌面(客户端)操作系统 | Server OS 服务器操作系统 |
|---|
It is a type of operating system that runs on desktop computers as well as some other portable devices, such as laptops and mobile phones. 它是在台式计算机以及一些其他便携式设备(如笔记本电脑和手机)上运行的操作系统类型。 | A server OS is one that runs on a server. 服务器操作系统是在服务器上运行的操作系统。 |
In fact, it may handle several hardware components, including printers, monitors, cameras, and other components, that are connected to it. 实际上,它可能处理多个硬件组件,包括连接到其上的打印机、显示器、摄像头和其他组件。 | It is an enhanced version of an operating system that provides additional features and capabilities to multiple connected devices or client machines. 它是操作系统的增强版本,为多个连接的设备或客户端计算机提供额外的特性和功能。 |
It serves just one user at a time. 它一次仅服务一个用户。 | Multiple clients can be served simultaneously. 可以同时服务多个客户端。 |
It is an operating system for desktop computers. 它是用于台式计算机的操作系统。 | The operating system is designed for use on servers. 该操作系统设计用于服务器。 |
Less security is provided. 提供的安全性较低。 | It has a higher processing power, is more stable, and is highly efficient. 它具有更高的处理能力,更稳定,并且效率很高。 |
It is less stable, less efficient, and less powerful. 它不太稳定,效率较低,功能较弱。 | Providing greater security. 提供更高的安全性。 |
Examples: Android, Windows, etc. 示例:Android、Windows 等。 | Examples: Linux, Red Hat, etc. 示例:Linux、Red Hat 等。 |
248. Is it possible to convert a Hard Disk to Dynamic? If so, how?
是否可以将硬盘转换为动态磁盘?如果可以,如何转换?
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6aae | 官方: 否 | 付费: 否
答案:
Yes, Hard disks can be converted to Dynamic Disks. Here are the steps: - Firstly, log in to your administrator account and open the Run window.
是的,硬盘可以转换为动态磁盘。步骤如下:- 首先,登录管理员账户并打开“运行”窗口。
- Enter the diskmgmt.msc command and click Enter to complete.
- A new screen will appear. Right-click on the Basic hard disk option and select Convert to Dynamic Disk.
249. Can a client be accessed from a different location other than the server?
客户端可以从服务器以外的不同位置访问吗?
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6ab1 | 官方: 否 | 付费: 否
答案:
MSTSC command (Remote Desktop Command) is available to enable access to a client from a different location than the server. Basically, it enables you to get access to another person's computer as if you were next to it. To do this, you have to know the IP address of the remote computer or you have to be connected to the same network.
MSTSC 命令(远程桌面命令)可用于从服务器以外的不同位置访问客户端。基本上,它使您能够像在他人计算机旁边一样访问该计算机。为此,您必须知道远程计算机的 IP 地址,或者必须连接到同一网络。
If you want to use this command, you simply need to launch a run window and then type mstsc/v:COMPUTER/f . Here, V stands for the remote computer and f stands for full screen. Click on next. You may also type mstsc and hit Enter to open the Remote Desktop dialogue box. There, you can enter the name of the computer or IP address to connect to.
如果要使用此命令,只需启动“运行”窗口,然后输入 mstsc/v:COMPUTER/f。此处,V 代表远程计算机,f 代表全屏。单击“下一步”。您也可以输入 mstsc 并按 Enter 键以打开“远程桌面”对话框。在那里,您可以输入要连接的计算机名称或 IP 地址。
250. State difference between Tree and Forest in Active Directory.
说明 Active Directory 中树和林之间的区别。
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6ab4 | 官方: 否 | 付费: 否
答案:
The difference between Tree and Forest are as follows:
树和林之间的区别如下:
Tree 树 | Forest 林 |
|---|
A collection of domains which are connected together in an Active Directory hierarchy is referred to as a tree, a tree domain, or a domain tree. 在 Active Directory 层次结构中连接在一起的域集合称为树、树域或域树。 | Forests are collections of trees, or domain trees, which provide the highest level of security. 林是树或域树的集合,提供最高级别的安全性。 |
The tree domain contains multiple domains that can communicate with each other by using trusts. 树域包含多个域,这些域可以使用信任关系相互通信。 | Furthermore, objects within the same forest are able to communicate with one another. 此外,同一林内的对象能够相互通信。 |
They can communicate one way or two ways. Furthermore, a tree follows a parent-child hierarchy. 它们可以单向或双向通信。此外,树遵循父子层次结构。 | The two forests should have forest-level trust in order for objects in one forest to exchange information with objects in another forest. 两个林应具有林级信任,以便一个林中的对象与另一个林中的对象交换信息。 |
251. Explain safe mode.
解释安全模式。
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6ab7 | 官方: 否 | 付费: 否
答案:
When you start your computer in safe mode, it will only run the essential programs that are needed to run your computer. As soon as you turn on your computer, a number of drivers are loaded, which are programs that enable your operating system (OS) to communicate with software and devices. In contrast, when you boot your computer in safe mode, only a minimal number of drivers (typically only the keyboard, mouse, and display drivers) are loaded. In safe mode, your operating system is loaded in a very basic state, allowing you to potentially determine what is causing the issue.
当您在安全模式下启动计算机时,它只会运行运行计算机所需的基本程序。打开计算机后,会加载许多驱动程序,这些驱动程序是使操作系统(OS)能够与软件和设备通信的程序。相比之下,在安全模式下启动计算机时,只会加载最少数量的驱动程序(通常只有键盘、鼠标和显示器驱动程序)。在安全模式下,操作系统以非常基本的状态加载,使您能够潜在地确定导致问题的原因。
252. How do you start a computer in safe mode?
你如何以安全模式启动计算机?
- 知识点: 前端 / 行为与软技能 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6aba | 官方: 否 | 付费: 否
答案:
Sol: The following are the two ways you can launch your computer in safe mode: - Method 1:
解答:以下是以安全模式启动计算机的两种方法:- 方法1:
Restart the computer. Tap the F8 key as soon as the system begins to boot. This will lead you to a range of boot options, including Safe Mode. - Method 2:
重启计算机。系统开始启动时立即按F8键。这将引导你进入一系列启动选项,包括安全模式。- 方法2:
Press Windows + R together to open the Run command window, and then type "msconfig" into the box. The system configuration window will appear. Select the Boot tab, check the "Safe boot", and choose "Minimum" for a normal safe boot. By clicking Apply, your computer will start in Safe Mode the next time it is started.
同时按下Windows + R键打开运行命令窗口,然后在框中输入“msconfig”。系统配置窗口将出现。选择启动选项卡,勾选“安全启动”,并选择“最小”进行正常的安全启动。点击应用后,你的计算机将在下次启动时以安全模式运行。
253. Define Permissions, Policy, and Rights.
定义权限、策略和权利。
- 知识点: 前端 (主题: desktop-support;标签: interviewbit, desktop-support, topic-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37a7058d557c902ba6abd | 官方: 否 | 付费: 否
答案:
- Permission: An administrator has the right to assign permissions to network resources such as files, folders, printers, etc.
- Policies: Policies are assigned to containers of Active Directory, such as domains, sites, OU (Organizational Unit), etc. In general, policies are defined by organizations and applied to their objects and resources.
- Rights: Users and groups are given rights, and as an Administrator, you determine which user has access to those resources. The user's rights tell you how they are going to access the resources.
254. What is Bubbling and Capturing?
什么是冒泡和捕获?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab338 | 官方: 否 | 付费: 否
答案:
When an event occurs on the DOM, it does not take place completely on one element. The event bubbles up or goes to its parent, grandparents, and grandparent's parent until it reaches the window in the Bubbling Phase, whereas the event starts out from window down to the element that prompted the event or the event target in the Capturing Phase.
当DOM上发生事件时,它不会完全在一个元素上发生。在冒泡阶段,事件会向上冒泡或传递到其父元素、祖父元素和曾祖父元素,直到到达窗口;而在捕获阶段,事件从窗口开始向下传递到触发事件的元素或事件目标。
There are three stages of event propagation: - Capturing Phase - the event begins with the window and progresses through each element until it reaches the target element.
事件传播有三个阶段:- 捕获阶段 - 事件从窗口开始,并逐步经过每个元素,直到到达目标元素。
- Target Phase - The event has arrived at the target element.
- Bubbling Phase - The event bubbles up from the target element and then up every element until it reaches the window.
255. What is the difference between for..of and for..in?
for..of和for..in有什么区别?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab33b | 官方: 否 | 付费: 否
答案:
- for in: runs over an object's enumerable property names.
- for of: (new in ES6) takes an object-specific iterator and loops through the data it generates.
Both the for..of and for..in commands iterate over lists, but the results they return are different: for..in returns a list of keys on the object being iterated, whereas for..of returns a list of values of the object's numeric attributes.
for..of和for..in命令都会遍历列表,但它们返回的结果不同:for..in返回被遍历对象的键列表,而for..of返回对象数值属性的值列表。
let arr = [3, 4, 5];
let arr = [3, 4, 5];
for (let i in arr) {
for (let i in arr) {
console.log(i); // "0", "1", "2",
console.log(i); // “0”,“1”,“2”,
}
for (let i of arr) {
for (let i of arr) {
console.log(i); // "3", "4", "5"
console.log(i); // “3”,“4”,“5”
}
256. What is the reason behind adding Symbol to ES6?
在ES6中添加Symbol的原因是什么?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab33e | 官方: 否 | 付费: 否
答案:
Symbols are a new type of object that can be used as distinct property names in objects. Using Symbols instead of strings allows separate modules to create properties that are not mutually exclusive. Symbols can also be kept private, preventing anyone who does not have direct access to the Symbol from accessing its properties.
符号是一种新类型的对象,可以用作对象中的独特属性名。使用符号而非字符串可以让不同的模块创建互不冲突的属性。符号也可以保持私有,防止没有直接访问该符号权限的人访问其属性。
Symbols are a brand-new kind of primitive. Symbols, like numbers, strings, and booleans, have a function that can be used to produce them. Symbols, unlike the other primitives, do not have a literal syntax (similar to how strings have ") and can only be created using the Symbol constructor:
符号是一种全新的原始类型。符号与数字、字符串和布尔值一样,有一个函数可以用来生成它们。与其他原始类型不同,符号没有字面量语法(类似于字符串有引号),只能通过符号构造函数创建:
let symbol = Symbol();
let symbol = Symbol();
In truth, Symbols are only a little different means of attaching properties to an object; the well-known Symbols could easily be provided as standard methods, just like Object.prototype.has Own Property which appears in anything that inherits from Object.
事实上,符号只是将属性附加到对象上的一个略微不同的方式;知名符号很容易可以作为标准方法提供,就像 Object.prototype.hasOwnProperty 出现在任何继承自 Object 的对象中一样。
257. What is Babel?
什么是 Babel?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab341 | 官方: 否 | 付费: 否
答案:
Babel is an open-source JavaScript transpiler that converts ECMAScript 2015+ (ES6+) code into a backwards compatible version of JavaScript that can be run by previous JavaScript engines. Babel is a popular tool for exploiting the JavaScript programming language's latest capabilities.
Babel 是一个开源的 JavaScript 转译器,它将 ECMAScript 2015+(ES6+)代码转换为向后兼容的 JavaScript 版本,可由旧版 JavaScript 引擎运行。Babel 是利用 JavaScript 编程语言最新功能的流行工具。
Babel plugins are used to convert syntax that isn't widely supported into a version that is backwards compatible. Arrow functions, for example, which are defined in ES6, are translated to ordinary function declarations. It's also possible to translate non-standard JavaScript syntax, such as JSX. Babel may automatically inject core-js polyfills for support capabilities that aren't available in JavaScript environments. Static methods like Array.from and built-ins like Promise, for example, are only accessible in ES6+, but they can be utilised in previous contexts by using core-js.
Babel 插件用于将不受广泛支持的语法转换为向后兼容的版本。例如,ES6 中定义的箭头函数会被转换为普通函数声明。还可以转换非标准的 JavaScript 语法,如 JSX。Babel 可以自动注入 core-js 填充库,以支持 JavaScript 环境中不可用的功能。例如,像 Array.from 这样的静态方法和像 Promise 这样的内置对象仅在 ES6+ 中可用,但通过使用 core-js 可以在旧环境中使用。
258. Name some array methods that were introduced in ES6.
说出一些在 ES6 中引入的数组方法。
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab344 | 官方: 否 | 付费: 否
答案:
Methods 方法 | Description 描述 |
|---|
| Array.from() | It will convert iterable values and array-like values into arrays. 它将可迭代值和类数组值转换为数组。 |
| Array.of() | It will create a new array instance from a variable number of arguments no matter what the number or the type of arguments are. 它将根据可变数量的参数创建一个新数组实例,无论参数的数量或类型如何。 |
| Array.prototype.copyWithin() | It will copy the portion of an array to a different place within the same array. 它将把数组的一部分复制到同一数组中的不同位置。 |
| Array.prototype.find() | It will find an element in an array, based on certain parameters that are passed into this method. 它将根据传入此方法的某些参数在数组中查找元素。 |
| Array.prototype.findIndex() | It will return the index of the first element of the given array that fulfills the given condition. 它将返回满足给定条件的给定数组中第一个元素的索引。 |
| Array.prototype.entries() | It will return an array iterator object that can be used while looping through the keys and values of arrays. 它将返回一个数组迭代器对象,可用于遍历数组的键和值。 |
| Array.prototype.keys() | It will return an array iterator object as well as the keys of the array. 它将返回一个数组迭代器对象以及数组的键。 |
| Array.prototype.values() | It will provide the value of each key. 它将提供每个键的值。 |
| Array.prototype.fill() | It will fill the specific array elements with a static value. 它将用静态值填充特定的数组元素。 |
- Data Science
- All Events
- My Events
259. Name some string functions introduced in ES6.
说出一些在 ES6 中引入的字符串函数。
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37aeb58d557c902bab347 | 官方: 否 | 付费: 否
答案:
Methods 方法 | Description 描述 |
|---|
| startsWith | It determines if a string begins with the characters of a given string. 它判断一个字符串是否以给定字符串的字符开头。 |
| endsWith | It determines if a string ends with the characters of a given string. 它判断一个字符串是否以给定字符串的字符结尾。 |
| includes | It will return true if the given argument is present in the string. 如果给定参数存在于字符串中,它将返回 true。 |
| repeat | It creates and returns a new string which contains the given number of copies of the string on which this method was called, concatenated together. 它创建并返回一个新字符串,其中包含调用该方法的字符串的指定数量副本,并拼接在一起。 |
260. Compare the ES5 and ES6 codes for object initialization and parsing returned objects.
比较 ES5 和 ES6 代码对象初始化和解析返回对象的写法。
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab34a | 官方: 否 | 付费: 否
答案:
Object initialization: Variables with the same name are frequently used to create object properties. Consider the following scenario:
对象初始化:经常使用同名的变量来创建对象属性。考虑以下场景:
// ES5 code
// ES5 代码
var
var
x = 1, y = 2, z = 3;
x = 1, y = 2, z = 3;
ob = {
ob = {
x : a,
x : a,
y : b,
y : b,
z : z
z : z
};
// ob.x = 1, ob.y = 2, ob.z = 3
// ob.x = 1, ob.y = 2, ob.z = 3
In ES6, there's no need for tedious repetition!
在ES6中,不再需要繁琐的重复操作!
// ES6 code
// ES6代码
const
const
x = 1, y = 2, z = 3;
x = 1, y = 2, z = 3;
ob = {
ob = {
x
x
y
y
z
z
};
// ob.x = 1, ob.y = 2, ob.z = 3
// ob.x = 1, ob.y = 2, ob.z = 3
Parsing returned objects : Only one value can be returned by a function, but that value could be an object with hundreds of properties and/or methods. In ES5, you must first get the returned object and then extract values from it. Consider the following scenario:
解析返回的对象:函数只能返回一个值,但该值可以是一个包含数百个属性和/或方法的对象。在ES5中,你必须先获取返回的对象,然后从中提取值。考虑以下场景:
// ES5 code
// ES5 代码
var
var
ob = getObject(),
ob = getObject(),
a = ob.a,
a = ob.a,
b = ob.b,
b = ob.b,
c = ob.c;
c = ob.c;
This is made easier by ES6 destructuring, which eliminates the need to keep the object as a variable:
通过ES6解构赋值可以更轻松地实现这一点,它消除了将对象保存为变量的需要:
// ES6 code
// ES6代码
const { a , b , c } = getObject();
const { a , b , c } = getObject();
261. How do you use Destructuring Assignment to swap variables?
如何使用解构赋值来交换变量?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab34d | 官方: 否 | 付费: 否
答案:
var a = 1, b = 2;
var a = 1, b = 2;
[a, b] = [b, a];
[a, b] = [b, a];
console.log(a); // 2
console.log(a); // 2
console.log(b); // 1
console.log(b); // 1
262. What is the result of the spread operator array shown below?
下面展示的扩展运算符数组的结果是什么?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab350 | 官方: 否 | 付费: 否
答案:
[...'apple']
[...'apple']
Output: ['a', 'p', 'p', 'l', 'e']
输出:['a', 'p', 'p', 'l', 'e']
Explanation: A string is an iterable type, and in an array, the spread operator transfers each character of an iterable to one element. As a result, each character in a string becomes an Array element.
解释:字符串是一种可迭代类型,在数组中,展开运算符会将可迭代对象的每个字符转移到一个元素中。因此,字符串中的每个字符都成为数组的一个元素。
263. Which keyword can be used to deploy inheritance in ES6?
在ES6中,哪个关键字可以用来实现继承?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab353 | 官方: 否 | 付费: 否
答案:
The extend keyword is used to implement inheritance in the ES6 language. There was no idea of classes in prior versions of Javascript, but with the release of ES6, Pure Object Oriented elements were added to the language.
ES6语言中使用extend关键字来实现继承。在早期版本的JavaScript中没有类的概念,但随着ES6的发布,纯面向对象的元素被添加到了该语言中。
class Classroom {
class Classroom {
constructor(students) {
constructor(students) {
this.students = students;
this.students = students;
}
room() {
room() {
console.log('This class has ' + this.students + ' students');
console.log('This class has ' + this.students + ' students');
}
}
class sectionA extends Classroom {
class sectionA extends Classroom {
constructor(students) {
constructor(students) {
super(students);
super(students);
}
sec() {
sec() {
console.log('section A');
console.log('section A');
}
}
let secA = new sectionA(40);
let secA = new sectionA(40);
secA.room();
secA.room();
secA.sec();
secA.sec();
264. Explain the Rest parameter in ES6.
解释ES6中的Rest参数。
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab356 | 官方: 否 | 付费: 否
答案:
It's a new feature in ES6 that enhances the ability to manage arguments. Indefinite arguments can be represented as an array using rest parameters. We can invoke a function with any number of parameters by utilizing the rest parameter.
这是ES6中的一个新特性,增强了管理参数的能力。使用Rest参数可以将不定数量的参数表示为数组。通过使用Rest参数,我们可以用任意数量的参数调用函数。
function display(...args) {
function display(...args) {
let ans = 0;
let ans = 0;
for (let i of args) {
for (let i of args) {
ans *= i;
ans *= i;
}
console.log("Product = "+ans);
console.log("Product = "+ans);
}
display(4, 2, 3);
display(4, 2, 3);
Output:
输出:
Product = 24
Product = 24
265. What are the object oriented features supported in ES6.
ES6支持哪些面向对象特性?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab359 | 官方: 否 | 付费: 否
答案:
The object-oriented features supported in ES6 are: - Classes: We can create classes in ES6. The class function essentially builds a template from which we may later create objects. When a new instance of the class is created, the constructor method is invoked.
ES6支持的面向对象特性有:- 类:我们可以在ES6中创建类。类函数本质上构建了一个模板,之后我们可以从中创建对象。当创建类的新实例时,会调用构造函数方法。
- Methods: Static methods can also be found in classes. A static method, unlike an object, is a function that is bound to the class. A static method can't be called from a class instance.Let's take a look at getters and setters for a moment. Encapsulation is a fundamental notion in OOP. Data (object properties) should not be directly accessed or updated from outside the object, which is a crucial aspect of encapsulation. A getter (access) or a setter (modify) are particular methods we define in our class to access or edit a property.
- Inheritance: It is also possible for classes to inherit from one another. The parent is the class that is being inherited from, and the child is the class that is inheriting from the parent.
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
266. Give a thorough comparison between ES5 and ES6.
请对ES5和ES6进行详细比较。
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab35c | 官方: 否 | 付费: 否
答案:
| ES5 | ES6 |
|---|
ES5 is the fifth edition of the ECMAScript which was introduced in 2009. ES5是ECMAScript的第五版,于2009年推出。 | ES6 is the sixth edition of the ECMAScript which was introduced in 2015. ES6是ECMAScript的第六版,于2015年推出。 |
Primitive data types that are string, boolean, number, null, and undefined are supported by ES5. ES5支持基本数据类型,如字符串、布尔值、数字、null和undefined。 | There are a few additions to the JavaScript data types in ES6. For supporting unique values, a new primitive data type 'symbol' was introduced. ES6在JavaScript数据类型上增加了一些内容。为了支持唯一值,引入了新的基本数据类型'symbol'。 |
In ES5, we could define the variables by using the var keyword only. 在ES5中,我们只能使用var关键字来定义变量。 | In ES6, in addition to var, there are two new methods to define variables: let and const. 在ES6中,除了var外,还有两种定义变量的新方法:let和const。 |
Both function and return keywords are used in order to define a function in ES5. 在ES5中,定义函数需要使用function和return关键字。 | An arrow function is a newly added feature in ES6 in which we don't require the function keyword in order to define the function. 箭头函数是ES6中新增的功能,定义函数时不需要使用function关键字。 |
In ES5, a for loop is used to iterate over elements. 在ES5中,使用for循环来遍历元素。 | ES6 introduced the idea of for...of loop in order to iterate over the values of the iterable objects. ES6引入了for...of循环的概念,用于遍历可迭代对象的值。 |
267. What is the difference between let and const? What distinguishes both from var?
let和const有什么区别?它们与var有何不同?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab35f | 官方: 否 | 付费: 否
答案:
When declaring any variable in JavaScript, we used the var keyword. Var is a function scoped keyword. Within a function, we can access the variable. When we need to create a new scope, we wrap the code in a function.
在JavaScript中声明任何变量时,我们使用var关键字。Var是函数作用域的关键字。在函数内部,我们可以访问该变量。当需要创建新作用域时,我们将代码包裹在函数中。
Both let and const have block scope. If you use these keywords to declare a variable, it will only exist within the innermost block that surrounds them. If you declare a variable with let inside a block (for example, if a condition or a for-loop), it can only be accessed within that block.
let和const都具有块级作用域。如果使用这些关键字声明变量,它只会存在于包围它们的最内层块中。如果在块内(例如,条件或for循环)使用let声明变量,则只能在该块内访问它。
The variables declared with the let keyword are mutable, which means that their values can be changed. It's akin to the var keyword, but with the added benefit of block scoping. The variables declared with the const keyword are block-scoped and immutable. When variables are declared with the const keyword, their value cannot be modified or reassigned.
使用 let 关键字声明的变量是可变的,这意味着它们的值可以被更改。它类似于 var 关键字,但具有块级作用域的额外优势。使用 const 关键字声明的变量是块级作用域且不可变的。当使用 const 关键字声明变量时,它们的值不能被修改或重新赋值。
268. Discuss the arrow function.
讨论箭头函数。
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37aeb58d557c902bab362 | 官方: 否 | 付费: 否
答案:
In ES6, arrow functions are introduced. The shorthand syntax for writing ES6 functions is arrow functions. The arrow function's definition consists of parameters, followed by an arrow (=>), and the function's body.
在 ES6 中,引入了箭头函数。编写 ES6 函数的简写语法是箭头函数。箭头函数的定义由参数组成,后跟箭头(=>),以及函数体。
The 'fat arrow' function is another name for the Arrow function. We won't be able to employ them as constructors.
“胖箭头”函数是箭头函数的另一个名称。我们将无法将它们用作构造函数。
const function_name = (arg_1, arg_2, arg_3, ...) => {
const function_name = (arg_1, arg_2, arg_3, ...) => {
//body of the function
//函数体
}
Few things to note: - It reduces the size of the code.
需要记住的几点:- 它减少了代码的大小。
- For a single-line function, the return statement is optional.
- Bind the context lexically.
- For a single-line statement, functional braces are not required.
- Doesn’t work with new
269. When should one not use arrow functions?
什么时候不应该使用箭头函数?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37aeb58d557c902bab365 | 官方: 否 | 付费: 否
答案:
One should not use arrow functions in the following cases: - Function Hoisting, Named Functions:
在以下情况下不应使用箭头函数:- 函数提升、命名函数:
As arrow functions are anonymous, we cannot use them when we want function hoisting or when we want to use named functions. - Object methods:
由于箭头函数是匿名的,当我们想要函数提升或想要使用命名函数时,不能使用它们。- 对象方法:
var a = {
var a = {
b: 7,
b: 7,
func: () => {
func: () => {
this.b--;
this.b--;
}
}
The value of b does not drop when you call a.func. It's because this isn't bound to anything and will inherit the value from its parent scope. - Callback functions with dynamic context:
当你调用 a.func 时,b 的值不会下降。这是因为 this 未被绑定到任何东西,并将从其父作用域继承值。- 具有动态上下文的回调函数:
var btn = document.getElementById('clickMe');
var btn = document.getElementById('clickMe');
btn.addEventListener('click', () => {
btn.addEventListener('click', () => {
this.classList.toggle('on');
this.classList.toggle('on');
});
We'd get a TypeError if we clicked the button. This is due to the fact that this is not bound to the button, but rather to its parent scope. - this/arguments:
如果我们点击按钮,就会得到一个 TypeError。这是因为 this 没有绑定到按钮上,而是绑定到了它的父级作用域。- this/arguments:
Since arrow functions don’t have this/arguments of their own and they depend on their outer context, we cannot use them in cases where we need to use this/arguments in a function.
由于箭头函数没有自己的 this/arguments,它们依赖于外部上下文,因此在我们需要在函数中使用 this/arguments 的情况下,不能使用它们。
270. What is the generator function?
什么是生成器函数?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37aeb58d557c902bab368 | 官方: 否 | 付费: 否
答案:
This is a newly introduced feature in ES6. The Generator function returns an object after generating several values over time. We can iterate over this object and extract values from the function one by one. A generator function returns an iterable object when called. In ES6, we use the * sign for a generator function along with the new ‘yield' keyword.
这是 ES6 中新增的一个特性。生成器函数会在随时间生成多个值后返回一个对象。我们可以遍历这个对象,并逐一从函数中提取值。生成器函数在被调用时会返回一个可迭代对象。在 ES6 中,我们使用 * 符号表示生成器函数,并使用新的 ‘yield' 关键字。
function *Numbers() {
function *Numbers() {
let num = 1;
let num = 1;
while(true) {
while(true) {
yield num++;
yield num++;
}
}
var gen = Numbers();
var gen = Numbers();
// Loop to print the first
// 循环打印前
// 5 Generated numbers
// 5 个生成的数字
for (var i = 0; i < 5; i++) {
for (var i = 0; i < 5; i++) {
// Generate the next number
// 生成下一个数字
document.write(gen.next().value);
document.write(gen.next().value);
// New Line
// 新行
document.write("
");
document.write("
");
}
Output:
输出:
1
2
3
4
5
The yielded value becomes the next value in the sequence each time yield is invoked. Also, generators compute their output values on demand, allowing them to efficiently represent expensive to compute sequences or even infinite sequences.
每次调用yield时,产生的值成为序列中的下一个值。此外,生成器按需计算其输出值,从而能够高效地表示昂贵的序列甚至无限序列。
271. What is the “spread” operator in ES6?
ES6中的“展开”运算符是什么?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab36b | 官方: 否 | 付费: 否
答案:
The list of parameters is obtained using the spread operator. Three dots (...) are used to represent it. The spread operator divides an iterable (such as an array or a string) into individual elements. It's mostly used in JavaScript to make shallow copies of JS. It improves the readability of your code by making it more concise.
参数列表是使用展开运算符获得的。用三个点(...)来表示。展开运算符将可迭代对象(如数组或字符串)拆分为单独的元素。它主要在JavaScript中用于制作JS的浅拷贝。它通过使代码更简洁来提高可读性。
The spread operator can be used to join two arrays together or to concatenate them.
展开运算符可用于将两个数组合并或将它们连接起来。
let arr1 = [4, 5, 6];
let arr1 = [4, 5, 6];
let arr2 = [1, 2, 3, ...arr1, 7, 8, 9, 10];
let arr2 = [1, 2, 3, ...arr1, 7, 8, 9, 10];
console.log(arr2);
console.log(arr2);
Output:
输出:
[ 1 2 3 4 5 6 7 8 9 10 ]
272. Explain Destructuring in ES6.
解释ES6中的解构。
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab36e | 官方: 否 | 付费: 否
答案:
Destructuring was introduced in ES6 as a way to extract data from arrays and objects into a single variable. It is possible to extract smaller fragments from objects and arrays using this method. The following is an example.
解构在ES6中被引入,作为从数组和对象中提取数据到单个变量的方法。可以使用此方法从对象和数组中提取较小的片段。以下是一个示例。
let greeting =['Good','Morning'];
let greeting =['Good','Morning'];
let [g1, g2] = greeting;
let [g1, g2] = greeting;
console.log (g1, g2);
console.log (g1, g2);
Output:
输出:
Good Morning
Good Morning
273. What are Promises in ES6?
ES6中的Promise是什么?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab371 | 官方: 否 | 付费: 否
答案:
Asynchronous programming is a concept found in JavaScript. The processes are run separately from the main thread in asynchronous programming. Promises are the most convenient approach to deal with asynchronous programming in ES6. Depending on the outcome of the procedure, a promise can be refused or resolved. Callbacks were used to cope with asynchronous programming before promises were introduced in ES6.
异步编程是JavaScript中的一个概念。在异步编程中,进程与主线程分开运行。Promise是处理ES6中异步编程最便捷的方法。根据程序的结果,Promise可以被拒绝或解决。在ES6中引入Promise之前,回调函数被用于处理异步编程。
However, it caused the problem of callback hell, which was addressed with the introduction of promises.
然而,这导致了回调地狱的问题,而Promise的引入解决了这个问题。
(A callback is a function that is performed after another function has completed. When working with events in JavaScript, callback is very useful. As an argument to another function, we pass a function into another function.
(回调是在另一个函数完成后执行的函数。在JavaScript中处理事件时,回调非常有用。作为另一个函数的参数,我们将一个函数传入另一个函数。
When we use callbacks in our web applications, it's common for them to get nested. Excessive callback usage clogs up your web application and leads to callback hell.)
当我们在Web应用程序中使用回调时,它们往往会变得嵌套。过多的回调使用会阻塞您的Web应用程序,并导致回调地狱。)
274. Mention some popular features of ES6.
请提及ES6的一些流行特性。
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab375 | 官方: 否 | 付费: 否
答案:
Some of the common ES6 features are: - Supports constants/immutable variables.
ES6的一些常见特性包括:- 支持常量/不可变变量。
- Block scope support for all variables, constants and functions.
- Introduction to arrow functions
- Handling extended parameter
- Default parameters
- Extended and template literals
- De-structuring assignment
- Promises
- Classes
- Modules
- Collections
- Supports Map/Set & Weak-map/Weak-Set
- Localization, meta-programming, internationalization
275. Discuss the template literals in ES6.
讨论ES6中的模板字面量。
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab379 | 官方: 否 | 付费: 否
答案:
Template literals are a brand-new feature in ES6. It makes producing multiline strings and performing string interpolation simple.
模板字面量是ES6中的一个全新特性。它使得生成多行字符串和执行字符串插值变得简单。
Template literals, also known as string literals, allow for embedded expressions.
模板字面量,也称为字符串字面量,允许包含嵌入表达式。
Template literals were referred to as template strings prior to ES6. The backtick (``) character is used to enclose template literals. The dollar sign and curly brackets (${expression}) are used to denote placeholders in template literals. If we need to use an expression within the backticks, we can put it in the (${expression}) variable.
在ES6之前,模板字面量被称为模板字符串。反引号(``)字符用于包围模板字面量。美元符号和大括号(${expression})用于表示模板字面量中的占位符。如果我们需要在反引号内使用表达式,可以将其放在(${expression})变量中。
let s1 = "Good";
let s1 = "Good";
let s2 = "Day";
let s2 = "Day";
let s = ${s1} ${s2};
let s = ${s1} ${s2};
console.log(s);
console.log(s);
Output:
输出:
Good Day
Good Day
276. Why should one use ES6 classes?
为什么应该使用ES6类?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab37c | 官方: 否 | 付费: 否
答案:
Developers have discovered that ES6 classes are really handy. The following are some of the most common applications of ES6 classes: - The syntax of ES6 classes is simpler and less prone to errors.
开发者发现 ES6 类非常实用。以下是 ES6 类的一些最常见应用:- ES6 类的语法更简单且不易出错。
- When it comes to building up inheritance hierarchies, ES6 is the ideal option because it combines new and old syntax, reducing errors and simplifying the process.
- ES6 classes prevent developers from making mistakes when using a new operator. If this proves to be an invalid object for the constructor, classes eliminate this issue by having the constructor throw an exception.
- Classes can also be used to call a method from the prototype's version. With the new ES6 syntax, this version is significantly easier to use than previous versions.
277. How can you create a class in ES6?
如何在 ES6 中创建类?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab37f | 官方: 否 | 付费: 否
答案:
The keyword class is used to create a class in ES6. We can use class expressions or class declarations to include classes in our code. Only functions and constructors are allowed in a class definition. These components are collectively referred to as the class's data members.
关键字 class 用于在 ES6 中创建类。我们可以使用类表达式或类声明将类包含在代码中。在类定义中只允许使用函数和构造函数。这些组件统称为类的数据成员。
Constructors in classes are responsible for allocating memory to the class's objects. A class's functions are in charge of performing actions on the objects.
类中的构造函数负责为类的对象分配内存。类的函数负责对对象执行操作。
Syntax: In ES5
语法:在 ES5 中
var varName = new className {
var varName = new className {
}
Syntax: In ES6 (Using class keyword)
语法:在 ES6 中(使用 class 关键字)
class className{
class className{
}
278. What is a class expression?
什么是类表达式?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab382 | 官方: 否 | 付费: 否
答案:
In ES6, one way to define a class is to use the Class expression. Class expressions, like function expressions, can be named or unnamed. If the class is named, the name is unique to the class body. Prototype-based inheritance is used in JavaScript classes.
在 ES6 中,定义类的一种方式是使用类表达式。类表达式与函数表达式类似,可以命名或匿名。如果类被命名,则该名称对于类主体是唯一的。JavaScript 类使用基于原型的继承。
var Product = class {
var Product = class {
constructor (num1, num2) {
constructor (num1, num2) {
this.num1 = num1;
this.num1 = num1;
this.num2 = num2;
this.num2 = num2;
}
multiplication() {
multiplication() {
return this.num1 * this.num2;
return this.num1 * this.num2;
}
}
console.log(new Product(5,8).multiplication());
console.log(new Product(5,8).multiplication());
// expected output: 40
// 预期输出: 40
The syntax of a class expression is similar to that of a class statement (declaration). Class expressions, on the other hand, allow you to omit the class name (“binding identifier”), which is not possible with class statements. Additionally, unlike class declarations, class expressions allow you to redefine/re-declare classes without causing any type errors. It is not required to use the constructor property. The type of classes created with this keyword will always be "function."
类表达式的语法类似于类语句(声明)。另一方面,类表达式允许您省略类名(“绑定标识符”),而类语句则无法做到这一点。此外,与类声明不同,类表达式允许您重新定义/重新声明类,而不会引发任何类型错误。不要求使用构造函数属性。使用此关键字创建的类的类型将始终为“function”。
279. What do you understand about default parameters?
您对默认参数有何理解?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab385 | 官方: 否 | 付费: 否
答案:
If no value or undefined is passed, we can use the default parameters to set default values for named parameters.
如果未传入值或传入undefined,我们可以使用默认参数为命名参数设置默认值。
var display = (x , y = 2) => {
var display = (x , y = 2) => {
console.log(x + " " + y);
console.log(x + " " + y);
}
display(1);
display(1);
Output:
输出:
1 2
280. What do you understand about IIFE (Immediately Invoked Function Expressions)?
您对IIFE(立即调用函数表达式)有何理解?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37aeb58d557c902bab388 | 官方: 否 | 付费: 否
答案:
IIFE is a JavaScript function that starts running as soon as it is defined. The Self-Executing Anonymous Function is another name for it. It is divided into two major sections, which are as follows: - The first part is a lexical scope (static scope) anonymous function that is enclosed by the Grouping operator ().
IIFE是一种在定义后立即开始运行的JavaScript函数。它也被称为自执行匿名函数。它分为两个主要部分,如下: - 第一部分是一个词法作用域(静态作用域)的匿名函数,由分组运算符()括起来。
Output:
输出:
Good Day
Good Day
281. What are the states of Promises in ES6?
ES6中Promise的状态有哪些?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab38b | 官方: 否 | 付费: 否
答案:
Promises mainly possess three states as follows: - Pending: This refers to the initial state of every promise. It indicates that the result has not yet been computed.
Promise主要具有以下三种状态: - Pending(待定):这指的是每个Promise的初始状态。它表示结果尚未计算完成。
- Fulfilled: It refers to the completion of a task.
Rejected: It indicates the failure that arises during computation.
The promise will be immutable once it has been fulfilled or rejected. A rejected function and a resolve function are the two arguments passed into the Promise() constructor. It returns either the first or second parameter, depending on the asynchronous operation.
Promise一旦被履行或拒绝就将是不可变的。拒绝函数和解析函数是传递给Promise()构造函数的两个参数。它根据异步操作返回第一个或第二个参数。
282. What is Export Default and Named Export in ES6?
ES6中的默认导出和命名导出是什么?
- 知识点: 前端 (主题: javascript, es6;标签: interviewbit, es6, topic-specific, javascript)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37aeb58d557c902bab38e | 官方: 否 | 付费: 否
答案:
With the help of the import statement, the export statement comes into picture when one needs to export functions, objects, and variables to other JavaScript modules. There are two methods for exporting: - Named Export: Named exports are useful when one has to export multiple values. The name of the imported module must match that of the exported module.
借助import语句,当需要将函数、对象和变量导出到其他JavaScript模块时,export语句就发挥作用了。有两种导出方法: - 命名导出:当需要导出多个值时,命名导出非常有用。导入模块的名称必须与导出模块的名称匹配。
Example:
示例:
//file rectangle.js
//文件 rectangle.js
function perimeter(x, y) {
函数周长(x, y) {
return 2 * (x + y);
返回 2 * (x + y);
}
function area(x, y) {
函数面积(x, y) {
return x * y;
返回 x * y;
}
export { perimeter, area };
导出 { 周长, 面积 };
//while importing the functions in test.js
//在 test.js 中导入函数时
import { perimeter, area } from './rectangle;
导入 { 周长, 面积 } 从 './rectangle;
console.log(perimeter(4, 6)) //20
控制台.log(周长(4, 6)) //20
console.log(area(4, 6)) //24
控制台.log(面积(4, 6)) //24
Output:
输出:
20
24
- Default Export: There is only one default export per module when it comes to default exports. A function, a class, an object, or anything else can be used as a default export. In default export, the naming of imports is fully autonomous, and we can choose any name we like.
Example:
示例:
// file module.js
// 文件 module.js
var a = 6;
变量 a = 6;
export default a;
导出默认 a;
// test.js
// test.js
// while importing a in test.js
// 在 test.js 中导入 a 时
import b from './module';
导入 b 从 './module';
console.log(b);
console.log(b);
// output will be 6
// 输出将是 6
Output:
输出:
6
- Using Named and Default Exports at the same time: In the same file, you can utilise both Named and Default exports. It means they'll both be imported into the same document.
//index.js
//index.js
var a = 3;
var a = 3;
const b = 8;
const b = 8;
function show() {
function show() {
return "This is a default export."
return "这是一个默认导出。"
}
function product(a , b) {
function product(a , b) {
return a * b;
return a * b;
}
export { show as default, a, b, product };
export { show as default, a, b, product };
//test.js file
//test.js 文件
import any_other_name, { a, b, product} from './index.js';
import any_other_name, { a, b, product} from './index.js';
console.log(any_other_name()); //This is a default export.
console.log(any_other_name()); //这是一个默认导出。
console.log(a); //3
console.log(a); //3
Output:
输出:
This is a default export.
这是一个默认导出。
3
283. What is the use of Ticker in Flutter?
Flutter 中 Ticker 的用途是什么?
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc1d | 官方: 否 | 付费: 否
答案:
We use a ticker to tell how often our animation is refreshed in Flutter. Signals are sent at a constant frequency, such as 60 times per second, using this type of signal-sending class. We understand it better with our watch, which ticks constantly. For each tick, a callback method is provided that has the time since the first tick at each second since it was started. The tickers are synchronized immediately, even if they begin at different times.
我们使用一个计时器(ticker)来告诉 Flutter 中动画的刷新频率。信号以恒定频率发送,例如每秒60次,通过这种信号发送类来实现。我们可以用我们的手表来更好地理解它,手表会持续滴答作响。每次滴答都会提供一个回调方法,该方法包含自启动以来每秒从第一次滴答起的时间。即使计时器在不同的时间开始,它们也会立即同步。
284. Explain Flutter Inspector.
解释 Flutter Inspector。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc20 | 官方: 否 | 付费: 否
答案:
In the same manner, as with Native Android, the XML file allows us to view our app's blueprint and properties. There is a powerful tool called Flutter Inspector for Flutter applications that allows you to visualize the blueprint of your widgets and their properties. Using it, you can diagnose various layout issues and understand the current layout. Flutter Inspector offers the following benefits: - Select widget mode
与原生 Android 类似,XML 文件允许我们查看应用的蓝图和属性。对于 Flutter 应用,有一个名为 Flutter Inspector 的强大工具,它允许你可视化你的小部件的蓝图及其属性。使用它,你可以诊断各种布局问题并理解当前布局。Flutter Inspector 提供以下好处: - 选择小部件模式
- Toggle platform
- Show paint baselines
- Show debug paint
- Refresh widget
- Enable slow animations
- Show/hide performance overlay
285. How would you execute code only in debug mode?
你会如何在仅调试模式下执行代码?
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc24 | 官方: 否 | 付费: 否
答案:
We first need to import the dart foundation in order to run the code only in debug mode:
我们首先需要导入 dart foundation 以便仅在调试模式下运行代码:
import 'package:flutter/foundation.dart' as Foundation;
import 'package:flutter/foundation.dart' as Foundation;
The next step is to use kReleaseMode as follows:
下一步是使用 kReleaseMode 如下所示:
if (Foundation.kReleaseMode){ // is Release Mode??
if (Foundation.kReleaseMode){ // 是发布模式吗??
print('release mode');
print('发布模式');
} else {
} else {
print('debug mode');
print('调试模式');
}
286. What is the use of Mixins?
Mixins 的用途是什么?
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc27 | 官方: 否 | 付费: 否
答案:
Multiple inheritances are not supported by Dart. Thus, we need mixins to implement multiple inheritances in Flutter/Dart. The use of mixins makes it easy to write reusable class code in multiple class hierarchy levels. Mixins can also be used to provide some utility functions (such as RenderSliverHelpers in Flutter).
Dart 不支持多重继承。因此,我们需要 mixins 在 Flutter/Dart 中实现多重继承。使用 mixins 可以轻松地在多个类层次级别编写可复用的类代码。Mixins 还可以用于提供一些实用功能(例如 Flutter 中的 RenderSliverHelpers)。
287. Explain packages and plugins in Flutter.
解释 Flutter 中的包和插件。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc2a | 官方: 否 | 付费: 否
答案:
A package is a collection of classes, interfaces, and sub-packages that enable the creation of modular code that can be shared easily among users. Applications can be quickly developed using packages instead of developing everything from scratch. You can import new widgets or functionality into an app using a package in Flutter. There is a slight difference between plugins and packages as given below: - Plugins: Using native code, enables more usability and makes it easier to use the device.
包是类、接口和子包的集合,能够创建可在用户之间轻松共享的模块化代码。使用包可以快速开发应用,而不是从头开始开发一切。在 Flutter 中,你可以使用包将新的小部件或功能导入到应用中。插件和包之间有一些细微差别,如下所示: - 插件:使用原生代码,提供更多可用性,并使其更容易使用设备。
288. Explain the flutter architecture.
解释 Flutter 架构。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: system-design
- 分类: fullstack
- id: 69b37af958d557c902babc2d | 官方: 否 | 付费: 否
答案:
The structure of Flutter consists of three layers:
Flutter 的结构由三层组成:
- Upper layers: The Dart-based platform that takes care of app widgets, gestures, animations, illustrations, and materials;
- Flutter engine: Handles the display and formatting of text.
- Built-in service: Used for the management of plugins, packages, and event loops.
289. List some important features of flutter.
列出 Flutter 的一些重要特性。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc30 | 官方: 否 | 付费: 否
答案:
Among the main features of flutter for developing mobile frameworks are:
Flutter 用于开发移动框架的主要特性包括:
- Flexibility, scalability, and integration: Flutter's easy-to-use and easy-to-integrate framework provides enhanced flexibility, scalability, and integration capabilities.
- Hot Reload: If the developer modifies the code, the changes can be seen immediately with Hot Reload. Thus, the changes are instantly visible within the app.
- One-Stop Solution: Flutter app development relies on a single framework and platform for the development, deployment, and management of changes, rather than using separate platforms and frameworks for different purposes.
- Native Performance and Internationalized Flutter Libraries: Flutter app development provides widgets customized for Android, iOS, and Google Fuchsia. Using widgets, you can integrate all the functionalities of the platform, such as scrolling, navigation, icons, and fonts.
- Huge Widget Library: It is because of Flutter's ready-to-use widget library that developers can develop apps faster when using the framework. In addition to a wide variety of widgets, it also includes animations with which you can spice up your application.
290. Write the limitations of flutter.
写出 Flutter 的局限性。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc33 | 官方: 否 | 付费: 否
答案:
Flutter has the following limitations: - Third-party libraries are limited: Since Flutter is relatively new, the number of third-party libraries is small. Additionally, some widgets in Flutter are only available on one platform.
Flutter 具有以下局限性:- 第三方库有限:由于 Flutter 相对较新,第三方库的数量较少。此外,Flutter 中的某些组件仅在一个平台上可用。
- Release size is larger: Developers get frustrated when the release size is not as expected.
- Requirements of Dart: Dart is an Object-oriented programming language, but it cannot compete with Java, JavaScript, or C# since it is still relatively new. As a result, not many developers choose it.
- Limited complexity: Flutter's 3D modeling, Unity integration, and game engines fall short. Therefore, most ad mobile platforms also don't support it.
- Lack of overall support: Flutter is not so widely used yet. Even though it enjoys the attention of tech enthusiasts, it still lacks the continuous support that will come with time. Currently, the only support that Flutter receives comes from its community.
291. What are different build modes in flutter?
Flutter 中有哪些不同的构建模式?
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc38 | 官方: 否 | 付费: 否
答案:
Depending on your development phase, the framework compiles your code in different ways or modes, which we called a build mode. Flutter's tooling allows the application to be compiled in three modes. Depending on our stage of development, we may choose between these compilation modes. - Debug Mode: This mode enables debugging of apps on a physical device, emulator, or simulator. Assertions and service extensions are enabled here. Quick deployment is then achieved by optimizing compilation.
根据您的开发阶段,框架以不同方式或模式编译代码,我们称之为构建模式。Flutter 的工具允许应用程序以三种模式编译。根据开发阶段,我们可以在这些编译模式之间选择。- 调试模式:此模式支持在物理设备、模拟器或仿真器上调试应用程序。此模式下启用断言和服务扩展。然后通过优化编译实现快速部署。
- Profile Mode: In this mode, some debugging abilities are maintained, enough to analyze the app's performance while testing. Tracing and some extensions are enabled in this case. On emulators and simulators, profile mode is disabled since their behavior does not reproduce real-world performance. The following command can be used to compile the profile mode: flutter run --profile
- Release Mode: When deploying the app, this mode is used to minimize the size of the footprint and maximize optimization. Debugging, assertions and service extensions are disabled here. Faster startup, faster execution, and less size are its key features. The following command can be used to compile the release mode: flutter run --release
292. Explain the flutter widget and write its importance.
解释 Flutter 组件并写出其重要性。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc3c | 官方: 否 | 付费: 否
答案:
Generally, a Flutter app consists of a number of widgets. A widget is a way to declare and construct user interfaces. In Flutter, you must write code inside a widget in order to build anything. With the widget, you can see how your app would appear with its current configuration. As soon as you modify the code, the widget will rebuild its description based on the difference between the old and new widget, and the changes will sync up with the UI of the app. The Flutter widget can be created as follows:
通常,Flutter 应用程序由多个组件组成。组件是声明和构建用户界面的一种方式。在 Flutter 中,您必须在组件内编写代码才能构建任何内容。通过组件,您可以了解应用程序在当前配置下的外观。一旦修改代码,组件将基于新旧组件之间的差异重建其描述,更改将与应用程序的 UI 同步。Flutter 组件可以按如下方式创建:
Class ImageWidget extends StatelessWidget {
class ImageWidget extends StatelessWidget {
// Class Stuff
// 类内容
}
The app is built by nesting widgets within each other. This means the root of your app is a widget, and everything below it is a widget. Here's a simple image of what the widget tree looks like:
应用程序通过相互嵌套组件来构建。这意味着应用程序的根是一个组件,其下所有内容都是组件。以下是组件树外观的简单图示:
293. What are the types of widgets present in flutter?
Flutter 中存在哪些类型的组件?
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc3f | 官方: 否 | 付费: 否
答案:
In flutter, widgets can be divided into two categories:
在 Flutter 中,组件可以分为两类:
- Stateless Widget: A widget that does nothing is a Stateless Widget. In essence, they are static and don’t store any state. Thus, they don't save values that may change.
- Stateful Widget: A widget that does anything is a Stateful Widget. Stateful widgets are dynamic by nature, which means they can monitor changes and update the UI accordingly.
294. What do you mean by Dart? Write its importance.
Dart 是什么意思?写出其重要性。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc42 | 官方: 否 | 付费: 否
答案:
Dart, a programming language developed by Google, is used to code Flutter apps as well as server and desktop applications. By using Dart, Flutter avoids the use of a separate declarative layout language such as JSX or XML. A simple Dart program is shown in the following example:
Dart 是 Google 开发的一种编程语言,用于编写 Flutter 应用程序以及服务器和桌面应用程序。通过使用 Dart,Flutter 避免了使用单独的声明式布局语言(如 JSX 或 XML)。以下示例展示了一个简单的 Dart 程序:
void main()
void main()
{
for (int i = 0; i < 5; i++)
for (int i = 0; i < 5; i++)
{
print('hello ${i + 1}');
print('hello ${i + 1}');
}
}
An overview of Dart's importance: - Developers can read and visualize the layout of Dart very easily and effortlessly since it is declarative and programmatic.
Dart重要性的概述:- 开发者可以非常轻松且毫不费力地阅读和可视化Dart的布局,因为它是声明式和程序化的。
- Unlike other programming languages, it supports the majority of the basic programming concepts like classes, interfaces, and functions.
- Arrays are not directly supported by Dart. Rather, it supports the collection that replicates the data structure like arrays, generics, and optional typing.
- Despite being similar to JavaScript, Dart runs code several times faster.
- For better performance and to reduce code execution time, the Dart virtual machine (VM) uses both Just-in-Time (JIT) and Ahead-of-Time (AOT) compilers.
- Dart is object-oriented programming, which makes it very scalable and stable for creating even complex applications.
295. Explain App state.
解释应用状态。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc45 | 官方: 否 | 付费: 否
答案:
App State may also be referred to as a shared state or application state. It is possible to share app states across sections of your app and maintain user sessions in the same way. Here are some examples of App State: - Login info
应用状态也可以称为共享状态或应用程序状态。可以在应用的各个部分之间共享应用状态,并以相同的方式维护用户会话。以下是应用状态的一些示例:- 登录信息
- User preferences
- E-commerce shopping cart
- Social networking notifications, etc.
296. Write the difference between runApp() and main() in flutter.
写出Flutter中runApp()和main()的区别。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc48 | 官方: 否 | 付费: 否
答案:
main(): This function starts the program. Flutter does not allow us to write any program without the main() function. runApp(): Using runApp(), you are able to return the widgets that are connected to the screen as a root of the widget tree that will be rendered on the screen. This function is called in the main function, which is the driver of the app.
main():此函数启动程序。Flutter不允许我们在没有main()函数的情况下编写任何程序。runApp():使用runApp(),您可以将连接到屏幕的控件作为将在屏幕上渲染的控件树的根返回。此函数在main函数中调用,它是应用的驱动程序。
297. Write the advantages of using flutter.
写出使用Flutter的优势。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc4b | 官方: 否 | 付费: 否
答案:
For developing mobile applications, Flutter usually fulfills the custom needs and requirements. It offers the following advantages:
对于开发移动应用程序,Flutter通常满足自定义的需求和要求。它提供以下优势:
- Reduce Code Development: Flutter's hot reload feature allows it to offer faster performance. With it, the application gets compiled using the arm C/C++ library, making it closer to machine code and enabling it to run more quickly. The Flutter team has put lots of effort into providing a wide variety of ready-to-use widgets. Most of them are incredibly customizable, saving your time like no other framework before.
- Cross-platform Development: Using Flutter, you can write code, manage, and run it across multiple platforms. For the developers, this saves time, money, and effort.
- Live and Hot Reloading: This makes the app development process simpler and faster. Additionally, it also allows us to modify or update the code once a change is made.
- Similar to Native App performance: In contrast to most cross-platform frameworks, Flutter does not rely on intermediate code representations or interpretations. The Flutter application is built directly into the machine code, which eliminates any performance issues associated with the interpretation process. With Flutter, you get a fully compiled release application ahead of time.
- Good Community Support: Developers can ask questions about issues and get answers quickly.
- Little/Minimal Code: Each Flutter app is built using Dart programming language, which uses JIT and AOT compilation for faster startup time, faster performance, and smoother functionality. With the JIT feature, you can increase the speed of development and refresh the UI.
- Documentation: Flutter's documentation is well-organized and informative. It serves as a central repository for all written documents.
- Expressive and Flexible UI: Flutter offers a customizable layered architecture that allows for highly customizable designs, expressive UIs, and fast rendering.
298. Name some best editors for flutter development.
列举一些适合Flutter开发的最佳编辑器。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc4e | 官方: 否 | 付费: 否
答案:
With the Flutter development tools, developers can make Flutter development faster and thus boost their productivity. In order to develop mobile applications, Flutter IDE and tools require some plugins. With these plugins, we can compile Dart, analyze code, and develop Flutter. Here are some popular IDEs for Flutter development: - Android Studio
借助Flutter开发工具,开发者可以加快Flutter开发速度,从而提高生产力。为了开发移动应用程序,Flutter IDE和工具需要一些插件。通过这些插件,我们可以编译Dart、分析代码并开发Flutter。以下是一些流行的Flutter开发IDE:- Android Studio
- Visual Studio
- IntelliJ IDEA
- Xcode
- Eclipse
- Emacs
- Vim, etc.
299. Name some apps that mostly use flutter.
列举一些主要使用Flutter的应用程序。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc51 | 官方: 否 | 付费: 否
答案:
Flutter is used today by many organizations for developing apps. The following are some of the most popular apps built on Flutter: - Google Ads
如今,许多组织使用Flutter来开发应用程序。以下是一些最受欢迎的基于Flutter构建的应用程序:- Google Ads
- Reflectly
- Alibaba
- Birch Finance
- Coach Yourself
- Tencent
- Watermaniac, etc.
300. What do you mean by keys in flutter? When one should use it.
在Flutter中,key是什么意思?何时应该使用它?
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc54 | 官方: 否 | 付费: 否
答案:
Keys are used in Flutter as identifiers for widgets, elements, and semantic nodes. GlobalKeys and LocalKeys are the subclasses of Key. Within the widget tree, keys are responsible for preserving the state of modified widgets. With keys, you can also reorganize and modify collections of widgets that have an equivalent type and defined state. The primary use of keys is to modify a widget tree that contains stateful widgets, not to modify a tree that is totally composed of stateless widgets.
在Flutter中,key用作控件、元素和语义节点的标识符。GlobalKeys和LocalKeys是Key的子类。在控件树中,key负责保留已修改控件的状态。使用key,您还可以重新组织并修改具有相同类型和已定义状态的控件集合。key的主要用途是修改包含有状态控件的控件树,而不是修改完全由无状态控件组成的树。
301. Explain Container class in a flutter.
解释Flutter中的Container类。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc57 | 官方: 否 | 付费: 否
答案:
Basically, in Flutter, a container is a widget that has the capacity to accommodate multiple child widgets and manage them efficiently through dimensions, padding, and background color. Whenever we want to style the background of a widget, either because of a color, shape, or size constraint, we may use a container widget. With the Container class, widgets can be stored and positioned on the screen at our discretion. In general, it resembles a box for storing contents. In the following image, you see how a basic container has padding, margin, and border properties surrounding its child widget:
基本上,在 Flutter 中,容器是一个能够容纳多个子组件并通过尺寸、内边距和背景色高效管理它们的组件。每当我们想要设置组件背景的样式,无论是颜色、形状还是尺寸约束,我们都可以使用容器组件。通过 Container 类,我们可以按自己的意愿在屏幕上存储和定位组件。总的来说,它就像一个用于存储内容的盒子。在下图中,你可以看到一个基本容器如何具有围绕其子组件的内边距、外边距和边框属性:
302. Which one is better, either flutter or react native?
哪个更好,是 Flutter 还是 React Native?
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc5a | 官方: 否 | 付费: 否
答案:
Today, thousands of mobile apps are being built with the two most popular cross-platform development frameworks i.e., React Native and Flutter. There are many similarities between React Native and Flutter including reloading quickly, excellent UI, awesome tooling, and capability to build native apps. - React Native: This is an entirely JavaScript-based application using React. Facebook backed and open-sourced it in 2015.
如今,成千上万的移动应用正使用两种最流行的跨平台开发框架构建,即 React Native 和 Flutter。React Native 和 Flutter 之间有许多相似之处,包括快速重新加载、出色的用户界面、强大的工具以及构建原生应用的能力。- React Native:这是一个完全基于 JavaScript 的应用程序,使用 React。它在 2015 年由 Facebook 支持并开源。
303. When to use mainAxisAlignment and crossAxisAlignment.
何时使用 mainAxisAlignment 和 crossAxisAlignment。
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc5d | 官方: 否 | 付费: 否
答案:
The mainAxisAlignment is how items are aligned on that axis, whereas crossAxisAlignment is how items are aligned on the other axis. Row and column widgets can align their children according to our preferences using the crossAxisAlignment and the mainAxisAlignment properties. As Children of the Row Widget are arranged horizontally. For Row: mainAxisAlignment = Horizontal Axis crossAxisAlignment = Vertical Axis This can be better understood by looking at the image below:
mainAxisAlignment 是项目在该轴上的对齐方式,而 crossAxisAlignment 是项目在另一轴上的对齐方式。Row 和 Column 组件可以根据我们的偏好使用 crossAxisAlignment 和 mainAxisAlignment 属性来对齐其子组件。由于 Row 组件的子组件水平排列。对于 Row:mainAxisAlignment = 水平轴 crossAxisAlignment = 垂直轴 可以通过查看下图更好地理解:
As Children of the Column Widget are arranged vertically. For Column: mainAxisAlignment = Vertical Axis crossAxisAlignment = Horizontal Axis This can be better understood by looking at the image below:
由于 Column 组件的子组件垂直排列。对于 Column:mainAxisAlignment = 垂直轴 crossAxisAlignment = 水平轴 可以通过查看下图更好地理解:
304. Is Flutter Open Source or not?
Flutter 是开源的还是不是?
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc60 | 官方: 否 | 付费: 否
答案:
Yes, Flutter is a free and open-source UI software development kit from Google that allows developers to build cross-platform mobile apps with ease. Learn More .
是的,Flutter 是来自谷歌的免费且开源的 UI 软件开发工具包,允许开发者轻松构建跨平台移动应用。了解更多。
305. Why does a flutter app usually take a long developing time?
为什么 Flutter 应用通常需要很长的开发时间?
- 知识点: 前端 (主题: flutter, mobile;标签: interviewbit, flutter, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc63 | 官方: 否 | 付费: 否
答案:
The first time you build a Flutter application, it takes much longer than usual since Flutter creates a device-specific IPA or APK file. Xcode and Gradle are used in this process to build a file, which usually takes a lot of time.
你第一次构建 Flutter 应用程序时,花费的时间比平时长得多,因为 Flutter 会创建特定于设备的 IPA 或 APK 文件。在此过程中使用 Xcode 和 Gradle 来构建文件,这通常会花费很多时间。
306. What is ClickJacking?
什么是点击劫持?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc93 | 官方: 否 | 付费: 否
答案:
ClickJacking is a security attack where the user is fooled to click on something while they assume they are clicking another thing. The attack mostly happens by the HTML frames. ClickJacking is also regarded as the user interface redressing. It lets the user think that they are utilising a normal UI in the web page, but in actuality, there is an unseen UI in control; you can think of it as the user interface being redressed. When users click on one thing, assuming it to be secure and safe, the hidden UI executes another action.
点击劫持是一种安全攻击,用户被愚弄去点击某样东西,而他们以为自己在点击另一样东西。这种攻击大多通过 HTML 框架发生。点击劫持也被视为用户界面重定向。它让用户以为自己在网页上使用正常的用户界面,但实际上,有一个看不见的用户界面在控制中;你可以将其视为用户界面被重新设计。当用户点击某个东西,以为它安全可靠时,隐藏的用户界面执行了另一个操作。
307. Define HTML meta tags.
定义 HTML 元标签。
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc96 | 官方: 否 | 付费: 否
答案:
- Meta tags are passed as pairs of name/value.
- Meta tags can include data about encoding, document title, character description, etc,
- Meta tags fit inside the HTML page’s head tag.
- Meta tags are not displayed on the page but it is to be shown on the browser.
308. Differentiate between div and span?
区分 div 和 span?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc99 | 官方: 否 | 付费: 否
答案:
| DIV | SPAN |
|---|
It is utilized for separating the elements that are block-line, line break before and after it. 它用于分隔块级元素,在其前后有换行。 | Span is utilized for grouping inline elements in the HTML doc. Span 用于在 HTML 文档中分组内联元素。 |
It contains global attributes for the certain element in HTML documents. 它包含 HTML 文档中特定元素的全局属性。 | It includes certain, global and event attributes. 它包括特定、全局和事件属性。 |
At times para tag is utilised for inner side of the tag. 有时在标签内部使用段落标签。 | In a paragraph, tag is utilized to use a CSS style for certain words with the selected font sets. 在段落中,标签用于使用选定的字体集为特定单词应用 CSS 样式。 |
In div tag, we make use of borders with width height with specified color pixels to emphasize the front end document. 在 div 标签中,我们使用带有指定颜色像素的宽度和高度边框来强调前端文档。 | In the Span tag, we utilize specified color coding to depict the front-end document. 在 Span 标签中,我们使用指定的颜色编码来描绘前端文档。 |
309. What is React JS?
React JS 是什么?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc9c | 官方: 否 | 付费: 否
答案:
An open-source front-end JavaScript library, ReactJS is used primarily for building user interfaces, especially for one-page applications. Also, it is utilized for handling the view layer for web and mobile apps. React lets programmers build large web applications that can modify data, without the need to reload the page. The main objective of React is to be quick, scalable, and easy. It functions only on user interfaces in the application and corresponds to the view in the MVC template. It can be utilized with a combination of other JavaScript frameworks or libraries, like Angular JS in MVC.
作为一个开源的前端 JavaScript 库,ReactJS 主要用于构建用户界面,尤其适用于单页应用。此外,它也用于处理网页和移动应用中的视图层。React 使程序员能够构建可以修改数据的大型网页应用,而无需重新加载页面。React 的主要目标是快速、可扩展和易于使用。它仅作用于应用程序中的用户界面,对应于 MVC 模板中的视图部分。它可以与其他 JavaScript 框架或库(如 MVC 中的 Angular JS)组合使用。
310. Describe the advantages of REST web services?
描述 REST Web 服务的优势?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babc9f | 官方: 否 | 付费: 否
答案:
Listed below are some of the advantages of REST web services : - The curve of learning is simple since it works on the HTTP protocol.
下面列出了 REST Web 服务的一些优势:- 学习曲线简单,因为它基于 HTTP 协议工作。
- No contract clears between server and client, so roughly coupled application.
- REST approaches can be effortlessly tested on the browser.
- It also backs multiple technologies for the transfer of, for instance, image, JSON, XML, text, etc.
- It is a lightweight protocol.
- Data Science
- All Events
- My Events
311. How browsers render the UI?
浏览器如何渲染 UI?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babca2 | 官方: 否 | 付费: 否
答案:
The primary responsibility of the rendering engine is to highlight the requested page on the browser’s screen. Rendering engines can show XML and HTML images and documents. If you’re utilising additional plugins, the engines can also exhibit various documents like PDF. - Receives the requested document: The contents of the requested document is obtained by the rendering engine from HTML’s networking layer.
渲染引擎的主要职责是在浏览器屏幕上高亮显示请求的页面。渲染引擎可以显示 XML 和 HTML 图像及文档。如果使用了额外的插件,引擎还可以展示各种文档,如 PDF。- 接收请求的文档:渲染引擎从 HTML 的网络层获取请求文档的内容。
- Construct the DOM tree: Parsed the HTML to the parsed tree and then set up the DOM tree, making use of it.
- Construct the CSSOM: CSSOM stands for CSS Object Model. Post the construction of the DOM tree, it identifies a link tag in the head section, which references the external style.css CSS style sheet. So, it parsed the CSS file in CSSOM tree, something which the Browser can comprehend as the DOM tree.
- Construct the Render tree: Utilise the HTML DOM tree coupled with the styling data of the CSSOM tree to set up a render tree. Render tree is the graphical depiction of the HTML, with the corresponding CSS. This tree enables painting the contents in their right order. Every node in the Render Tree is regarded as a renderer. The Render tree looks like this:
- Layout: When the renderer is developed and incorporated into the tree, it does not have a size or position. Computing these values is defined as layout. We use the coordinates system to position the element, such as the position of the root renderer is 0,0. The layout continues recursively via a part of the entire renderer hierarchy, calculating geometric info for every renderer that needs it. Beginning the layout process implies allowing every node the exact coordinates where it should show up on the screen.
- Painting of the Render Tree: The renderer tree is traversed in this stage and the renderer’s paint() method is hailed to exhibit the content on the screen. For good UX, the rendering engine will aim to exhibit the contents on the screen as soon as possible. It will not stand by until all the HTML is parsed to develop and layout the render tree.
312. What is a Grid system in CSS?
CSS 中的 Grid 系统是什么?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babca5 | 官方: 否 | 付费: 否
答案:
CSS splits the page into grids and utilizes those grids to handle the HTML content. Utilizing the Grids, CSS can stack and highlight various elements in different parts of the grids.
CSS 将页面分割成网格,并利用这些网格来处理 HTML 内容。利用网格,CSS 可以在网格的不同部分堆叠和高亮显示各种元素。
313. Describe the distinction between Class and Prototypal inheritance in Javascript?
描述 JavaScript 中类继承和原型继承之间的区别?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babca8 | 官方: 否 | 付费: 否
答案:
From most other programming languages, Inheritance in JavaScript is different. JavaScript's object system is prototype-based, not class-based. Objects in JavaScript are just a set of value pairs and a name (key). Talking about inheritance, JavaScript just has one construct: objects. Each object has a private property that includes a link to another object named its prototype.
JavaScript 中的继承与大多数其他编程语言不同。JavaScript 的对象系统基于原型,而非基于类。JavaScript 中的对象只是一组值对和名称(键)。谈到继承,JavaScript 只有一种构造:对象。每个对象都有一个私有属性,该属性包含指向另一个对象(称为其原型)的链接。
314. Explain user-centered design?
解释以用户为中心的设计?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babcab | 官方: 否 | 付费: 否
答案:
An iterative design procedure, User-centred design lets the designers focus on the clients and their needs in every design process phase. The user-centered design calls for linking users in the design process via a variability of design and research techniques to make usable and highly accessible products. User-centered design demands that designers should utilize a combination of generative (such as brainstorming) and investigative (interviews and surveys) methods and instruments to create an understanding of user requirements.
作为一种迭代设计过程,以用户为中心的设计让设计师在每个设计过程阶段都关注客户及其需求。以用户为中心的设计要求通过多种设计和研究技术将用户链接到设计过程中,以制作可用且高度可访问的产品。以用户为中心的设计要求设计师利用生成性(如头脑风暴)和调查性(如访谈和调查)方法和工具的结合,以理解用户需求。
315. What skills does a front-end developer need?
前端开发人员需要哪些技能?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babcae | 官方: 否 | 付费: 否
答案:
Frontend developers utilize different web technologies to change coded data into user-friendly interfaces. Many among these are Cascading Style Sheets (CSS), JavaScript, HyperText Markup Language (HTML), etc. Mentioned below are brief explanations of these technologies that frontend developers must be acquainted with.
前端开发人员利用不同的 Web 技术将编码数据转换为用户友好的界面。其中许多技术包括层叠样式表(CSS)、JavaScript、超文本标记语言(HTML)等。下面简要介绍这些前端开发人员必须熟悉的技术。
- HTML: HyperText Markup Language depicts the content on the page like buttons, links, headings, paragraphs, and lists. It is the building block of websites and is utilized to define and mark content, so a browser shows it correctly. For instance, on a blog post, an image can be seen as an in HTML code, so browsers will understand that they have to display an image.
- CSS: CSS stands for Cascading Style Sheets and is accountable for the style of your web pages such as animations., colours, and layouts. CSS appears more like a group of instructions that gives structure and style to a webpage than a programming language. It enables programmers to control a web application or website's layout, formatting, and presentation. While HTML depicts elements on a page, CSS is accountable for how users see the content. For instance, it handles the border, alignment, size, of an image in a blog post.
- JavaScript: JavaScript is one of three main elements, in front-end web development, that is required to end up with a web page that can be rendered accurately. It is now challenging to visualize websites without JavaScript as it allows programmers to make the sites interactive. This programming language can transform website content on the basis of a user’s action. For instance, at the top of the page, when you click on the Menu button, it will display a dropdown list of options or when you click on a button, it will toggle back and forth between closing and opening the Menu. JavaScript is great at figuring out the kind of browser being utilised, and then rendering the page in such a way that it is not only compatible with that page, but that it works the way it is designed. Using plugins is made easier by JavaScript. When complicated dynamic interactions are required for a site, JavaScript can be implemented to design its framework instead of simply depending only on HTML.
- CSS Frameworks, Libraries, and Preprocessors: Once you understand the fundamentals of CSS, then you can begin to work with various libraries and frameworks. These tools were designed as a way to help hasten the development process. Frameworks like Tailwind CSS, and Bootstrap let you incorporate the catalogue of classes into your webpage. Hence, you end up with mobile-friendly and professional designs. There are ample choices on the market and you don't require to know them all. It's often useful to look at related jobs and check what technologies they're employing. Then you can concentrate on the most in-demand skills.
- Testing and Debugging skills: As you are creating your application, there will be mistakes in your code that require to be fixed. Debugging is the act of recognizing those bugs and resolving them. Another essential skill to know is debugging. Documenting tests for your code is a way to assure that your code is accomplishing what it is meant to do.
- Version control: The way of tracking and the modifications to the project's code is version control. Git is regarded as a popular software that is utilized to track your code. If your code gets messed up, you can utilize Git to go back to an earlier version of your code rather than manually rewriting everything. Learning Git also lets you cooperate with others on a team and make modifications to the same code base from various locations. It is advised that you should start to learn Git and use a service like GitHub to host your projects.
316. Tell me when and why should I make use of Webpack?
告诉我何时以及为什么我应该使用 Webpack?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babcb1 | 官方: 否 | 付费: 否
答案:
While creating a complicated front-end application with tons of non-code static possessions, for instance, CSS, fonts, images, etc, then, of course, you should make use of Webpack since it has a lot of amazing benefits.
当创建具有大量非代码静态资源(如 CSS、字体、图像等)的复杂前端应用时,那么,当然,你应该使用 Webpack,因为它有很多惊人的优势。
If you have a small application that doesn't have a lot of static resources and you only have to create one file of JavaScript to help the customers, then Webpack should be more overhead than needed.
如果你有一个小型应用,静态资源不多,只需要创建一个JavaScript文件来帮助客户,那么使用Webpack可能反而增加了不必要的开销。
317. Mention three ways to decrease page load time?
提三种减少页面加载时间的方法?
- 知识点: 前端 / 行为与软技能 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babcb4 | 官方: 否 | 付费: 否
答案:
There are numerous things accountable for lowering page load time. Let us look at the three best ways to reduce its loading time: - Image Optimization: It is always advised to scale your videos and pictures before uploading them to a page.
有许多因素会导致页面加载时间变长。让我们看看减少加载时间的三种最佳方法:- 图像优化:通常建议在上传视频和图片到页面之前先进行缩放处理。
- Browser Cache: The utilization of cache will boost speed for pages that you have visited already.
- Optimize and compress content: Compressing the content of a website decreases the load time of a page to a great extent.
- StyleSheet Reference on Top: Setting stylesheet reference to the header of a doc allows your page to load quickly.
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
318. How does the server hanger the page in which content is present in several languages?
当页面内容包含多种语言时,服务器是如何处理的?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babcb7 | 官方: 否 | 付费: 否
答案:
When an HTTP request is sent to the server by the user, the user browser also sends a chunk of additional information regarding the language preference as the Accept-Language header. Then the server reads the HTTP request with the Accept-Language header and sends the document version back along with the right language and declares the language attribute Lang in the HTML tag.
当用户向服务器发送HTTP请求时,用户的浏览器也会发送一些额外的信息,关于语言偏好,作为Accept-Language请求头。然后,服务器读取带有Accept-Language请求头的HTTP请求,并发送带有正确语言的文档版本,同时在HTML标签中声明lang语言属性。
Example:
示例:
319. Why did we utilize the data- the attribute in HTML and why it is now advised not to use?
为什么我们在HTML中使用data-属性,为什么现在又不建议使用它?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babcba | 官方: 否 | 付费: 否
答案:
Generally, Data-* attributes of HTML are utilized to accumulate the custom data, which is private to the web application or page. This custom data is for personalizing the JavaScript of the user as per the user action on the web page.
通常,HTML的Data-*属性用于积累自定义数据,这些数据对Web应用或页面来说是私有的。这些自定义数据用于根据用户在网页上的操作来个性化用户的JavaScript。
These days, Data-*attributes are not advised to utilize as the user can change the attribute easily just by utilizing the browser inspect console.
如今,不建议使用Data-*属性,因为用户只需通过浏览器的检查控制台就能轻松更改属性。
Example:
示例:
320. Mention the benefits of CoffeeScript over JavaScript?
请说明CoffeeScript相比JavaScript有哪些好处?
- 知识点: 前端 (主题: frontend, web-development;标签: interviewbit, front-end-developer, topic-specific, frontend, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37af958d557c902babcbd | 官方: 否 | 付费: 否
答案:
- Write less do more − For a huge code in JavaScript, we require comparatively a very less number of lines of CoffeeScript.
- Easily understandable − The shorthand form of JavaScript is CoffeeScript, its syntax is quite simple as compared to JavaScript. Making use of CoffeeScript, we can document clean, clear, and easily discernible codes.
- Reliable − CoffeeScript is a secure and reliable programming language to create dynamic programs.
- Readable and maintainable − CoffeeScript offers aliases for most of the operators, making the code readable. Also maintaining the programs written in CoffeeScript is effortless.
- Class-based inheritance − JavaScript does not have classes, in place of them, it offers powerful but complicated prototypes. Unlike JavaScript, in CoffeeScript, we can make classes and inherit them. Additionally, it also provides instant and static properties along with mixins. It utilizes JavaScript's native prototype to construct classes.
- No var keyword − There is no requirement to utilize the var keyword to form a variable in CoffeeScript, hence we can evade accidental or undesirable scope deceleration.
- Avoids problematic symbols − There is no requirement to utilize the problematic parenthesis and semicolons in CoffeeScript. In place of curly braces, we can utilize whitespaces to distinguish the block codes such as functions, loops, etc.
- Extensive library support − In CoffeeScript, we can utilize the JavaScript libraries and vice versa. Thus, we have access to a myriad set of libraries while operating with CoffeeScript.
321. Explain the meaning of multithreading.
请解释多线程的含义。
- 知识点: 前端 / 后端 / 算法与数据结构 / 行为与软技能 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd05 | 官方: 否 | 付费: 否
答案:
The thread is an independent part or unit of a process (or an application) that is being executed. Whenever multiple threads execute in a process at the same time, we call this "multithreading". You can think of it as a way for an application to multitask.
线程是进程(或应用)中被执行的独立部分或单元。当多个线程同时在进程中执行时,我们称之为“多线程”。你可以把它看作是一种让应用进行多任务处理的方式。
Advantages: - By multithreading, computing resources are also minimized and used more effectively.
优点:- 通过多线程,计算资源也被最小化并得到更有效的利用。
- The response time of the application is improved since requests from one thread do not block requests from other threads.
- Consequently, if one of the threads encounters an exception, it will not affect the other threads.
- Multithreading, on the other hand, uses fewer resources than running multiple processes simultaneously.
- The overhead, time usage, and management associated with creating processes are much higher when compared to creating and managing threads.
322. Which language is the most preferred by full-stack developers?
全栈开发者最偏好哪种语言?
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd08 | 官方: 否 | 付费: 否
答案:
Full Stack Developers utilize several programming languages. Ideally, a candidate should be fluent in several languages, preferably some for designing the front end and others for fixing the back end. Since Full Stack developers work with a variety of technologies and applications, they must be proficient in at least two to three of the most popular languages such as Java, Python, Ruby, PHP, C++, etc .
全栈开发者使用多种编程语言。理想情况下,候选人应熟练掌握多种语言,最好有一些用于设计前端,另一些用于修复后端。由于全栈开发者与各种技术和应用打交道,他们必须精通至少两到三种最流行的语言,如Java、Python、Ruby、PHP、C++等。
323. Explain Pair Programming.
请解释结对编程。
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37afa58d557c902babd0b | 官方: 否 | 付费: 否
答案:
In pair programming, two programmers share only one machine and work together. During the development process, one programmer will be the driver who codes and another will act as the observer (navigator) who will make sure the code is written correctly, proofread and spell-check it, while also deciding where to go next. Roles can be swapped at any time: the driver becomes the observer and vice versa. You can also call it "pairing", "paired programming", or "programming in pairs".
在结对编程中,两个程序员共享一台机器并一起工作。在开发过程中,一个程序员将作为司机负责编写代码,另一个则作为观察者(导航员),确保代码编写正确,进行校对和拼写检查,同时决定下一步要做什么。角色可以随时互换:司机变成观察者,反之亦然。你也可以称之为“结对”、“结对编程”或“成对编程”。
Advantages: - Two of them will fix the problem if the driver encounters any issues with the code.
优点:- 如果驱动程序在代码中遇到任何问题,其中两个方法将修复这些问题。
- The two programmers working on the same program are only 15% slower than if they worked independently instead of 50%.
- As a result of having another programmer look over your work, you are more likely to write better code. One study showed that it results in 15% fewer bugs than code written by a single programmer.
- It leads to improved collaboration, higher quality, better code, and sustained improved development practices.
- During the project, each person teaches the other, resulting in more efficient and expedited knowledge exchange.
- The team develops better communication skills.
324. What do you mean by CORS (Cross-Origin Resource Sharing)?
你所说的CORS(跨源资源共享)是什么意思?
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd0e | 官方: 否 | 付费: 否
答案:
CORS refers to cross-origin resource sharing. It's a browser mechanism that allows web pages in one domain to have controlled access to resources in other domains (cross-domain requests). This allows scripts that are run on a browser client to interact with and access resources from other origins. In doing so, it extends and provides greater flexibility to the SOP (Same-Origin Policy). Same-origin policies restrict the ability of a website to access resources outside of its source domain. For example, a JavaScript app that wants to make a call to an API (Application Programming Interface) that runs on another domain will be blocked due to the SOP. A CORS policy was implemented to circumvent restrictions caused by same-origin policies.
CORS指的是跨源资源共享。这是一种浏览器机制,允许一个域中的网页对其他域中的资源进行受控访问(跨域请求)。这使得在浏览器客户端上运行的脚本能够与其他源进行交互并访问其资源。这样做,它扩展了同源策略(SOP),并为其提供了更大的灵活性。同源策略限制了一个网站访问其源域之外资源的能力。例如,一个想要调用运行在另一个域上的API(应用程序编程接口)的JavaScript应用,会因SOP而被阻止。实施CORS策略是为了规避同源策略造成的限制。
In addition, if a website's CORS policy is not configured properly, it may be vulnerable to cross-domain attacks. This means that it cannot stop cross-origin attacks like CSRF (Cross-Site Request Forgery).
此外,如果网站的CORS策略配置不当,它可能容易遭受跨域攻击。这意味着它无法阻止像CSRF(跨站请求伪造)这样的跨源攻击。
325. What is Callback Hell?
什么是回调地狱?
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd11 | 官方: 否 | 付费: 否
答案:
Callback Hell, or Pyramid of Doom, is a common anti-pattern seen in asynchronous programming code (multiple functions running at the same time). This slang term describes a large number of nested "if" statements or functions. In simple terms, Callback hell is a situation where you have multiple asynchronous functions. Those functions depend on one another, so it could get quite messy with so many callback functions nested in so many layers. The use of callback functions leaves you with code that is difficult to read and maintain, and looks like a pyramid as shown below:
回调地狱,或称为“厄运金字塔”,是异步编程代码(多个函数同时运行)中常见的一种反模式。这个俚语描述了大量嵌套的“if”语句或函数。简单来说,回调地狱是一种有多个异步函数的情况。这些函数相互依赖,因此嵌套在多层中的许多回调函数可能会变得相当混乱。使用回调函数会使代码难以阅读和维护,并看起来像下面所示的金字塔:
This also makes it more difficult to identify the flow of the application, which is the main obstacle to debugging, which is the reason for the famous name of this problem: Callback Hell.
这也使得识别应用程序的流程更加困难,这是调试的主要障碍,也是这个问题的著名名称“回调地狱”的由来。
326. Can you tell me what are the latest trends in Full Stack Development? Also, how do you keep yourself updated about the new trends in the industry?
你能告诉我全栈开发的最新趋势是什么吗?此外,你如何让自己了解行业中的新趋势?
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd1a | 官方: 否 | 付费: 否
答案:
Each business needs emerging technology to thrive, whether it is mobile or web application development. This is why they hire front-end developers, back-end developers , or full-stack developers depending on their technology needs. According to industry experts, candidates who are passionate about full-stack development should be aware of these trends: - The rise in frameworks and libraries like ReacJs and VueJs, progressive apps, real-time web apps, and mobile web development.
每个企业都需要新兴技术来蓬勃发展,无论是移动应用还是Web应用程序开发。这就是为什么他们根据技术需求雇佣前端开发者、后端开发者或全栈开发者。根据行业专家的说法,对全栈开发充满热情的候选人应该了解这些趋势:- 框架和库(如ReactJS和VueJS)、渐进式应用、实时Web应用以及移动Web开发的兴起。
- Enhancements to JavaScript are beneficial to programming
The emergence of a more compatible extension.
The interviewer may ask you how you keep updated with new trends in the industry. You can explain how you gain your knowledge and understanding by learning from friends, colleagues, or online. That's an appropriate way of answering the question. This is a good time to show off any personal projects you have undertaken that apply your skills. Also, you might mention the webinars or forums that you attend regularly.
面试官可能会问你如何了解行业中的新趋势。你可以解释你如何通过与朋友、同事或在线学习来获取知识和理解。这是回答问题的合适方式。这是一个很好的机会,展示你承担过的任何应用了你的技能的个人项目。此外,你可能提到你定期参加的在线研讨会或论坛。
327. State difference between GraphQL and REST (Representational State Transfer).
说明GraphQL和REST(表述性状态转移)之间的区别。
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd1d | 官方: 否 | 付费: 否
答案:
For decades, REST (Representational State Transfer) has been a popular architectural way to design APIs (Application Programming Interfaces), but the popularity of GraphQL over the past few years threatens to topple REST. In general, REST and GraphQL both aim to transfer data over internet protocols including HTTP. How they do so differs greatly, however.
几十年来,REST(表述性状态转移)一直是设计API(应用程序编程接口)的一种流行架构方式,但过去几年GraphQL的流行对REST的地位构成了威胁。一般而言,REST和GraphQL都旨在通过包括HTTP在内的互联网协议传输数据。然而,它们实现方式差异很大。
| GraphQL | REST |
|---|
It is a Query Language for APIs that enables declarative data fetching to provide clients control over which data to retrieve from the API. 它是一种API查询语言,支持声明式数据获取,使客户端能够控制从API检索哪些数据。 | It is an API design architectural style that defines a set of constraints to create web services. 它是一种API设计架构风格,定义了一组约束来创建Web服务。 |
GraphQL is known for its high predictability. With this, you can send requests to your API and get the exact results you are looking for without having to include anything you don't need. GraphQL queries give predictable results, which improves their usability significantly. GraphQL以其高度的可预测性而闻名。使用它,你可以向API发送请求,获得你正在寻找的确切结果,无需包含任何不需要的内容。GraphQL查询提供可预测的结果,显著提高了其可用性。 | On the other hand, REST's behaviour depends on the HTTP and URI methods used. API consumers can therefore be unsure of what to expect when calling an endpoint. 另一方面,REST的行为取决于所使用的HTTP和URI方法。因此,API消费者在调用端点时可能不确定期望什么。 |
API security can be ensured by GraphQL, though the security features aren't as mature as those of REST. GraphQL, for instance, assists in integrating data validation, but users are left to figure out how to apply authentication and authorization measures. GraphQL可以确保API安全,尽管安全功能不如REST成熟。例如,GraphQL有助于集成数据验证,但用户需要自行考虑如何应用身份验证和授权措施。 | API security can be enforced in several ways using REST. You can implement multiple methods of API authentication, such as HTTP authentication, to ensure REST API security. 使用REST可以通过多种方式强制实施API安全。你可以实现多种API身份验证方法,如HTTP认证,以确保REST API安全。 |
With GraphQL, you can retrieve everything you need through a single API request. You can specify the structure of the information you need, and the server will return the same structure to you, so there is no need to over-and under-fetch. 使用GraphQL,你可以通过单个API请求检索所需的一切。你可以指定所需信息的结构,服务器将返回相同的结构,从而无需过度或不足获取。 | Consequently, since REST APIs have rigid data structures that return the specified data whenever they are accessed, you may end up with unwanted data or have to make multiple requests before getting the right data. As a result, the server's response time (to return information) can be prolonged due to these shortcomings. 因此,由于REST API具有刚性数据结构,每次访问时都会返回指定的数据,你可能最终获得不需要的数据,或者必须发出多次请求才能获得正确的数据。结果,由于这些缺点,服务器的响应时间(返回信息)可能会延长。 |
It only supports JSON format. 它只支持JSON格式。 | XML, YAML, JSON, HTML, and other formats are supported, as well. 还支持XML、YAML、JSON、HTML及其他格式。 |
The main use cases of GraphQL are mobile applications and multiple microservices. GraphQL的主要用例是移动应用和多个微服务。 | Rest is mainly used for simple applications and resource-driven applications. REST主要用于简单应用和资源驱动型应用。 |
328. What is CI (Continuous Integration)?
什么是CI(持续集成)?
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd20 | 官方: 否 | 付费: 否
答案:
CI (Continuous Integration), as its name implies, is the process of automating and integrating code changes into a single software project, often several times a day. The purpose of this DevOps practice is to enable developers to merge their code changes into a central repository where automated tests and builds can run. Automated tools are used to assert the new code’s correctness before integration. A source code version control system is the crux of the CI process. The version control system is also supplemented with other checks like automated code quality tests, syntax style review tools, and more.
CI(持续集成),顾名思义,是将代码更改自动化并集成到一个软件项目中的过程,通常一天多次。此DevOps实践的目的是让开发者能够将代码更改合并到中央存储库中,在那里可以运行自动化测试和构建。在集成前,使用自动化工具来验证新代码的正确性。源代码版本控制系统是CI过程的核心。版本控制系统还辅以其他检查,如自动化代码质量测试、语法风格审查工具等。
Advantages: - Integrating regularly has the main benefit of detecting errors quickly and more easily. Since most changes introduced are small, pinpointing the specific change that caused a defect is easy.
优点:- 定期集成的主要好处是快速且更容易地检测错误。由于大多数引入的更改都很小,因此可以轻松定位导致缺陷的具体更改。
- As a result of the smaller code changes and easier fault isolations, CI reduces MTTR (Mean Time to Resolution).
- When CI is incorporated into your organization's development process, you are less likely to have noncritical defects on your backlog. Before production, these small defects are detected and fixed before they are released to the public.
329. To develop a project from scratch, what technologies and languages would you need or what skills a full stack developer should have?
要从零开始开发一个项目,你需要哪些技术和语言,或者全栈开发者应该具备哪些技能?
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd23 | 官方: 否 | 付费: 否
答案:
A full-stack developer must be familiar with the following: - Programming Languages: Full-stack developers should be competent in more than one programming language, such as Java, Python, PHP, Ruby, C++, etc.
全栈开发者必须熟悉以下内容:- 编程语言:全栈开发者应熟练使用一种以上编程语言,如Java、Python、PHP、Ruby、C++等。
- Front End technologies: You should be familiar with front-end technologies such as HTML5, CSS3, JavaScript, etc. Knowledge of third-party libraries such as jQuery, Ajax, Angular, ReactJS, etc., is also important.
- Frameworks: This requires proficiency in a variety of development frameworks, including Spring, Spring Boot, Django, MyBatis, PHP, Hibernate, and others.
- Databases and caches: As a full stack developer, you should also know about various DBMS (Database Management Systems) technologies like MySQL, SQLite, Oracle, and MongoDB. It is helpful to have a basic understanding of caching mechanisms like redis, memcached, varnish.
- Design Ability: Having a good understanding of design is also important if you wish to become a successful Full-Stack web developer. Moreover, the person should be aware of the principles of prototyping and UX/UI design.
- Server: Experience with Apache or NGINX would be beneficial. Good knowledge of Linux helps enormously when administering servers.
330. Explain the benefits and drawbacks of using "use strict".
解释使用“use strict”的优缺点。
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd26 | 官方: 否 | 付费: 否
答案:
In ECMAScript5, a new feature known as strict mode allows you to run a program or function within a strict operating context. Certain actions, therefore, cannot be taken due to this strict context, and more exceptions are thrown. When the "use strict" statement is used, the browser is instructed to use "strict" mode, which is a more restricted and safer JavaScript feature set. You can specify "use strict" at the top of a function to evaluate the JS in strict mode. In strict mode, more errors are thrown and some features are disabled to make your code more robust, clear, and accurate.
在ECMAScript5中,一个名为严格模式的新特性允许你在严格的操作上下文中运行程序或函数。因此,由于这种严格上下文,某些操作无法执行,并且会抛出更多异常。当使用“use strict”语句时,浏览器被指示使用“严格”模式,这是一个更受限且更安全的JavaScript功能集。你可以在函数顶部指定“use strict”以在严格模式下评估JS。在严格模式下,会抛出更多错误并禁用某些功能,以使你的代码更健壮、清晰和准确。
Advantages: - Errors are thrown when some common coding mistakes are detected.
优点:- 当检测到常见编码错误时,会抛出错误。
331. What are some of the uses of Docker?
Docker有哪些用途?
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd29 | 官方: 否 | 付费: 否
答案:
One of the thorniest problems in software development is dealing with the different environments across different machines and platforms. Using Docker, you can isolate your applications from your infrastructure, which is crucial to delivering software quickly. Developers can package and run their applications into containers, executable components that have all the OS (Operating System) libraries and dependencies needed to run the application in any environment. It does not matter what is installed on the host—containers are lightweight and include everything needed to run applications. - The code has to pass through many different environments as it travels from the developer's machine to production. Consequently, each of these environments may be slightly different. Using Docker streamlines code development and deployment, as it provides a consistent environment from development to production.
软件开发中最棘手的问题之一是处理不同机器和平台上的不同环境。使用Docker,你可以将应用程序与基础设施隔离,这对于快速交付软件至关重要。开发者可以将应用程序打包并运行到容器中,这些容器是可执行组件,包含在任何环境中运行应用程序所需的所有操作系统(OS)库和依赖项。主机上安装了什么并不重要——容器是轻量级的,并且包含运行应用程序所需的一切。- 代码从开发者的机器到生产环境必须经过许多不同的环境。因此,这些环境中的每一个可能略有不同。使用Docker简化了代码开发和部署,因为它从开发到生产提供了一致的环境。
- Docker's primary purpose is to simplify configuration. With VM (Virtual Machine), you can run any platform with its configuration on top of your infrastructure. Docker offers the same functionality without the overhead of virtual machines.
332. Explain event loop in Node.js.
解释Node.js中的事件循环。
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd2c | 官方: 否 | 付费: 否
答案:
The event loop in JavaScript enables asynchronous programming. With JS, every operation takes place on a single thread, but through smart data structures, we can create the illusion of multi-threading. With the Event Loop, any async work is handled by a queue and listener. Consider the diagram below:
JavaScript中的事件循环实现了异步编程。使用JS,每个操作都在单线程上进行,但通过智能数据结构,我们可以创造多线程的假象。通过事件循环,任何异步工作都由队列和监听器处理。考虑下面的图示:
Therefore, when an async function (or an I/O) needs to be executed, the main thread relays it to another thread, allowing v8 (Javascript engine) to continue processing or running its code. In the event loop, there are different phases, like pending callbacks, closing callbacks, timers, idle or preparing, polling, and checking, with different FIFO (First-In-First-Out) queues.
因此,当需要执行异步函数(或I/O)时,主线程将其转交给另一个线程,使v8(JavaScript引擎)能够继续处理或运行其代码。在事件循环中,有不同的阶段,如待处理回调、关闭回调、定时器、空闲或准备、轮询和检查,具有不同的FIFO(先进先出)队列。
333. Is there a way to decrease the load time of a web application?
有没有办法减少Web应用程序的加载时间?
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd2f | 官方: 否 | 付费: 否
答案:
Here are some ways to reduce load times for web applications: - Image Optimization: The file size of an image can be dramatically reduced by switching to a different file format. For example, GIFs work well for images with few colors, such as logos, JPEG is ideal for images with lots of colors and details, such as photographs, and PNG format is ideal for transparent images with high quality.
以下是一些减少Web应用程序加载时间的方法:- 图像优化:通过切换到不同的文件格式,可以大幅减小图像的文件大小。例如,GIF适用于颜色较少的图像,如徽标,JPEG是颜色和细节丰富的图像(如照片)的理想选择,而PNG格式则适合高质量透明图像。
- Keep JavaScript and CSS in external files: Embedding JavaScript and CSS in HTML documents forces them to be downloaded every time the HTML document is loaded. In this case, browser caching is not utilized, and the HTML document becomes larger. This is why you should always place CSS and JavaScript in external files; it is a best practice and simplifies maintenance.
- Reducing redirects: Too many redirects will delay the loading time of a website. HTTP requests and responses are delayed each time a page redirects. Getting rid of unnecessary redirects on your site will reduce the load time of your site significantly.
- Load CSS and JavaScript files asynchronously: Your website contains CSS and JavaScript files that can be loaded either synchronously or asynchronously. As part of synchronous loading, each file is loaded sequentially, in the order it appears on your site. As opposed to synchronous loading, asynchronous loading allows multiple files to be loaded simultaneously, boosting the performance of a website.
- Minify HTML, CSS, and JavaScript: If you optimize the way your files load, your pages will load more quickly. You can do the same when it comes to HTML, CSS, and JavaScript code. By eliminating unnecessary spaces, characters, and comments, you can reduce the size of your files. This will make your web pages load faster.
334. Explain dependency injection.
解释依赖注入。
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd32 | 官方: 否 | 付费: 否
答案:
The Dependency Injection (DI) pattern is a design pattern for implementing the Inversion of Control (IoC). Dependent objects can be created outside of classes and made available to classes in different ways. Three types of classes are involved in Dependency Injection as follows:
依赖注入(DI)模式是一种用于实现控制反转(IoC)的设计模式。依赖对象可以在类外部创建,并通过不同方式提供给类。依赖注入涉及三类类,如下所示:
- Client Class: A client class (dependent class) is one that depends on the service class.
- Service Class: Service (dependency) classes provide services to client classes.
- Injector Class: This class injects the objects from the service class into the client class.
335. What do you mean by observer pattern?
你所说的观察者模式是什么意思?
- 知识点: 前端 / 后端 / 算法与数据结构 (主题: fullstack, web-development;标签: interviewbit, full-stack-developer, topic-specific, fullstack, web-development)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37afa58d557c902babd35 | 官方: 否 | 付费: 否
答案:
If several objects are tied together in one-to-many relationships, the observer pattern is used. Every time one object is modified, then all of its dependent objects are automatically notified and updated. It falls under the behavioural pattern category. It describes the coupling between the objects and the observer and provides support for broadcast-type communication. The object that observes the state of another object is known as the observer, and the object that is being observed is known as the subject as shown below:
如果多个对象通过一对多关系捆绑在一起,就会使用观察者模式。每当一个对象被修改时,其所有依赖对象都会自动收到通知并更新。它属于行为型模式的范畴。它描述了对象与观察者之间的耦合关系,并支持广播式通信。观察另一个对象状态的对象被称为观察者,而被观察的对象被称为主题,如下所示:
336. What do you mean by DOM (Data Object Model)?
你说的 DOM(数据对象模型)是什么意思?
- 知识点: 前端 (标签: interviewbit, intuit, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Intuit
- id: 69b37b6b58d557c902bb02d3 | 官方: 否 | 付费: 否
答案:
Document Object Model, or DOM represents the API (application programming interface) for your web documents (HTML or XML documents). Every time an update is made to the application, the DOM receives an update as well, making it possible for the user to view or visualize the changes. This feature enables you to dynamically access and modifies the structure, content, and style of a document.
文档对象模型(DOM)代表你的 Web 文档(HTML 或 XML 文档)的 API(应用程序编程接口)。每次对应用程序进行更新时,DOM 也会收到更新,使用户能够查看或可视化这些更改。此功能使你能够动态访问和修改文档的结构、内容和样式。
337. How is real DOM different from virtual DOM?
真实 DOM 与虚拟 DOM 有何不同?
- 知识点: 前端 (标签: interviewbit, intuit, company-specific)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: general
- 公司: Intuit
- id: 69b37b6b58d557c902bb02d6 | 官方: 否 | 付费: 否
答案:
Every DOM object has a corresponding "virtual DOM object." Virtual DOM objects are lightweight copies of DOM objects, which can be updated without affecting the real DOM. Virtual DOM objects share the same properties as real DOM objects, but they do not possess the power to affect what appears on the screen as the real DOM does.
每个 DOM 对象都有一个对应的“虚拟 DOM 对象”。虚拟 DOM 对象是 DOM 对象的轻量级副本,可以在不影响真实 DOM 的情况下更新。虚拟 DOM 对象与真实 DOM 对象共享相同的属性,但它们不具备像真实 DOM 那样影响屏幕上显示内容的能力。
Generally, manipulating the real DOM is slower than manipulating the virtual DOM, since nothing gets drawn onscreen. Manipulation of the virtual DOM is akin to editing a blueprint instead of moving rooms within a real house. As soon as the Virtual DOM contains all the updates, it is compared with the real DOM, and the difference between the two is calculated.
通常,操作真实 DOM 比操作虚拟 DOM 慢,因为不会在屏幕上绘制任何内容。操作虚拟 DOM 类似于编辑蓝图,而不是在真实房屋中移动房间。一旦虚拟 DOM 包含所有更新,就会将其与真实 DOM 进行比较,并计算两者之间的差异。
Upon calculating the difference, the real DOM only updates those elements that have changed. The process is known as reconciliation.
在计算差异时,真实DOM仅更新那些已更改的元素。这一过程称为协调。
338. How can you test your Ionic applications?
你如何测试你的 Ionic 应用程序?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6b58d557c902bb0322 | 官方: 否 | 付费: 否
答案:
AngularJS is used to create Ionic v1 applications. Jasmine and the Karma test runner are two of the many test libraries and frameworks available with Angular. Unit tests for Ionic applications may be written using these frameworks. Ionic applications can be tested in four different ways: on a desktop WebKit browser, in an iOS or Android emulator, in a mobile browser on your phone, or as a native application on your phone. Ionic-CLI also has a live reload capability that allows you to test your application in the browser. The ionic serve command, for example, can be used to load the application in any browser. To debug and investigate Ionic applications, we can utilise Chrome Developer Tools or Mozilla Firefox with Firebug.
AngularJS 用于创建 Ionic v1 应用程序。Jasmine 和 Karma 测试运行器是 Angular 可用的众多测试库和框架中的两个。可以使用这些框架编写 Ionic 应用程序的单元测试。Ionic 应用程序可以通过四种不同方式进行测试:在桌面 WebKit 浏览器中、在 iOS 或 Android 模拟器中、在手机的移动浏览器中,或作为手机上的原生应用程序。Ionic-CLI 还具有实时重新加载功能,允许你在浏览器中测试应用程序。例如,可以使用 ionic serve 命令在任何浏览器中加载应用程序。要调试和调查 Ionic 应用程序,我们可以使用 Chrome 开发者工具或带有 Firebug 的 Mozilla Firefox。
339. List the features of the Ionic Framework.
列出 Ionic 框架的特性。
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6b58d557c902bb0325 | 官方: 否 | 付费: 否
答案:
The following are the features of the Ionic framework: - Cross-platform: The Ionic framework allows the application to be deployed across many platforms, including Android, native iOS, desktop, and the web as a dynamic web app, all from a single codebase. As a result, Ionic applications can be written once and run anywhere.
以下是 Ionic 框架的特性: - 跨平台:Ionic 框架允许应用程序部署到多个平台,包括 Android、原生 iOS、桌面以及作为动态 Web 应用的网页,所有这些都来自单一代码库。因此,Ionic 应用程序可以一次编写,随处运行。
- Based on Web Standards: The ionic framework is designed utilising contemporary web APIs and is based on trustworthy, standard web technologies such as HTML, CSS, and JavaScript (like Custom Elements and Shadow DOM). As a result, Ionic components have a consistent API, allowing Ionic applications to function on different platforms.
- Helps in Creating Beautiful Design: We can create a clean, straightforward, and useful application using the Ionic framework. Pre-designed components, typography, engaging paradigms, and a beautiful basic theme are all included in the Ionic application.
- Cordova Plugin: It provides the API for calling native device functions from JavaScript code.
- License: Ionic Framework is a free and open-source project published under the MIT licence. It means we can use it for free in both personal and business endeavours.
- Ionic CLI: The Ionic CLI, or Command Line Interface, is a resource that enables Ionic developers with a number of useful commands. It's a command that allows you to start, develop, execute, and emulate Ionic applications.
- Framework Compatibility: Ionic's previous editions were intimately linked to Angular. However, the most recent version of Ionic, v4, has been re-engineered to serve as a standalone web component library with support for the most recent JavaScript frameworks. It's also compatible with most front-end frameworks.
- JavaScript Components: It adds JavaScript functionality to CSS components to cover all mobile aspects that can't be done with HTML and CSS alone.
- Angular: Angular is responsible for the greatness of the Ionic framework. While the main components can be used independently, the angular package simplifies integration with the Angular ecosystem. The angular package includes all of the features that Angular developers would anticipate, as well as integration with the core libraries of Angular.
340. What are the new features included in Ionic 4?
Ionic 4 中包含了哪些新特性?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6b58d557c902bb0329 | 官方: 否 | 付费: 否
答案:
Ionic Framework V4 focuses heavily on speed, compatibility, and general extensibility. The following are the new features in Ionic 4. - Web Components: One of the most significant changes in Ionic V4 is that each component is now a web component. A group of web platform APIs is known as web components. It enables developers to construct customised and reusable HTML tags for usage in web pages and web applications. Custom elements, HTML imports, HTML Templates, and Shadow DOM are the four key requirements.
Ionic 框架 V4 非常注重速度、兼容性和通用可扩展性。以下是 Ionic 4 中的新特性。 - Web 组件:Ionic V4 中最显著的变化之一是每个组件现在都是 Web 组件。一组 Web 平台 API 被称为 Web 组件。它使开发人员能够构建自定义且可重用的 HTML 标签,用于网页和 Web 应用程序中。自定义元素、HTML 导入、HTML 模板和 Shadow DOM 是四项关键要求。
- Capacitor: It's a cross-platform API with a code execution layer that makes calling Native SDKs from web applications simple. It also creates any custom Native plugins your application may require. It also allows the developer to create a single application and distribute it across application marketplaces and mobile websites.
- Stencil: The ionic team has produced a new web component compiler to create standards that are compatible with web servers. It also makes use of extra APIs that are best suited for PWAs, such as TypeScript, Virtual DOM, JSX, and async.
- Ion-Backdrop: They're full-screen components that overlay other components. They are used to dismiss the other component and are placed on top of the other component.
- Ion-Picker: On the top of the application content and at the bottom of the viewport, it shows a row of buttons and columns.
- Ion-Ripple Effect: The ripple effect is a component that adds the ink ripple interaction effect from Material Design. It's designed to be fast, non-intrusive, and easy to use without adding any more DOM to the elements. For CSS-Only implementation, it works without degrading JavaScript.
- Ion-Searchbar: This component consists of a text field that is used to search a collection. In version 4, the Ionic team has implemented nine alternative search bar designs.
- Color changes: The Ionic framework's default colour has been modified, and several new default colours have been introduced.
- CSS Variables: These are the Ionic framework's highlighting features. Without utilising the build tools, it will change the entire appearance and feel of the programme by making minor changes to a few variables.
- Lazy Loading: It is a design approach used in the Ionic framework to delay component initialization until it is required. By breaking the application into numerous bundles and loading it on demand, it improves performance and reduces application load time.
341. What are the advantages and the disadvantages of Ionic Framework?
Ionic 框架的优点和缺点是什么?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb032c | 官方: 否 | 付费: 否
答案:
The Advantages of using an Ionic framework are: - Simple to learn: Learning and producing applications utilising the Ionic framework is simple if the developer has a basic understanding of CSS, HTML, or JavaScript frameworks. It also permits development firms to convert to Ionic if their demands and requirements necessitate hybrid application development.
使用 Ionic 框架的优点如下: - 易于学习:如果开发人员对 CSS、HTML 或 JavaScript 框架有基本了解,那么使用 Ionic 框架学习和生成应用程序很简单。它还允许开发公司在其需求和条件要求混合应用程序开发时转向使用 Ionic。
- Documentation is simple: Ionic has excellent and well-organized documentation. The official documentation included the majority of what developers needed to know.
- Cross-platform: The ionic application may run on a variety of platforms, including native iOS, Android, desktop, and the web, all from a single codebase. These applications are written once and run anywhere.
- Ionic's user interface: It includes themes and components, and is highly customisable. The ionic platform enables its components to adjust to the platform on which they are running.
Built using AngularJS: The Ionic framework makes use of AngularJS, which gives developers a lot of options. AngularJS is the most popular framework among designers worldwide. Ionic can give a solid structure using AngularJS, making the code more comprehensible.
The Disadvantages of using an Ionic framework are: - Performance: When compared to native mobile applications, the Ionic application performs poorly. However, most average users will not notice the performance difference.
使用 Ionic 框架的缺点如下: - 性能:与原生移动应用程序相比,Ionic 应用程序的表现较差。然而,大多数普通用户不会注意到性能差异。
- Security: An application built using the Ionic framework may not offer the same level of security as a native app. The Ionic framework, for example, is not suggested for designing a financial app, such as a bank app.
- Limited native functionality: The Ionic framework may or may not support some native functionalities. In this scenario, you'll have to create your own plugin to perform that function. However, there are numerous plugins that cover the majority of the native features.
- Not suitable for graphic-intensive applications: The Ionic framework is not suitable for applications or games that involve complex graphics.
- Expertise is required: JavaScript can be difficult to learn. As a result, someone who will not only "handle" JS but also has a thorough understanding of advanced libraries and technologies such as Angular, Cordova, Ionic, and others is required.
- The risk of being an early adopter: Ionic technology is still in evolution. Its support and standards are constantly changing, and its libraries can be fully redesigned at any point.
342. What are native, hybrid and mobile web applications?
什么是原生、混合和移动 Web 应用程序?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb032f | 官方: 否 | 付费: 否
答案:
- Native applications: Applications for specific devices, such as smartphones and tablets, are known as native applications. It can be downloaded via an application store (such as Google Play or Apple's application Store) and installed straight on the device. They are available at all times on the smartphone and can be accessed via icons on the home screen. These applications can work offline and utilise the device's notification system. Camera, Collage-Maker, Google Maps, Facebook, and other well-known native applications are just a few examples.
- Mobile web applications: These are internet-enabled applications with features tailored to mobile devices. Web browsers on mobile devices are used to access mobile web applications. They do not require downloading or installation on the device.
- Hybrid applications: These are the ones that incorporate features from both native and online applications. It can be installed on a device in the same way that any other application can. They are written with web technologies such as HTML, CSS, and JavaScript, and are similar to native applications. They're popular because they enable developers to write only one piece of code for a mobile application and publish it across various platforms.
- Data Science
- All Events
- My Events
343. What are the differences between Phonegap and Ionic?
Phonegap 和 Ionic 之间有什么区别?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb0332 | 官方: 否 | 付费: 否
答案:
The following points illustrate the differences between Ionic and PhoneGap: - Ionic is an open-source front-end framework for creating AngularJS-based cross-platform mobile apps. It enables the developer to create a hybrid application using HTML, CSS, JavaScript, and SaaS. On the other hand, Adobe Systems created the PhoneGap framework. Anyone with a basic understanding of CSS, HTML, and JScript can use it to create mobile applications. PhoneGap is a fork of Apache Cordova that adds new functionalities to the existing Cordova framework.
以下几点说明了 Ionic 和 PhoneGap 之间的区别: - Ionic 是一个开源前端框架,用于创建基于 AngularJS 的跨平台移动应用程序。它使开发人员能够使用 HTML、CSS、JavaScript 和 SaaS 创建混合应用程序。另一方面,PhoneGap 框架由 Adobe Systems 创建。任何对 CSS、HTML 和 JScript 有基本了解的人都可以使用它来创建移动应用程序。PhoneGap 是 Apache Cordova 的一个分支,为现有 Cordova 框架添加了新功能。
- PhoneGap does not have a lot of community support. To use all functions, you'll need to purchase a licence. Ionic has received a lot of positive feedback from the community. All of the apps are completely free to use.
- Ionic improves the look and feel of mobile applications. Phonegap is a web-based user interface that does not provide a better look and feel for mobile apps.
344. What is the Ionic CLI? How would you create a new project using CLI?
什么是 Ionic CLI?你将如何使用 CLI 创建新项目?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb0335 | 官方: 否 | 付费: 否
答案:
The official Ionic CLI, or Command-Line-Interface, is a vital instrument for Ionic application development. - It combines a variety of tools into a single user interface.
官方 Ionic CLI(即命令行界面)是 Ionic 应用程序开发的重要工具。 - 它将多种工具整合到一个用户界面中。
- Start, build, serve, and run are just a few of the essential commands for Ionic development. It also has commands such as emulate and info, that can be useful under certain circumstances.
- It's also in charge of cloud builds and deployment, as well as managing your Ionic Pro account.
To use Ionic CLI to create a new ionic project , type:
要使用 Ionic CLI 创建新的 Ionic 项目,请键入:
ionic start , for example, new task blank. This will start a new project with a blank canvas. Instead of using blank as a beginning template, you can use tabs, side menus, and other options.
运行 ionic start,例如,新任务空白模板。这将启动一个带有空白画布的新项目。除了使用空白作为起始模板,你还可以使用标签页、侧边菜单等其他选项。
345. How do you use services/providers in Ionic?
如何在 Ionic 中使用服务/提供者?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb0338 | 官方: 否 | 付费: 否
答案:
Services are vital in the Ionic framework since they offer information to our application and help us with various tasks. Some of the services implemented in the ionic framework include ConnectivityMonitor, SimpleAlert, data, GoogleMaps, and others. When building service, there are a few ideas to keep in mind. The most crucial thing is to import a service, add a provider to it, and inject it. The services must be imported into the classes that will utilise them. When injected into a constructor, it creates a new member variable that can be accessed from anywhere in the class. There are two ways to add a provider to a service; It can either be introduced to a single component or added to the entire application when bootstrapping the root component.
服务在 Ionic 框架中至关重要,因为它们为我们的应用提供信息并帮助我们完成各种任务。Ionic 框架中实现的一些服务包括 ConnectivityMonitor、SimpleAlert、data、GoogleMaps 等。构建服务时,需要记住几点想法。最关键的是导入服务、向其添加提供者并注入它。服务必须导入到将要使用它们的类中。当注入到构造函数中时,它会创建一个新的成员变量,可以从类中的任何位置访问。向服务添加提供者有两种方式;它可以被引入到单个组件中,或者在引导根组件时添加到整个应用中。
346. How can one use observables in Ionic?
如何在 Ionic 中使用可观察对象?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb033b | 官方: 否 | 付费: 否
答案:
The RxJS library exports a class called Observable. The RxJS library provides observables, which aren't specific to Ionic or Angular and are given by the RxJS library. Promises are comparable to observables, but observables can do a lot more. Rather than resolving a single value, it can deal with several values at once. You may even subscribe to an observable in order to change the data it contains. Observables are "lazy" in the sense that they will not be executed unless and until they are subscribed to. Observables can be modified and a new one returned using a variety of procedures. Even better, you can make your own observable. With the help of a subject, the observable patterns are integrated into one, which is preferable for straightforward implementation.
RxJS 库导出一个名为 Observable 的类。RxJS 库提供可观察对象,这些对象并非 Ionic 或 Angular 特有,而是由 RxJS 库提供的。Promise 与可观察对象类似,但可观察对象能做更多事情。它不是解析单个值,而是可以同时处理多个值。你甚至可以订阅一个可观察对象以更改其包含的数据。可观察对象是“惰性”的,除非被订阅,否则不会执行。可以使用多种过程修改可观察对象并返回新的可观察对象。更好的是,你可以创建自己的可观察对象。借助 subject,可观察模式被整合到一个中,这对于简单实现更为可取。
347. Describe the project structure of an Ionic 4 application.
描述 Ionic 4 应用的项目结构。
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb033e | 官方: 否 | 付费: 否
答案:
The structure of an Ionic 4 application is identical to that of an Angular application. The root directory will contain the e2e, node modules, and src folders, as well as individual files such as angular.json, ionic.config.json, package-lock.json, package.json, tsconfig.json, and tslint.json. The e2e/ folder contains files for running end to end integration tests, while node modules contain all dependencies. The majority of the application code you'll be building is in the src/app/ subdirectory. App.module.ts, app.component.ts, app.component.html, app.component.spec.ts, and app-routing.module.ts are the main files in the application folder. Any developed services, components, or pages can be saved in their own directories. Images and other static content can be stored in the assets/ subdirectory.
Ionic 4 应用的结构与 Angular 应用相同。根目录将包含 e2e、node_modules 和 src 文件夹,以及诸如 angular.json、ionic.config.json、package-lock.json、package.json、tsconfig.json 和 tslint.json 等单独文件。e2e/ 文件夹包含用于运行端到端集成测试的文件,而 node_modules 包含所有依赖项。你将要构建的大部分应用代码位于 src/app/ 子目录中。App.module.ts、app.component.ts、app.component.html、app.component.spec.ts 和 app-routing.module.ts 是应用文件夹中的主要文件。任何开发的服务、组件或页面可以保存在其自己的目录中。图片和其他静态内容可以存储在 assets/ 子目录中。
Angular.json contains all of the angular settings, such as the project name, application folder root path, source root, paths for index file, main.ts, polyfills, assets folder path, css stylesheet paths, script paths, build settings, and so on. During development, ionic.config.json can be used to set proxy settings for APIs to avoid CORS problems. package.json provides a list of dependencies as well as the commands serve, build, test, and e2e.
Angular.json 包含所有 Angular 设置,如项目名称、应用文件夹根路径、源代码根目录、index 文件路径、main.ts、polyfills、assets 文件夹路径、CSS 样式表路径、脚本路径、构建设置等。在开发期间,可以使用 ionic.config.json 为 API 设置代理设置以避免 CORS 问题。package.json 提供了依赖项列表以及 serve、build、test 和 e2e 命令。
348. Discuss Lazy Loading in detail.
详细讨论懒加载。
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb0341 | 官方: 否 | 付费: 否
答案:
The concept underlying lazy loading is that we only load the HTML, CSS, and JavaScript that our application requires to render its first route, and then load other components as needed. The good news is that a new Ionic Angular 4.0 app comes pre-configured with lazy loading.
懒加载的概念是我们只加载应用渲染其第一条路由所需的 HTML、CSS 和 JavaScript,然后按需加载其他组件。好消息是,一个新的 Ionic Angular 4.0 应用预配置了懒加载。
Lazy loading is a method in which we load things only when we need them. The fundamental idea behind such a notion is that when the application is opened, we don't need to load every page in it. The @IonicPage decorator was advised in previous versions of the Ionic framework to sleepy load your pages, but in the latest version of Ionic (Ionic 4), we lazy load our Angular components using Angular routing. Each Ionic component is a web component, and these components will only be loaded lazily when they are used in the Ionic application.
懒加载是一种我们只在需要时加载事物的方法。这种概念的基本思想是,当应用打开时,我们不需要加载其中的每个页面。在 Ionic 框架的先前版本中,建议使用 @IonicPage 装饰器来懒加载页面,但在 Ionic 的最新版本(Ionic 4)中,我们使用 Angular 路由来懒加载 Angular 组件。每个 Ionic 组件都是 Web 组件,这些组件只有在 Ionic 应用中使用时才会被懒加载。
// Javascript
// JavaScript
const routes_: Routes = [
const routes_: Routes = [
{
path: '',
path: '',
loadChildren: './tabs/tabs.module#tabs_page_module'
loadChildren: './tabs/tabs.module#tabs_page_module'
}
];
When you use the tabs starter template to create a new Ionic app, this is the first route that is created for you. The Angular router will dynamically load this file when the user navigates to the route if you specify a loadChildren string instead of passing a page class to component. This JavaScript is also separated from the rest of the app and placed in its own bundle.
当你使用 tabs 起始模板创建新的 Ionic 应用时,这是为你创建的第一条路由。如果你指定一个 loadChildren 字符串而不是将页面类传递给 component,Angular 路由器将在用户导航到该路由时动态加载此文件。此 JavaScript 也与应用的其他部分分离,并放在其自己的包中。
The routes in the tabs routing module are set up as follows:
选项卡路由模块中的路由设置如下:
// Javascript
// JavaScript
const routes_: Routes = [
const routes_: Routes = [
{
path: 'tabs',
path: 'tabs',
component: TabsPage,
component: TabsPage,
children: [
children: [
{
path: 'tab1',
path: 'tab1',
children: [
children: [
{
path: '',
path: '',
loadChildren: '../tab1/tab1.module#tab1_page_module'
loadChildren: '../tab1/tab1.module#tab1_page_module'
}
]
},
// tab2, tab3, tab4...
// tab2, tab3, tab4...
}
]
Each tab in this configuration loads its children slowly, thus all of tab2's files aren't loaded until the user clicks on the tab2 page.
此配置中的每个选项卡都会延迟加载其子模块,因此直到用户点击选项卡2页面时,选项卡2的所有文件才会被加载。
We can avoid the browser having to download, process, and compile our entire programme before the user interacts with the first page by dividing it up into smaller lazily loaded pieces. If our app was large, this would significantly increase the program's first load time.
通过将整个程序拆分为较小的惰性加载块,我们可以避免浏览器在用户与第一页交互之前下载、处理和编译整个程序。如果我们的应用很大,这将显著增加程序的首次加载时间。
Optimizing Lazy Loading:
优化惰性加载:
You can provide a pre-loading strategy when importing the Router module into the main app module. There are two that come with Angular out of the box: - NoPreloading: No preloading of lazily loaded modules is done. If no strategy is specified, this is the default behaviour.
在主应用模块中导入路由器模块时,您可以提供预加载策略。Angular 开箱提供了两种策略:- NoPreloading:不预加载惰性加载的模块。如果未指定策略,这是默认行为。
- PreloadAllModules: When the network becomes idle, this technique will preload all of the remaining modules once your app loads the initial module. This option is automatically established for you in the Ionic beginning templates.
349. How will you add a custom color to the existing list of colors in Ionic?
您将如何向 Ionic 的现有颜色列表中添加自定义颜色?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb0344 | 官方: 否 | 付费: 否
答案:
Every Ionic project comes with a set of pre-installed colours. This is how those colours are programmed: - Navigate to the project/src/theme/variables.scss folder in your Ionic project.
每个 Ionic 项目都附带一组预装的颜色。这些颜色的编程方式如下:- 导航到 Ionic 项目中的 project/src/theme/variables.scss 文件夹。
- There will be a variable named $colours here that will hold the names of the various colours as well as their hexadecimal colour codes.
- Color codes for default colours can be changed, and new colour names and hexadecimal codes can be added.
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
350. What is the best approach to incorporate navigation into an Ionic 4 app?
在 Ionic 4 应用中融入导航的最佳方法是什么?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb0347 | 官方: 否 | 付费: 否
答案:
Ionic 4 is based on Angular and leverages RouterModule, an Angular router module, for navigation. It gives the entire application a more consistent routing experience. The NavController service was used for navigation in prior versions of Ionic, and it is still available, although it will be deprecated shortly. As a result, in new Ionic applications built with Ionic 4, it will not be encouraged.
Ionic 4 基于 Angular,并利用 RouterModule(Angular 路由器模块)进行导航。它为整个应用提供了更一致的路由体验。在早期版本的 Ionic 中,NavController 服务用于导航,并且仍然可用,但很快将被弃用。因此,在使用 Ionic 4 构建的新 Ionic 应用中,将不鼓励使用它。
The ion-router-outlet component is used in the current version of Ionic to control the animations that appear as the user moves to or from a component inside the app. The ion-router-outlet is similar to the Angular router-outlet, but with the addition of an animation effect.
在当前版本的 Ionic 中,ion-router-outlet 组件用于控制用户移入或移出应用内组件时出现的动画。ion-router-outlet 类似于 Angular 的 router-outlet,但增加了动画效果。
351. What exactly is WebView?
WebView 到底是什么?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb034a | 官方: 否 | 付费: 否
答案:
We already know that Ionic applications use web technologies like HTML, CSS, and JavaScript. Web Views, which are full-screen and high-powered web browsers, are used to render these web technologies.
我们已经知道 Ionic 应用使用 HTML、CSS 和 JavaScript 等网络技术。Web View(一种全屏且功能强大的网络浏览器)用于渲染这些网络技术。
Numerous built-in HTML5 APIs for hardware capabilities are available in the current web view, including a camera, Bluetooth, GPS, sensors, and speakers. It may also require access to platform-specific APIs on occasion. The hardware APIs can be accessed through a bridge layer in the Ionic framework, which is commonly done by employing native plugins that expose JavaScript APIs.
当前网络视图中提供了许多用于硬件功能的内置 HTML5 API,包括摄像头、蓝牙、GPS、传感器和扬声器。它有时也可能需要访问特定于平台的 API。硬件 API 可以通过 Ionic 框架中的桥接层访问,这通常通过采用暴露 JavaScript API 的原生插件来实现。
A full explanation of webview architecture may be seen in the graphic below.
下方图形中可以查看 webview 架构的完整说明。
In the above image, we can see how ionic applications differ from native applications. There are two additional layers of Bridge and a Web-View in the case of ionic applications.
在上述图像中,我们可以看到 ionic 应用与原生应用的区别。在 ionic 应用的情况下,多了两个额外层:桥接层和 Web-View。
352. What is an ?
什么是 ?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb034d | 官方: 否 | 付费: 否
答案:
The element serves as a container for the whole Ionic app. The Ionic project should only contain one element and several Ionic components like headers, footers, menus, content, and so on. When shown, all of these components are wrapped inside the component.
该元素作为整个 Ionic 应用的容器。Ionic 项目应仅包含一个此类元素以及多个 Ionic 组件,如标题、页脚、菜单、内容等。显示时,所有这些组件都包裹在该组件内部。
For example:
例如:
//code
//代码
//code
//代码
353. Explain an ion-grid component.
解释 ion-grid 组件。
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb0350 | 官方: 否 | 付费: 否
答案:
The Ionic grid system is indeed a mobile-based flexbox system that can be used to create a custom layout. The Ionic grid is made up of three primary components: a grid, rows, and columns. The Ionic grid consists of a 12-column layout with several breakpoints depending on screen size.
Ionic 网格系统确实是一个基于移动端的 flexbox 系统,可用于创建自定义布局。Ionic 网格由三个主要组件组成:网格、行和列。Ionic 网格采用 12 列布局,并根据屏幕尺寸设置多个断点。
The following key points are to be remembered while dealing with an Ionic Grid: - Grids are used to hold rows and columns together. It occupies the entire width of its container, however, the fixed attribute specifies the width per screen size.
使用 Ionic 网格时需要记住以下关键点:- 网格用于将行和列组合在一起。它占据其容器的整个宽度,但 fixed 属性会根据屏幕尺寸指定宽度。
- Only columns should be immediate children of rows, as rows are horizontal groups of columns. Columns are where we put our contents, and only columns should be immediate children of rows.
- Out of the default 12 columns per row, the size attributes specify the number of columns to use. As a result, size="4" can be appended to a column to fill up 1/3 of the grid.
- If no size value is specified for a column, it will be automatically divided into equal widths.
- Individual columns have padding properties, although the padding can be eliminated from the grid and columns by setting no-padding on the grid.
354. Give some examples of ionic components and a short description of each.
给出一些 ionic 组件的示例,并简要描述每个组件。
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb0353 | 官方: 否 | 付费: 否
答案:
The following are some of the most essential ionic components: - Ion-Alert: An alert is a dialogue that provides the user with vital information to help them make a decision or allows them to select a specific action or set of actions. It is shown over the app's content. Before resuming contact with the app, the user can remove it explicitly.
以下是一些最关键的 ionic 组件:- Ion-Alert:警报是一种对话框,为用户提供重要信息以帮助他们做出决策或允许他们选择特定操作或一组操作。它显示在应用内容之上。在恢复与应用交互之前,用户可以显式移除它。
- Ion-Buttons: Using buttons to interact with and navigate around an application is vital. Its purpose is to make it apparent what will happen when the user clicks on them. Text, icons, or a combination of the two can be found on the buttons. To make it look a certain way, it can be upgraded with a range of features such as colour, form, and size.
- Ion-Content: The Ionic content element acts as a container for all of the additional elements we wish to add to the app. The content component provides a simple content area with a few handy methods for controlling the scrollable area. A single view in an Ionic application should only have one content component. Individual styling with CSS and the appropriate CSS custom properties can also be used to alter it.
- Ion-List: Lists consist of numerous rows of objects such as text, buttons, toggles, icons, thumbnails, and more. The list element is used to display data such as menus and tabs, as well as to break up the monotony of plain text files. Swiping things, dragging to reorder items inside the list, and removing items are all supported interactions.
- Ion-Input: This component is used to collect and securely handle user input. It functions similarly to an HTML input element. It only supports text inputs like text, passwords, numbers, emails, and URLs. It should be enclosed in the ion-item element at all times.
355. Differentiate between ‘ionic build’ and ‘ionic prepare’.
区分“ionic build”和“ionic prepare”。
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb0356 | 官方: 否 | 付费: 否
答案:
ionic prepare moves all files from the www folder to the www folder on the target platform. This is likewise done by ionic build , but it also produces the app's source code so that it can be executed on a simulator/emulator or a device.
ionic prepare 将所有文件从 www 文件夹移动到目标平台上的 www 文件夹。ionic build 也会执行此操作,但它还会生成应用的源代码,以便在模拟器/仿真器或设备上运行。
356. Explain what the config.xml file in an Ionic project is for.
解释 Ionic 项目中 config.xml 文件的用途。
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb0359 | 官方: 否 | 付费: 否
答案:
Config.xml is a global configuration file for Ionic applications that control the build settings. Many parts of a Cordova application's behaviors are controlled by it. A basic config.xml file is created for you in the top-level directory when you build the Ionic application. The W3C Package Web applications (widget) specification is followed in this file. It enables developers to quickly set metadata for their applications. It includes details about the project, like the package name, version, author information, plugins, platform, and so on.
Config.xml 是 Ionic 应用的全局配置文件,用于控制构建设置。Cordova 应用的许多行为都受其控制。当您构建 Ionic 应用时,会在顶层目录中自动生成一个基本的 config.xml 文件。此文件遵循 W3C 包 Web 应用(widget)规范。它使开发者能够快速为应用设置元数据。它包含有关项目的详细信息,如包名、版本、作者信息、插件、平台等。
A Sample Config.xml file:
一个示例 config.xml 文件:
<?xml version='1.0' encoding='utf-8'?>
<?xml version='1.0' encoding='utf-8'?>
HelloCordova
HelloCordova
A sample Apache Cordova application that responds to the deviceready event.
一个响应 deviceready 事件的示例 Apache Cordova 应用。
Apache Cordova Team
Apache Cordova 团队
357. Is it possible to use Firebase with Ionic?
是否可以在Ionic中使用Firebase?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb035c | 官方: 否 | 付费: 否
答案:
Yes, Firebase is compatible with Ionic. It is one of the most powerful and widely used database-as-a-service solutions on the market today. The Firebase SDK can also be used as a node module. It can be installed, imported, and used within your project.
是的,Firebase与Ionic兼容。它是当今市场上最强大且广泛使用的数据库即服务解决方案之一。Firebase SDK也可以作为Node模块使用。它可以在你的项目中安装、导入和使用。
358. How would you acquire a list of all the available Ionic application start-up templates?
你如何获取所有可用的Ionic应用程序启动模板列表?
- 知识点: 前端 / 行为与软技能 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: behavioral | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb035f | 官方: 否 | 付费: 否
答案:
Using the following command, we can see a list of all available templates that can be used when creating a new Ionic application: ionic start --list .
使用以下命令,我们可以查看创建新的Ionic应用程序时可用的所有模板列表:ionic start --list .
359. In the Ionic framework, how many different types of storage are there?
在Ionic框架中,有多少种不同类型的存储?
- 知识点: 前端 (主题: ionic, mobile;标签: interviewbit, ionic, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb0362 | 官方: 否 | 付费: 否
答案:
Ionic supports both internal and external storage of data: - Internal Storage (SQLite) - If your app requires a strong database or you already have data to inject into your Ionic app, there's a wonderful underlying SQLite database within that you can utilise to store your data just like any other storage engine.
Ionic支持内部和外部数据存储: - 内部存储(SQLite) - 如果你的应用需要强大的数据库,或者你已有数据要注入到Ionic应用中,那么其中有一个出色的底层SQLite数据库,你可以像使用任何其他存储引擎一样利用它来存储数据。
- External Storage (MySql, IndexedDB, WebSql, PouchDB, MongoDB) - You can even use different storage systems like MySql, MongoDB and so on. They have remote databases and you connect to them and retrieve and write data to their databases.
- Session, Cookie - Cookies help in ensuring that the site works properly and efficiently when you visit it. Session cookies are temporary cookies that expire once you close the website and are not saved after your visit; they are generally not regarded to be intrusive of your privacy.
360. Write the difference between assign and retain keywords.
写出assign和retain关键字之间的区别。
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb03ba | 官方: 否 | 付费: 否
答案:
- Assign: With Assign, a reference is created from one object to another without increasing the source's retain count (a number that keeps track of how many objects are “holding onto" another object). It does not copy or retain the value but assigns it directly to the instance variable.
Example:
示例:
if (object != object)
if (object != object)
{
[object release];
[object release];
object = nil;
object = nil;
object = object;
object = object;
}
Here, Assign will generate a setter that assigns the value to the instance variable directly, rather than copying or retaining it. - Retain: Using this method, you create a reference from one object to another and increase the retain count of the source object.
在这里,Assign 会生成一个 setter,直接将值赋给实例变量,而不是复制或保留它。- Retain:使用此方法,您可以从一个对象创建对另一个对象的引用,并增加源对象的保留计数。
Example:
示例:
if (object != object)
if (object != object)
{
[object release];
[object release];
object = nil;
object = nil;
object = [object retain];
object = [object retain];
}
A retain message prevents an object from being deallocated until you are done using it.
保留消息可防止对象在您使用完之前被释放。
361. What do you mean by the SpriteKit and SceneKit framework in the context of game development?
在游戏开发中,你所说的 SpriteKit 和 SceneKit 框架是什么意思?
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb03be | 官方: 否 | 付费: 否
答案:
SpriteKit: This framework is designed to make it easier and faster for game developers to create animated 2D assets/objects in casual games. With it, you can draw shapes, particles, text, images, and videos in two dimensions.
SpriteKit:此框架旨在让游戏开发者更轻松、更快速地创建休闲游戏中的动画 2D 素材/对象。通过它,您可以绘制二维图形、粒子、文本、图像和视频。
SceneKit: It is an iOS framework inherited from OS X, which helps to create 3D graphics. With SceneKit, you can build 3D animated scenes and effects for your iOS games and apps.
SceneKit:这是一个从 OS X 继承而来的 iOS 框架,有助于创建 3D 图形。借助 SceneKit,您可以为您的 iOS 游戏和应用构建 3D 动画场景和效果。
362. State the difference between App ID and Bundle ID?
陈述 App ID 和 Bundle ID 之间的区别?
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb03c7 | 官方: 否 | 付费: 否
答案:
Bundle ID: They are the unique identifiers of applications in Apple's ecosystem. In other words, no two applications can have the same identifier. The bundling ID is used for both OS X and iOS apps and can be used to recognize app updates.
Example:If our organization’s domain is scaler.com and we create an app named Edge, you could assign the string com.scaler.edge as our app’s bundle ID.
示例:如果我们组织的域是 scaler.com,并且我们创建一个名为 Edge 的应用,您可以将字符串 com.scaler.edge 指定为我们应用的 Bundle ID。
App ID: This string uniquely identifies one or more apps from the same development team. There are two components to the string, the Team ID and the Bundle ID, separated by a period (.). Apple supplies a Team ID to identify a specific development team, whereas developers supply Bundle IDs to identify a single app or a collection of apps.
Example:ABCDE12345.com.scaler.edgeIn the above example, ABCDE12345 is the Team ID and com.scaler.edge is the Bundle ID.
示例:ABCDE12345.com.scaler.edge 在上述示例中,ABCDE12345 是团队 ID,而 com.scaler.edge 是 Bundle ID。
363. Write different ways to achieve concurrency in iOS?
写出在 iOS 中实现并发的不同方式?
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb03ca | 官方: 否 | 付费: 否
答案:
Concurrency means "running multiple tasks simultaneously". Concurrency allows iOS devices to handle background tasks (such as downloading or processing data) while maintaining a responsive user interface. In iOS, you can manage concurrent tasks using Grand Central Dispatch (or GCD), and Operations (formally known as NSOperation). In order to achieve concurrency, iOS provides three ways as follows: - Dispatch queues: They are used to manage tasks in first-in-first-out (FIFO) order and execute tasks sequentially or concurrently. This is an easy way to handle asynchronous (not occurring at the same time) and concurrent tasks in your application.
并发意味着“同时运行多个任务”。并发允许 iOS 设备处理后台任务(例如下载或处理数据),同时保持响应式的用户界面。在 iOS 中,您可以使用 Grand Central Dispatch(或 GCD)和 Operations(正式称为 NSOperation)来管理并发任务。为了实现并发,iOS 提供了以下三种方式:- 调度队列:它们用于按先进先出(FIFO)顺序管理任务,并顺序或并发执行任务。这是在您的应用程序中处理异步(不同时发生)和并发任务的简单方法。
- Threads: An independent sequence of instructions can be executed separately from other code within a program. Through threads, one can execute multiple code paths simultaneously in a single application. Having a thread is especially useful when you need to perform a lengthy task without affecting the execution of the rest of the program.
- Operation Queues: Operation queue objects are invoked in accordance with their priority and readiness. Essentially, operation queues are high-level abstractions of queueing models, built on top of GCD (Grand Central Dispatch). It is possible, therefore, to execute tasks concurrently, just like GCD, but in an object-oriented manner.
364. What is the framework that is utilized to build an application's interface for iOS?
用于构建 iOS 应用界面的框架是什么?
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb03cd | 官方: 否 | 付费: 否
答案:
Contrary to the Foundation framework that defines classes, protocols, and functions for both iOS and OS X development, UIKit is specifically designed for iOS development. In iOS, the user interface and graphical infrastructure of the application are developed using UIKit. It includes: - Event handling (handle different gestures like input gestures, button-tap gestures, multi-touch gestures, etc.)
与定义 iOS 和 OS X 开发类、协议和函数的 Foundation 框架不同,UIKit 是专门为 iOS 开发设计的。在 iOS 中,应用的用户界面和图形基础设施是使用 UIKit 开发的。它包括:- 事件处理(处理不同的手势,如输入手势、按钮点击手势、多点触控手势等。)
- App structure (Manages the interaction between the system and user)
- User Interface (Provides user interactions, the ability to share text and content, select images, edit videos, print files, etc.)
- Graphic, Drawing, and Printing
365. Which programming languages are used for iOS development?
iOS 开发使用哪些编程语言?
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37b6c58d557c902bb03d0 | 官方: 否 | 付费: 否
答案:
iOS development is done using the following programming languages: - HTML5
iOS 开发使用以下编程语言进行:- HTML5
- .NET
- C
- C++
- Swift
- Javascript
- Objective-C.
366. State the difference between Cocoa and Cocoa Touch.
请说明 Cocoa 和 Cocoa Touch 之间的区别。
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6c58d557c902bb03d3 | 官方: 否 | 付费: 否
答案:
Cocoa and Cocoa Touch are two of Apple's widely used application frameworks used for building applications. However, they differ in the following ways:
Cocoa 和 Cocoa Touch 是 Apple 广泛使用的两个应用程序框架,用于构建应用程序。然而,它们有以下不同之处:
| Cocoa | Cocoa Touch |
|---|
It is an application framework for building applications that run on Mac OS X. 它是一个用于构建在 Mac OS X 上运行的应用程序的框架。 | It is the application framework for building applications that run on devices like iPhones and iPad. 它是用于构建在 iPhone 和 iPad 等设备上运行的应用程序的框架。 |
Frameworks such as Foundation and AppKit are incorporated into Cocoa. 诸如 Foundation 和 AppKit 等框架被纳入 Cocoa 中。 | Cocoa Touch is a combination of Frameworks such as Foundation and UIKit are incorporated into Cocoa Touch. Cocoa Touch 是 Foundation 和 UIKit 等框架的组合,被纳入 Cocoa Touch 中。 |
Cocoa classes use the NS (used for all classes and constants in the cocoa framework) prefix (like NSTextField, NSWindow). Cocoa 类使用 NS(用于 cocoa 框架中的所有类和常量)前缀(如 NSTextField、NSWindow)。 | Cocoa Touch classes, on the other hand, use the UI (used for all classes and constants in the cocoa touch framework) prefix (like UITextField and UIWindow). 另一方面,Cocoa Touch 类使用 UI(用于 cocoa touch 框架中的所有类和常量)前缀(如 UITextField 和 UIWindow)。 |
367. What is ARC (Automatic Reference Counting)?
什么是 ARC(自动引用计数)?
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb03d6 | 官方: 否 | 付费: 否
答案:
In the Swift programming language, automatic reference counting (ARC) is used to manage apps' memory usage. It initializes and deinitializes system resources, thereby releasing memory reserved by a class instance when it no longer needs it. ARC keeps track of how many properties, constants, and variables currently refer to each class instance. When there is at least one active reference to an instance, ARC will not deallocate that instance. The use of ARC concepts is an essential part of iOS development.
在 Swift 编程语言中,自动引用计数(ARC)用于管理应用程序的内存使用。它初始化和反初始化系统资源,从而在类实例不再需要时释放其保留的内存。ARC 跟踪当前有多少属性、常量和变量引用每个类实例。当实例至少有一个活动引用时,ARC 不会释放该实例。使用 ARC 概念是 iOS 开发的重要组成部分。
Functions of ARC - - ARC creates a new class instance using init() and allocates a chunk of memory to store the information.
ARC 的功能 - - ARC 使用 init() 创建一个新的类实例,并分配一块内存来存储信息。
- Memory stores information about the instance type and its values.
- As soon as the class instance is no longer required, ARC automatically frees memory by calling deinit().
- By tracking current referring classes' properties, constants, and variables, ARC ensures that deinit() is only applied to those instances that are unused.
368. Explain what is GCD (Grand Central Dispatch) in iOS.
请解释在 iOS 中什么是 GCD(Grand Central Dispatch)。
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb03d9 | 官方: 否 | 付费: 否
答案:
Grand Central Dispatch (GCD) is a low-level API that enables users to run concurrent tasks (occurring simultaneously) by managing threads in the background. Grand Central Dispatch is Apple's solution to build concurrency and parallelism into iOS applications, so multiple background tasks can be run concurrently in the background without affecting the main thread. It was introduced in iOS 4 to avoid the tedious process of serial execution of tasks.
Grand Central Dispatch(GCD)是一个低级 API,使用户能够通过管理后台线程来运行并发任务(同时发生)。GCD 是 Apple 用于在 iOS 应用程序中构建并发性和并行性的解决方案,因此多个后台任务可以同时运行而不会影响主线程。它是在 iOS 4 中引入的,以避免串行执行任务的繁琐过程。
369. What do you mean by deep linking in iOS?
在 iOS 中,深度链接是什么意思?
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb03dc | 官方: 否 | 付费: 否
答案:
Deep links are links that send users directly to an app directly instead of a website or store using URI (Uniform resource locator) or universal links. The URL scheme is a well-known method of having deep links, but Universal Links are Apple's new approach to connecting your web page and your app under the same link. Deep linking involves not only creating a clickable link that opens up your app, but also a smart one that navigates to the resource you desire. Users are directed straight to in-app locations using these links, which saves them the time and effort of finding those pages themselves thus improving their user experience tremendously.
深度链接是将用户直接引导到应用程序而不是网站或商店的链接,使用 URI(统一资源定位符)或通用链接。URL 方案是众所周知的深度链接方法,但通用链接是 Apple 将网页和应用程序连接到同一链接的新方法。深度链接不仅涉及创建打开应用程序的可点击链接,还涉及一个智能链接,用于导航到您所需的资源。用户通过这些链接直接转到应用内位置,这节省了他们自行查找这些页面的时间和精力,从而极大地改善了用户体验。
Explanation: If you use the URL fb://, you may open the Facebook app. However, if you use fb://profile/33138223345, you will open Wikipedia's profile in the Facebook app.
解释:如果您使用 URL fb://,可以打开 Facebook 应用程序。但是,如果您使用 fb://profile/33138223345,将在 Facebook 应用程序中打开 Wikipedia 的个人资料。
370. State the difference between Android and iOS.
请说明 Android 和 iOS 之间的区别。
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb03df | 官方: 否 | 付费: 否
答案:
Android: It is the mobile operating system for Android devices offered by Google LLC (limited liability company) and is focused on touchscreen mobile devices like smartphones and tablets. Several programming languages were used in its development, including C, Java, C++, and others.
Android:它是 Google LLC(有限责任公司)为 Android 设备提供的移动操作系统,专注于触摸屏移动设备,如智能手机和平板电脑。其开发中使用了多种编程语言,包括 C、Java、C++ 等。
iOS: It is the operating system for Apple devices offered by Apple incorporation and it is considered the second most popular mobile operating system globally after Android. It is primarily designed for Apple mobile devices like the iPhone, iPod Touch, etc. Several programming languages were used in its development, including Objective-C, Swift, C++, and others.
iOS:它是 Apple Incorporation 为 Apple 设备提供的操作系统,被视为全球仅次于 Android 的第二大流行移动操作系统。它主要为 Apple 移动设备(如 iPhone、iPod Touch 等)设计。其开发中使用了多种编程语言,包括 Objective-C、Swift、C++ 等。
Difference between iOS and Android -
iOS 与 Android 之间的区别 -
| Android | iOS |
|---|
It is the mobile operating system for Android devices offered by Google LLC (limited liability company). 它是谷歌有限责任公司(有限责任公司)为 Android 设备提供的移动操作系统。 | It is the operating system for Apple devices offered by Apple incorporation. 它是苹果公司为苹果设备提供的操作系统。 |
It is specially designed for smartphones, tablets. 它专为智能手机、平板电脑设计。 | It is specially designed for Apple iPhones, iPods, and iPads. 它专为苹果 iPhone、iPod 和 iPad 设计。 |
It is mainly written in C, C++, Java and other languages. 它主要用 C、C++、Java 和其他语言编写。 | It is mainly written in C, C++, Objective-C, Swift, and other languages. 它主要用 C、C++、Objective-C、Swift 和其他语言编写。 |
On Android devices, Google Chrome is the default internet browser. However, any other browser can be installed. 在 Android 设备上,Google Chrome 是默认的互联网浏览器。然而,可以安装任何其他浏览器。 | Safari is the default Internet browser on iOS devices. However, any other browser can be installed. Safari 是 iOS 设备上的默认互联网浏览器。然而,可以安装任何其他浏览器。 |
The Android software is available for many manufacturers including Samsung, LG, etc., which could cause some quality issues in cheaper phones. Android 软件可供包括三星、LG 等在内的许多制造商使用,这可能会在较便宜的手机中导致一些质量问题。 | Apple has strict quality control over iOS and there are no quality problems. 苹果对 iOS 有严格的质量控制,不存在质量问题。 |
Contrary to this, the performance of Android devices may deteriorate over time. 与此相反,Android 设备的性能可能会随时间推移而下降。 | iOS devices run at a consistent speed over time. iOS 设备随时间推移以一致的速度运行。 |
In contrast, Android devices have open-source code, meaning that owners can alter their phones and tablets operating systems at their discretion. If owners tinker (change/modify) with their devices too much, they could weaken their devices' security. 相比之下,Android 设备具有开源代码,这意味着所有者可以自行修改其手机和平板电脑的操作系统。如果所有者过度修改设备,可能会削弱设备的安全性。 | iOS is a closed system. The source code of Apple's apps isn't available for developers, and iPhone and iPad owners can't modify the code on their devices. This makes iOS-powered devices harder to hack. iOS 是一个封闭系统。苹果应用的源代码不对开发者开放,iPhone 和 iPad 所有者无法修改其设备上的代码。这使得基于 iOS 的设备更难被黑客攻击。 |
371. What is an iOS developer and what are his responsibilities?
什么是 iOS 开发者,他的职责有哪些?
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb03e2 | 官方: 否 | 付费: 否
答案:
An iOS developer is a programmer or software engineer who designs and develops applications that run Apple's iOS on iOS devices. Ideally, the iOS developer should be skilled in two programming languages i.e., Objective-C and Swift.
iOS 开发者是设计并开发在 iOS 设备上运行 Apple iOS 应用程序的程序员或软件工程师。理想情况下,iOS 开发者应熟练掌握两种编程语言,即 Objective-C 和 Swift。
Main Responsibilities of an iOS Developer - Clean, efficient coding for iOS applications.
iOS 开发者的主要职责 - 为 iOS 应用程序进行干净、高效的编码。
- Ensure clean and secure codes by performing troubleshooting and bug fixes for applications.
- The development and deployment of advanced app features as well as the maintenance and improvement of existing features.
- Develop innovative solutions to meet the business needs of customers.
- Assisting with all aspects of application development, including design, testing, release, and support.
- Exploring, evaluating, and implementing new technologies continuously to maximize development efficiency.
372. What are different types of iOS Application States?
iOS 应用程序状态有哪些不同类型?
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb03e5 | 官方: 否 | 付费: 否
答案:
During the course of its execution, an iOS application goes through a series of states. Each of these states is referred to as an application's lifecycle state. Below are the five possible states for an iOS app:
在执行过程中,iOS 应用程序会经历一系列状态。每种状态被称为应用程序的生命周期状态。以下是 iOS 应用程序的五个可能状态:
- Not running: In the Not Running state, an application has either not been launched or has been closed/shut down by the system.
- Inactive: A brief state of inactivity occurs while the app is leaving or entering its active state. Despite running in the foreground, it isn't yet ready to accept user input or events. This means that the application remains inactive at this time.
- Active: The Active state indicates that the app is running in the foreground and receiving events. This is usually the normal mode for foreground apps and the User Interface is accessible.
- Background: During this state, the application's user interface is hidden, but it continues to run in the background of the iOS system. Applications usually pass through this state prior to being suspended.
- Suspended: In this case, the application is in the background but is not running code. However, it stays in my memory. Under low memory conditions, the system can delete apps in the suspended state without warning.
373. Can you explain the difference between atomic and nonatomic properties? What is the default for synthesized properties?
你能解释原子和非原子属性之间的区别吗?合成属性的默认值是什么?
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb03e8 | 官方: 否 | 付费: 否
答案:
Atomic Property: It is the default property and ensures a valid value will be returned from the getter or set by the setter. This ensures that only one thread can access the getter/setter of a given property at a time and that all other threads must wait until the first thread releases the getter/setter. Despite being thread-safe, it is not fast, since it ensures that the process is completely completed.
原子属性:它是默认属性,确保从 getter 返回或由 setter 设置的有效值。这确保在给定时间内只有一个线程可以访问给定属性的 getter/setter,所有其他线程必须等待,直到第一个线程释放 getter/setter。尽管线程安全,但速度不快,因为它确保进程完全完成。
Non-Atomic Property: With non-atomic properties, multiple threads can access the getter/setter method of a given property at the same time, so the potential for inconsistency between values exists. They come with enhanced access, but no guarantee of the return value.
非原子属性:使用非原子属性时,多个线程可以同时访问给定属性的 getter/setter 方法,因此存在值之间不一致的可能性。它们提供了增强的访问,但不保证返回值。
374. What do you mean by property in iOS?
在 iOS 中,属性是什么意思?
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b6d58d557c902bb03eb | 官方: 否 | 付费: 否
答案:
Properties are basically values that are associated with a class, struct, or enum. They can be thought of as "sub-variables," i.e., parts of another object.
属性基本上是与类、结构体或枚举相关联的值。它们可以被视为“子变量”,即另一个对象的一部分。
Example:
示例:
struct Icecream
结构体 Icecream
{
var flavor: String = ""
变量 flavor: String = ""
}
var choco = Icecream()
变量 choco = Icecream()
choco.flavor = "Chocolate Icecream"
choco.flavor = "巧克力冰淇淋"
In the above code, we created a structure called Icecream. One of its properties is called flavor, a String whose initial value is empty.
在上述代码中,我们创建了一个名为Icecream的结构体。其属性之一称为flavor,它是一个初始值为空的String。
Classification of Properties - Stored Properties: This type of property can be used to store constant or variable values as instances and is usually provided by classes and structures.
属性分类 - 存储属性:这种类型的属性可用于存储常量或变量值作为实例的一部分,通常由类和结构体提供。
Example:
示例:
class Programmer {
class Programmer {
var progName: String
var progName: String
let progLanguage: String
let progLanguage: String
var totalExperience = 0
var totalExperience = 0
var secondLanguage: String?
var secondLanguage: String?
}
Above, the Programmer class defines four stored properties: progName, progLanguage, totalExperience, and secondLanguage. These are all stored properties since they can contain values that are part of the instance of the class. The above example shows properties with and without default values, as well as an optional one. - Computed properties: These properties can be used to calculate values instead of storing them and are usually provided by classes, enumerations, and structures.
上面,Programmer类定义了四个存储属性:progName、progLanguage、totalExperience和secondLanguage。这些都是存储属性,因为它们可以包含作为类实例一部分的值。上述例子展示了带有和不带默认值的属性,以及一个可选属性。- 计算属性:这些属性可用于计算值而不是存储值,通常由类、枚举和结构体提供。
Example:
示例:
struct Angle {
struct Angle {
var degrees: Double = 0
var degrees: Double = 0
var rads: Double {
var rads: Double {
get {
get {
return degrees * .pi / 180
return degrees * .pi / 180
}
set(newRads) {
set(newRads) {
degrees = newRads * 180 / .pi
degrees = newRads * 180 / .pi
}
}
}
As mentioned above, the angle structure has a stored property called degrees for storing angles in degrees. Moreover, angles can also be expressed in radians, so the Angle structure contains a Rads property, which is a computed property.
如上所述,角度结构体有一个名为degrees的存储属性,用于以度为单位存储角度。此外,角度也可以用弧度表示,因此Angle结构体包含一个rads属性,这是一个计算属性。
375. Explain the Architecture of iOS.
解释 iOS 的架构。
- 知识点: 前端 (主题: ios, mobile;标签: interviewbit, ios, topic-specific, mobile)
- 类型: technical | 难度: easy | 子类型: system-design
- 分类: fullstack
- id: 69b37b6d58d557c902bb03ee | 官方: 否 | 付费: 否
答案:
iOS operates in a Layered structure. iOS Architecture is comprised of four layers, each of which offers a programming framework for creating applications that operate on top of the hardware. Communication will be enhanced by the layers between the Application Layer and the Hardware Layer. A lower-level layer provides the services that all applications require, while an upper-level layer (or high-level layer) provides graphics and interface-related services.
iOS 以分层结构运行。iOS 架构由四层组成,每一层都提供了一个编程框架,用于创建在硬件之上运行的应用程序。应用层和硬件层之间的层将增强通信。较低层提供所有应用程序所需的服务,而较高层(或高层)提供图形和界面相关的服务。
- Core OS ( or Application) Layer: Core OS Layer sits directly on top of the device hardware and is the bottom layer of the iPhone OS stack. In addition to basic operating system services, such as memory management, handling of file systems, and threads, this layer provides low-level networking, access to external accessories, etc.
- Service Layer: Its purpose is to design the services that upper layers or users demand. Among its other essential features are block objects, Grand Central Dispatch, in-app purchases, and iCloud storage. The service layer has been strengthened by the addition of ARC Automatic Reference Counting.
- Media Layer: It handles media like video, audio, graphics, etc. The media layer will allow us to use all graphics, video, and audio technology of the system.
- Cocoa Touch Layer: It is also known as the application layer. This is the place where frameworks are created when applications are built. In addition, it functions as the interface for iOS users to work with the operating system. This includes touch and motion capabilities.
376. What are the different data types present in javascript?
JavaScript 中存在哪些不同的数据类型?
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7658d557c902bb0cc1 | 官方: 否 | 付费: 否
答案:
To know the type of a JavaScript variable, we can use the typeof operator.
要了解 JavaScript 变量的类型,我们可以使用 typeof 运算符。
String - It represents a series of characters and is written with quotes. A string can be represented using a single or a double quote.
字符串 - 它表示一系列字符,并用引号书写。字符串可以使用单引号或双引号表示。
Example :
示例:
var str = "Vivek Singh Bisht"; //using double quotes
var str = "Vivek Singh Bisht"; //使用双引号
var str2 = 'John Doe'; //using single quotes
var str2 = 'John Doe'; //使用单引号
- Number - It represents a number and can be written with or without decimals.
Example :
示例:
var x = 3; //without decimal
var x = 3; //不带小数
var y = 3.6; //with decimal
var y = 3.6; //带小数
- BigInt - This data type is used to store numbers which are above the limitation of the Number data type. It can store large integers and is represented by adding “n” to an integer literal.
Example :
示例:
var bigInteger = 234567890123456789012345678901234567890;
var bigInteger = 234567890123456789012345678901234567890;
- Boolean - It represents a logical entity and can have only two values : true or false. Booleans are generally used for conditional testing.
Example :
示例:
var a = 2;
var a = 2;
var b = 3;
var b = 3;
var c = 2;
var c = 2;
(a == b) // returns false
(a == b) // 返回 false
(a == c) //returns true
(a == c) // 返回 true
- Undefined - When a variable is declared but not assigned, it has the value of undefined and it’s type is also undefined.
Example :
示例:
var x; // value of x is undefined
var x; // x 的值是未定义(undefined)
var y = undefined; // we can also set the value of a variable as undefined
var y = undefined; // 我们也可以将变量的值设置为 undefined
- Null - It represents a non-existent or a invalid value.
Example :
示例:
var z = null;
var z = null;
- Symbol - It is a new data type introduced in the ES6 version of javascript. It is used to store an anonymous and unique value.
Example :
示例:
var symbol1 = Symbol('symbol');
var symbol1 = Symbol('symbol');
- typeof of primitive types :
typeof "John Doe" // Returns "string"
typeof "John Doe" // 返回 "string"
typeof 3.14 // Returns "number"
typeof 3.14 // 返回 "number"
typeof true // Returns "boolean"
typeof true // 返回 "boolean"
typeof 234567890123456789012345678901234567890n // Returns bigint
typeof 234567890123456789012345678901234567890n // 返回 bigint
typeof undefined // Returns "undefined"
typeof undefined // 返回 "undefined"
typeof null // Returns "object" (kind of a bug in JavaScript)
typeof null // 返回 "object"(这是 JavaScript 中的一个 bug)
typeof Symbol('symbol') // Returns Symbol
typeof Symbol('symbol') // 返回 Symbol
- Non-primitive types
- Primitive data types can store only a single value. To store multiple and complex values, non-primitive data types are used.
- Object - Used to store collection of data.
- Example:
// Collection of data in key-value pairs
// 以键值对形式存储的数据集合
var obj1 = {
var obj1 = {
x: 43,
x: 43,
y: "Hello world!",
y: "Hello world!",
z: function(){
z: function(){
return this.x;
return this.x;
}
}
// Collection of data as an ordered list
// 以有序列表形式存储的数据集合
var array1 = [5, "Hello", true, 4.1];
var array1 = [5, "Hello", true, 4.1];
Note- It is important to remember that any data type that is not a primitive data type, is of Object type in javascript.
注意- 请务必记住,任何非基本数据类型在 JavaScript 中都属于对象类型。
377. Explain Hoisting in javascript.
解释 JavaScript 中的变量提升(Hoisting)。
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7658d557c902bb0cc4 | 官方: 否 | 付费: 否
答案:
Hoisting is the default behaviour of javascript where all the variable and function declarations are moved on top.
变量提升是 JavaScript 的默认行为,它会将所有变量和函数声明移动到代码顶部。
This means that irrespective of where the variables and functions are declared, they are moved on top of the scope. The scope can be both local and global. Example 1:
这意味着无论变量和函数在哪里声明,它们都会被移动到作用域顶部。该作用域可以是局部的,也可以是全局的。示例 1:
hoistedVariable = 3;
hoistedVariable = 3;
console.log(hoistedVariable); // outputs 3 even when the variable is declared after it is initialized
console.log(hoistedVariable); // 即使变量在初始化后才声明,仍输出 3
var hoistedVariable;
var hoistedVariable;
Example 2:
示例2:
hoistedFunction(); // Outputs " Hello world! " even when the function is declared after calling
hoistedFunction(); // 即使在调用之后才声明函数,也会输出 " Hello world! "
function hoistedFunction(){
function hoistedFunction(){
console.log(" Hello world! ");
console.log(" Hello world! ");
}
Example 3:
示例3:
// Hoisting takes place in the local scope as well
// 提升在局部作用域中同样发生
function doSomething(){
function doSomething(){
x = 33;
x = 33;
console.log(x);
console.log(x);
var x;
var x;
}
doSomething(); // Outputs 33 since the local variable “x” is hoisted inside the local scope
doSomething(); // 输出 33,因为局部变量“x”在局部作用域内被提升了
Note - Variable initializations are not hoisted, only variable declarations are hoisted:
注意 - 变量初始化不会被提升,只有变量声明会被提升:
var x;
var x;
console.log(x); // Outputs "undefined" since the initialization of "x" is not hoisted
console.log(x); // 输出“undefined”,因为“x”的初始化没有被提升
x = 23;
x = 23;
Note - To avoid hoisting, you can run javascript in strict mode by using “use strict” on top of the code:
注意 - 为避免提升,可以在代码顶部使用“use strict”以严格模式运行 JavaScript:
"use strict";
"use strict";
x = 23; // Gives an error since 'x' is not declared
x = 23; // 由于未声明'x',会给出错误
var x;
var x;
378. Why do we use the word “debugger” in javascript?
为什么我们在JavaScript中使用“debugger”这个词?
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7658d557c902bb0cc7 | 官方: 否 | 付费: 否
答案:
The debugger for the browser must be activated in order to debug the code. Built-in debuggers may be switched on and off, requiring the user to report faults. The remaining section of the code should stop execution before moving on to the next line while debugging.
必须激活浏览器的调试器才能调试代码。内置调试器可以打开和关闭,要求用户报告故障。在调试时,代码的其余部分应在执行下一行之前停止执行。
379. Difference between “ == “ and “ === “ operators.
“ == “ 和 “ === “ 运算符之间的区别。
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7658d557c902bb0cca | 官方: 否 | 付费: 否
答案:
Both are comparison operators. The difference between both the operators is that “==” is used to compare values whereas, “ === “ is used to compare both values and types.
两者都是比较运算符。这两个运算符之间的区别在于,“==”用于比较值,而“ === “用于同时比较值和类型。
Example:
示例:
var x = 2;
var x = 2;
var y = "2";
var y = "2";
(x == y) // Returns true since the value of both x and y is the same
(x == y) // 返回true,因为x和y的值相同
(x === y) // Returns false since the typeof x is "number" and typeof y is "string"
(x === y) // 返回false,因为x的类型是“number”,而y的类型是“string”
380. Difference between var and let keyword in javascript.
JavaScript中var和let关键字之间的区别。
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7658d557c902bb0ccd | 官方: 否 | 付费: 否
答案:
Some differences are
一些区别是
From the very beginning, the 'var' keyword was used in JavaScript programming whereas the keyword 'let' was just added in 2015. 2. The keyword 'Var' has a function scope. Anywhere in the function, the variable specified using var is accessible but in ‘let’ the scope of a variable declared with the 'let' keyword is limited to the block in which it is declared. Let's start with a Block Scope. 3. In ECMAScript 2015, let and const are hoisted but not initialized. Referencing the variable in the block before the variable declaration results in a ReferenceError because the variable is in a "temporal dead zone" from the start of the block until the declaration is processed.
- 从一开始,‘var’关键字就用于JavaScript编程,而关键字‘let’是在2015年才添加的。 2. 关键字‘Var’具有函数作用域。在函数中的任何位置,使用var指定的变量都是可访问的,但在‘let’中,使用‘let’关键字声明的变量的作用域仅限于其声明所在的块。让我们从块作用域开始。 3. 在ECMAScript 2015中,let和const会被提升但不会初始化。在块内变量声明之前引用该变量会导致ReferenceError,因为该变量从块开始到声明被处理期间处于“暂时性死区”。
- Data Science
- All Events
- My Events
381. Explain Implicit Type Coercion in javascript.
解释javascript中的隐式类型强制转换。
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7658d557c902bb0cd0 | 官方: 否 | 付费: 否
答案:
Implicit type coercion in javascript is the automatic conversion of value from one data type to another. It takes place when the operands of an expression are of different data types. - String coercion
javascript中的隐式类型强制转换是将值从一种数据类型自动转换为另一种数据类型。当表达式的操作数属于不同数据类型时就会发生这种情况。- 字符串强制转换
String coercion takes place while using the ‘ + ‘ operator. When a number is added to a string, the number type is always converted to the string type.
在使用‘ + ‘运算符时会发生字符串强制转换。当一个数字被添加到字符串时,数字类型总是被转换为字符串类型。
Example 1:
示例1:
var x = 3;
var x = 3;
var y = "3";
var y = "3";
x + y // Returns "33"
x + y // 返回 "33"
Example 2:
示例2:
var x = 24;
var x = 24;
var y = "Hello";
var y = "Hello";
x + y // Returns "24Hello";
x + y // 返回 "24Hello";
Note - ‘ + ‘ operator when used to add two numbers, outputs a number. The same ‘ + ‘ operator when used to add two strings, outputs the concatenated string:
注意 - 当 '+' 运算符用于两个数字相加时,输出的是一个数字。当同一个 '+' 运算符用于两个字符串相加时,输出的是连接后的字符串:
var name = "Vivek";
var name = "Vivek";
var surname = " Bisht";
var surname = " Bisht";
name + surname // Returns "Vivek Bisht"
name + surname // 返回 "Vivek Bisht"
Let’s understand both the examples where we have added a number to a string,
让我们理解这两个将数字与字符串相加的例子,
When JavaScript sees that the operands of the expression x + y are of different types ( one being a number type and the other being a string type ), it converts the number type to the string type and then performs the operation. Since after conversion, both the variables are of string type, the ‘ + ‘ operator outputs the concatenated string “33” in the first example and “24Hello” in the second example.
当 JavaScript 看到表达式 x + y 的操作数类型不同(一个是数字类型,另一个是字符串类型)时,它会将数字类型转换为字符串类型,然后执行操作。由于转换后两个变量都是字符串类型,'+' 运算符在第一个例子中输出连接后的字符串 “33”,在第二个例子中输出 “24Hello”。
Note - Type coercion also takes place when using the ‘ - ‘ operator, but the difference while using ‘ - ‘ operator is that, a string is converted to a number and then subtraction takes place.
注意 - 使用 '-' 运算符时也会发生类型强制转换,但使用 '-' 运算符的区别是,字符串会被转换为数字,然后进行减法运算。
var x = 3;
var x = 3;
Var y = "3";
Var y = "3";
x - y //Returns 0 since the variable y (string type) is converted to a number type
x - y // 返回 0,因为变量 y(字符串类型)被转换为数字类型
Boolean coercion takes place when using logical operators, ternary operators, if statements, and loop checks. To understand boolean coercion in if statements and operators, we need to understand truthy and falsy values. Truthy values are those which will be converted (coerced) to true . Falsy values are those which will be converted to false . All values except false, 0, 0n, -0, “”, null, undefined, and NaN are truthy values.
布尔强制转换发生在使用逻辑运算符、三元运算符、if 语句和循环检查时。要理解 if 语句和运算符中的布尔强制转换,我们需要理解真值(truthy)和假值(falsy)的概念。真值是指会被转换(强制)为 true 的值。假值是指会被转换为 false 的值。除了 false、0、0n、-0、""、null、undefined 和 NaN 之外的所有值都是真值。
If statements:
如果语句:
Example:
示例:
var x = 0;
var x = 0;
var y = 23;
var y = 23;
if(x) { console.log(x) } // The code inside this block will not run since the value of x is 0(Falsy)
if(x) { console.log(x) } // 这段代码块不会运行,因为x的值为0(假值)
if(y) { console.log(y) } // The code inside this block will run since the value of y is 23 (Truthy)
if(y) { console.log(y) } // 这段代码块会运行,因为y的值为23(真值)
Logical operators in javascript, unlike operators in other programming languages, do not return true or false. They always return one of the operands. OR ( | | ) operator - If the first value is truthy, then the first value is returned. Otherwise, always the second value gets returned. AND ( && ) operator - If both the values are truthy, always the second value is returned. If the first value is falsy then the first value is returned or if the second value is falsy then the second value is returned. Example:
JavaScript中的逻辑运算符,不像其他编程语言中的运算符,不会返回true或false。它们总是返回其中一个操作数。或(| |)运算符 - 如果第一个值为真值,则返回第一个值。否则,总是返回第二个值。与(&&)运算符 - 如果两个值都为真值,则总是返回第二个值。如果第一个值为假值,则返回第一个值,或者如果第二个值为假值,则返回第二个值。示例:
var x = 220;
var x = 220;
var y = "Hello";
var y = "Hello";
var z = undefined;
var z = undefined;
x | | y // Returns 220 since the first value is truthy
x | | y // 返回220,因为第一个值为真值
x | | z // Returns 220 since the first value is truthy
x | | z // 返回220,因为第一个值为真值
x && y // Returns "Hello" since both the values are truthy
x && y // 返回"Hello",因为两个值都为真值
y && z // Returns undefined since the second value is falsy
y && z // 返回undefined,因为第二个值为假值
if( x && y ){
if( x && y ){
console.log("Code runs" ); // This block runs because x && y returns "Hello" (Truthy)
console.log("Code runs" ); // 此代码块运行,因为x && y返回"Hello"(真值)
}
if( x || z ){
if( x || z ){
console.log("Code runs"); // This block runs because x || y returns 220(Truthy)
console.log("Code runs"); // 此块运行,因为 x || y 返回 220(真值)
}
Equality coercion takes place when using ‘ == ‘ operator. As we have stated before The ‘ == ‘ operator compares values and not types. While the above statement is a simple way to explain == operator, it’s not completely true The reality is that while using the ‘==’ operator, coercion takes place. The ‘==’ operator, converts both the operands to the same type and then compares them. Example:
使用 ‘ == ‘ 运算符时会发生相等强制转换。正如我们之前所述,‘ == ‘ 运算符比较值而非类型。虽然上述语句是解释 == 运算符的简单方式,但并不完全正确,实际情况是使用 ‘==’ 运算符时会发生强制转换。‘==’ 运算符会将两个操作数转换为相同类型,然后进行比较。示例:
var a = 12;
var a = 12;
var b = "12";
var b = "12";
a == b // Returns true because both 'a' and 'b' are converted to the same type and then compared. Hence the operands are equal.
a == b // 返回 true,因为 'a' 和 'b' 都被转换为相同类型,然后进行比较,因此操作数相等。
Coercion does not take place when using the ‘===’ operator. Both operands are not converted to the same type in the case of ‘===’ operator.
使用 ‘===’ 运算符时不会发生强制转换。在 ‘===’ 运算符的情况下,两个操作数不会被转换成相同类型。
Example:
示例:
var a = 226;
var a = 226;
var b = "226";
var b = "226";
a === b // Returns false because coercion does not take place and the operands are of different types. Hence they are not equal.
a === b // 返回 false,因为不发生强制转换且操作数类型不同,因此它们不相等。
382. Is javascript a statically typed or a dynamically typed language?
JavaScript 是静态类型语言还是动态类型语言?
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7658d557c902bb0cd3 | 官方: 否 | 付费: 否
答案:
JavaScript is a dynamically typed language. In a dynamically typed language, the type of a variable is checked during run-time in contrast to a statically typed language, where the type of a variable is checked during compile-time.
JavaScript 是一种动态类型语言。在动态类型语言中,变量的类型在运行时检查,与静态类型语言(变量的类型在编译时检查)形成对比。
Since javascript is a loosely(dynamically) typed language, variables in JS are not associated with any type. A variable can hold the value of any data type.
由于 JavaScript 是一种松散(动态)类型语言,JS 中的变量不关联任何类型。一个变量可以保存任何数据类型。
For example, a variable that is assigned a number type can be converted to a string type:
例如,一个被赋予数字类型的变量可以转换为字符串类型:
var a = 23;
var a = 23;
var a = "Hello World!";
var a = "Hello World!";
383. What is NaN property in JavaScript?
JavaScript 中的 NaN 属性是什么?
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7658d557c902bb0cd6 | 官方: 否 | 付费: 否
答案:
NaN property represents the “Not-a-Number” value. It indicates a value that is not a legal number.
NaN 属性表示“非数字”的值。它指示一个不是合法数字的值。
typeof of NaN will return a Number .
typeof 对 NaN 的返回将是 Number。
To check if a value is NaN, we use the isNaN() function,
要检查一个值是否为 NaN,我们使用 isNaN() 函数,
Note- isNaN() function converts the given value to a Number type, and then equates to NaN.
注意:isNaN() 函数会将给定值转换为 Number 类型,然后与 NaN 进行相等比较。
isNaN("Hello") // Returns true
isNaN("Hello") // 返回 true
isNaN(345) // Returns false
isNaN(345) // 返回 false
isNaN('1') // Returns false, since '1' is converted to Number type which results in 0 ( a number)
isNaN('1') // 返回 false,因为 '1' 被转换为 Number 类型,结果为 1(一个数字)
isNaN(true) // Returns false, since true converted to Number type results in 1 ( a number)
isNaN(true) // 返回 false,因为 true 被转换为 Number 类型,结果为 1(一个数字)
isNaN(false) // Returns false
isNaN(false) // 返回 false
isNaN(undefined) // Returns true
isNaN(undefined) // 返回 true
384. Explain passed by value and passed by reference.
解释按值传递和按引用传递。
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7658d557c902bb0cd9 | 官方: 否 | 付费: 否
答案:
In JavaScript, primitive data types are passed by value and non-primitive data types are passed by reference. For understanding passed by value and passed by reference, we need to understand what happens when we create a variable and assign a value to it,
在 JavaScript 中,原始数据类型按值传递,非原始数据类型按引用传递。为了理解按值传递和按引用传递,我们需要了解当我们创建一个变量并为其赋值时会发生什么,
var x = 2;
var x = 2;
In the above example, we created a variable x and assigned it a value of “2”. In the background, the “=” (assign operator) allocates some space in the memory, stores the value “2” and returns the location of the allocated memory space. Therefore, the variable x in the above code points to the location of the memory space instead of pointing to the value 2 directly.
在上面的示例中,我们创建了一个变量 x,并为其赋值“2”。在后台,“=”(赋值运算符)在内存中分配一些空间,存储值“2”,并返回分配内存空间的位置。因此,上面代码中的变量 x 指向内存空间的位置,而不是直接指向值 2。
Assign operator behaves differently when dealing with primitive and non-primitive data types, Assign operator dealing with primitive types:
赋值运算符在处理原始和非原始数据类型时行为不同,赋值运算符处理原始类型时:
var y = 234;
var y = 234;
var z = y;
var z = y;
In the above example, the assign operator knows that the value assigned to y is a primitive type (number type in this case), so when the second line code executes, where the value of y is assigned to z, the assign operator takes the value of y (234) and allocates a new space in the memory and returns the address. Therefore, variable z is not pointing to the location of variable y, instead, it is pointing to a new location in the memory.
在上述示例中,赋值运算符知道赋给 y 的值是原始类型(本例中为数字类型),因此当第二行代码执行时,y 的值被赋给 z,赋值运算符会取 y 的值(234)并在内存中分配一个新空间,然后返回该地址。因此,变量 z 并不指向变量 y 的位置,而是指向内存中的一个新位置。
var y = #8454; // y pointing to address of the value 234
var y = #8454; // y 指向值 234 的地址
var z = y;
var z = y;
var z = #5411; // z pointing to a completely new address of the value 234
var z = #5411; // z 指向值 234 的一个完全新的地址
// Changing the value of y
// 更改 y 的值
y = 23;
y = 23;
console.log(z); // Returns 234, since z points to a new address in the memory so changes in y will not effect z
console.log(z); // 返回 234,因为 z 指向内存中的一个新地址,所以 y 的更改不会影响 z
From the above example, we can see that primitive data types when passed to another variable, are passed by value. Instead of just assigning the same address to another variable, the value is passed and new space of memory is created. Assign operator dealing with non-primitive types:
通过上述示例,我们可以看到原始数据类型在传递给另一个变量时是按值传递的。并非直接将相同地址赋给另一个变量,而是传递值并创建新的内存空间。赋值运算符处理非原始类型:
var obj = { name: "Vivek", surname: "Bisht" };
var obj = { name: "Vivek", surname: "Bisht" };
var obj2 = obj;
var obj2 = obj;
In the above example, the assign operator directly passes the location of the variable obj to the variable obj2. In other words, the reference of the variable obj is passed to the variable obj2.
在上述示例中,赋值运算符直接将变量 obj 的位置传递给变量 obj2。换句话说,变量 obj 的引用被传递给变量 obj2。
var obj = #8711; // obj pointing to address of { name: "Vivek", surname: "Bisht" }
var obj = #8711; // obj 指向 { name: "Vivek", surname: "Bisht" } 的地址
var obj2 = obj;
var obj2 = obj;
var obj2 = #8711; // obj2 pointing to the same address
var obj2 = #8711; // obj2 指向相同的地址
// changing the value of obj1
// 更改 obj1 的值
obj.name = "Akki";
obj.name = "Akki";
console.log(obj2);
console.log(obj2);
// Returns {name:"Akki", surname:"Bisht"} since both the variables are pointing to the same address.
// 返回 {name:"Akki", surname:"Bisht"},因为两个变量都指向同一个地址。
From the above example, we can see that while passing non-primitive data types, the assigned operator directly passes the address (reference). Therefore, non-primitive data types are always passed by reference.
从上述例子可以看出,在传递非原始数据类型时,赋值运算符直接传递地址(引用)。因此,非原始数据类型始终是通过引用传递的。
385. What is an Immediately Invoked Function in JavaScript?
什么是JavaScript中的立即调用函数?
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37b7658d557c902bb0cdc | 官方: 否 | 付费: 否
答案:
An Immediately Invoked Function ( known as IIFE and pronounced as IIFY) is a function that runs as soon as it is defined.
立即调用函数(称为IIFE,发音为IIFY)是在定义后立即运行的函数。
Syntax of IIFE :
IIFE的语法:
(function(){
(function(){
// Do something;
// 执行某些操作;
})();
To understand IIFE, we need to understand the two sets of parentheses that are added while creating an IIFE : The first set of parenthesis:
要理解IIFE,我们需要理解创建IIFE时添加的两组括号:第一组括号:
(function (){
(function (){
//Do something;
//执行某些操作;
})
While executing javascript code, whenever the compiler sees the word “function”, it assumes that we are declaring a function in the code. Therefore, if we do not use the first set of parentheses, the compiler throws an error because it thinks we are declaring a function, and by the syntax of declaring a function, a function should always have a name.
在执行JavaScript代码时,每当编译器看到“function”这个词,它就会假设我们正在声明一个函数。因此,如果我们不使用第一组括号,编译器会抛出错误,因为它认为我们在声明一个函数,而按照声明函数的语法,函数应该始终有名称。
function() {
function() {
//Do something;
//执行某些操作;
}
// Compiler gives an error since the syntax of declaring a function is wrong in the code above.
// 由于上面的代码中声明函数的语法错误,编译器会给出错误。
To remove this error, we add the first set of parenthesis that tells the compiler that the function is not a function declaration, instead, it’s a function expression. The second set of parenthesis:
要消除此错误,我们添加第一组圆括号,以告知编译器该内容不是函数声明,而是一个函数表达式。第二组圆括号:
(function (){
(function (){
//Do something;
//执行某些操作;
})();
From the definition of an IIFE, we know that our code should run as soon as it is defined. A function runs only when it is invoked. If we do not invoke the function, the function declaration is returned:
从IIFE的定义可知,我们的代码应在定义时立即运行。函数只有在被调用时才会运行。如果我们不调用该函数,则返回函数声明:
(function (){
(function (){
// Do something;
// 执行某些操作;
})
// Returns the function declaration
// 返回函数声明
Therefore to invoke the function, we use the second set of parenthesis.
因此,为了调用该函数,我们使用第二组圆括号。
386. What do you mean by strict mode in javascript and characteristics of javascript strict-mode?
javascript中的严格模式是什么意思,以及javascript严格模式有哪些特性?
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7658d557c902bb0cdf | 官方: 否 | 付费: 否
答案:
In ECMAScript 5, a new feature called JavaScript Strict Mode allows you to write a code or a function in a "strict" operational environment. In most cases, this language is 'not particularly severe' when it comes to throwing errors. In 'Strict mode,' however, all forms of errors, including silent errors, will be thrown. As a result, debugging becomes a lot simpler. Thus programmer's chances of making an error are lowered.
在ECMAScript 5中,一个名为JavaScript严格模式的新特性允许你在“严格”的运行环境中编写代码或函数。在大多数情况下,该语言在抛出错误方面“并不特别严格”。然而,在“严格模式”下,所有形式的错误,包括静默错误,都会被抛出。因此,调试变得简单得多,从而降低了程序员出错的可能性。
Characteristics of strict mode in javascript
javascript中严格模式的特性
Duplicate arguments are not allowed by developers. 2. In strict mode, you won't be able to use the JavaScript keyword as a parameter or function name. 3. The 'use strict' keyword is used to define strict mode at the start of the script. Strict mode is supported by all browsers. 4. Engineers will not be allowed to create global variables in 'Strict Mode.
- 开发者不允许使用重复的参数。2. 在严格模式下,你不能使用JavaScript关键字作为参数名或函数名。3. “use strict”关键字用于在脚本开头定义严格模式。所有浏览器都支持严格模式。4. 在“严格模式下”,工程师不允许创建全局变量。
387. Explain Higher Order Functions in javascript.
解释javascript中的高阶函数。
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37b7658d557c902bb0ce2 | 官方: 否 | 付费: 否
答案:
Functions that operate on other functions, either by taking them as arguments or by returning them, are called higher-order functions. Higher-order functions are a result of functions being first-class citizens in javascript.
将其他函数作为参数传入或返回其他函数的函数,称为高阶函数。高阶函数是javascript中函数作为一等公民的结果。
Examples of higher-order functions:
高阶函数的示例:
function higherOrder(fn) {
function higherOrder(fn) {
fn();
fn();
}
higherOrder(function() { console.log("Hello world") });
higherOrder(function() { console.log("Hello world") });
function higherOrder2() {
function higherOrder2() {
return function() {
return function() {
return "Do something";
return "Do something";
}
}
var x = higherOrder2();
var x = higherOrder2();
x() // Returns "Do something"
x() // 返回“Do something”
Successful Tech Career for FREE!
免费开启成功的科技职业生涯!
Successful Tech Career!
成功的技术职业生涯!
Interview Process
面试流程
CTC & Designation
CTC与职位级别
Projects on the Job
工作项目
Referral System
推荐系统
Try It Out
试试看
2 Lakh+ Roadmaps Created
已生成20万+职业规划
388. Explain “this” keyword.
解释“this”关键字。
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7658d557c902bb0ce5 | 官方: 否 | 付费: 否
答案:
The “this” keyword refers to the object that the function is a property of. The value of the “this” keyword will always depend on the object that is invoking the function.\
“this”关键字指的是函数作为其属性的那个对象。“this”关键字的值将始终取决于调用该函数的那个对象。
Confused? Let’s understand the above statements by examples:
感到困惑?让我们通过示例来理解上述陈述:
function doSomething() {
function doSomething() {
console.log(this);
console.log(this);
}
doSomething();
doSomething();
What do you think the output of the above code will be?
你认为上述代码的输出会是什么?
Note - Observe the line where we are invoking the function.
注意 - 观察我们调用函数的行。
Check the definition again:
再检查一下定义:
The “this” keyword refers to the object that the function is a property of.
“this” 关键字指代函数所属的对象。
In the above code, the function is a property of which object?
在上述代码中,该函数是哪个对象的属性?
Since the function is invoked in the global context, the function is a property of the global object.
由于该函数在全局上下文中被调用,所以该函数是全局对象的属性。
Therefore, the output of the above code will be the global object. Since we ran the above code inside the browser, the global object is the window object.
因此,上述代码的输出将是全局对象。由于我们在浏览器中运行上述代码,全局对象就是 window 对象。
Example 2:
示例2:
var obj = {
var obj = {
name: "vivek",
name: "vivek",
getName: function(){
getName: function(){
console.log(this.name);
console.log(this.name);
}
}
obj.getName();
obj.getName();
In the above code, at the time of invocation, the getName function is a property of the object obj , therefore, this keyword will refer to the object obj , and hence the output will be “vivek”.
在上述代码中,在调用时,getName 函数是对象 obj 的属性,因此,this 关键字将指代对象 obj,所以输出将是 “vivek”。
Example 3:
示例3:
var obj = {
var obj = {
name: "vivek",
name: "vivek",
getName: function(){
getName: function(){
console.log(this.name);
console.log(this.name);
}
}
var getName = obj.getName;
var getName = obj.getName;
var obj2 = {name:"akshay", getName };
var obj2 = {name:"akshay", getName };
obj2.getName();
obj2.getName();
Can you guess the output here?
你能猜到这里的输出是什么吗?
The output will be “akshay”.
输出将是“akshay”。
Although the getName function is declared inside the object obj , at the time of invocation, getName() is a property of obj2 , therefore the “this” keyword will refer to obj2 .
尽管getName函数是在对象obj内部声明的,但在调用时,getName()是obj2的一个属性,因此“this”关键字将指向obj2。
The silly way to understand the “ this” keyword is, whenever the function is invoked, check the object before the dot . The value of this . keyword will always be the object before the dot .
理解“this”关键字的简单方法是,每当函数被调用时,检查点前面的对象。this关键字的取值将始终是点前面的对象。
If there is no object before the dot-like in example1, the value of this keyword will be the global object.
如果在点前面没有对象,如示例1中那样,this关键字的值将是全局对象。
Example 4:
示例4:
var obj1 = {
var obj1 = {
address : "Mumbai,India",
address : "Mumbai,India",
getAddress: function(){
getAddress: function(){
console.log(this.address);
console.log(this.address);
}
}
var getAddress = obj1.getAddress;
var getAddress = obj1.getAddress;
var obj2 = {name:"akshay"};
var obj2 = {name:"akshay"};
obj2.getAddress();
obj2.getAddress();
Can you guess the output?
你能猜到输出是什么吗?
The output will be an error.
输出将是一个错误。
Although in the code above, this keyword refers to the object obj2 , obj2 does not have the property “address”‘, hence the getAddress function throws an error.
尽管在上面的代码中,此关键字指向对象obj2,但obj2没有属性“address”,因此getAddress函数会抛出错误。
389. What do you mean by Self Invoking Functions?
你所说的自调用函数是什么意思?
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: coding
- 分类: fullstack
- id: 69b37b7658d557c902bb0ce8 | 官方: 否 | 付费: 否
答案:
Without being requested, a self-invoking expression is automatically invoked (initiated). If a function expression is followed by (), it will execute automatically. A function declaration cannot be invoked by itself.
未经请求,自调用表达式会自动调用(启动)。如果函数表达式后跟(),它将自动执行。函数声明不能自行调用。
Normally, we declare a function and call it, however, anonymous functions may be used to run a function automatically when it is described and will not be called again. And there is no name for these kinds of functions.
通常,我们声明一个函数并调用它,然而,匿名函数可用于在描述时自动运行函数,并且不会再次被调用。而且这类函数没有名称。
390. Explain call(), apply() and, bind() methods.
请解释call()、apply()和bind()方法。
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7758d557c902bb0ceb | 官方: 否 | 付费: 否
答案:
- call():
- It’s a predefined method in javascript.
- This method invokes a method (function) by specifying the owner object.
- Example 1:
function sayHello(){
function sayHello(){
return "Hello " + this.name;
return "Hello " + this.name;
}
var obj = {name: "Sandy"};
var obj = {name: "Sandy"};
sayHello.call(obj);
sayHello.call(obj);
// Returns "Hello Sandy"
// 返回 "Hello Sandy"
- call() method allows an object to use the method (function) of another object.
- Example 2:
var person = {
var person = {
age: 23,
age: 23,
getAge: function(){
getAge: function(){
return this.age;
return this.age;
}
}
var person2 = {age: 54};
var person2 = {age: 54};
person.getAge.call(person2);
person.getAge.call(person2);
// Returns 54
// 返回 54
- call() accepts arguments:
function saySomething(message){
function saySomething(message){
return this.name + " is " + message;
return this.name + " is " + message;
}
var person4 = {name: "John"};
var person4 = {name: "John"};
saySomething.call(person4, "awesome");
saySomething.call(person4, "awesome");
// Returns "John is awesome"
// 返回 "John is awesome"
apply() The apply method is similar to the call() method. The only difference is that, call() method takes arguments separately whereas, apply() method takes arguments as an array.
apply() apply 方法与 call() 方法类似。唯一的区别在于,call() 方法分别接收参数,而 apply() 方法将参数作为数组接收。
function saySomething(message){
function saySomething(message){
return this.name + " is " + message;
return this.name + " is " + message;
}
var person4 = {name: "John"};
var person4 = {name: "John"};
saySomething.apply(person4, ["awesome"]);
saySomething.apply(person4, ["awesome"]);
- bind():
- This method returns a new function, where the value of “this” keyword will be bound to the owner object, which is provided as a parameter.
- Example with arguments:
var bikeDetails = {
var bikeDetails = {
displayDetails: function(registrationNumber,brandName){
displayDetails: function(registrationNumber,brandName){
return this.name+ " , "+ "bike details: "+ registrationNumber + " , " + brandName;
return this.name+ " , "+ "bike details: "+ registrationNumber + " , " + brandName;
}
}
var person1 = {name: "Vivek"};
var person1 = {name: "Vivek"};
var detailsOfPerson1 = bikeDetails.displayDetails.bind(person1, "TS0122", "Bullet");
var detailsOfPerson1 = bikeDetails.displayDetails.bind(person1, "TS0122", "Bullet");
// Binds the displayDetails function to the person1 object
// 将 displayDetails 函数绑定到 person1 对象
detailsOfPerson1();
detailsOfPerson1();
//Returns Vivek, bike details: TS0122, Bullet
// 返回 Vivek,自行车详情:TS0122, Bullet
391. What is the difference between exec () and test () methods in javascript?
JavaScript 中 exec () 和 test () 方法有什么区别?
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7758d557c902bb0cee | 官方: 否 | 付费: 否
答案:
- test () and exec () are RegExp expression methods used in javascript.
- We'll use exec () to search a string for a specific pattern, and if it finds it, it'll return the pattern directly; else, it'll return an 'empty' result.
- We will use a test () to find a string for a specific pattern. It will return the Boolean value 'true' on finding the given text otherwise, it will return 'false'.
392. What is currying in JavaScript?
JavaScript 中的柯里化是什么?
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7758d557c902bb0cf1 | 官方: 否 | 付费: 否
答案:
Currying is an advanced technique to transform a function of arguments n, to n functions of one or fewer arguments.
柯里化是一种高级技术,用于将参数为 n 的函数转换为 n 个单参数或更少参数的函数。
Example of a curried function:
柯里化函数的示例:
function add (a) {
function add (a) {
return function(b){
return function(b){
return a + b;
return a + b;
}
}
add(3)(4)
add(3)(4)
For Example, if we have a function f(a,b) , then the function after currying, will be transformed to f(a)(b). By using the currying technique, we do not change the functionality of a function, we just change the way it is invoked. Let’s see currying in action:
例如,如果我们有一个函数 f(a,b),那么经过柯里化后,该函数将转换为 f(a)(b)。通过使用柯里化技术,我们不改变函数的功能,只改变其调用方式。让我们看看柯里化的实际应用:
function multiply(a,b){
function multiply(a,b){
return a*b;
return a*b;
}
function currying(fn){
function currying(fn){
return function(a){
return function(a){
return function(b){
return function(b){
return fn(a,b);
return fn(a,b);
}
}
}
var curriedMultiply = currying(multiply);
var curriedMultiply = currying(multiply);
multiply(4, 3); // Returns 12
multiply(4, 3); // 返回 12
curriedMultiply(4)(3); // Also returns 12
curriedMultiply(4)(3); // 同样返回 12
As one can see in the code above, we have transformed the function multiply(a,b) to a function curriedMultiply , which takes in one parameter at a time.
从上面的代码可以看出,我们将函数 multiply(a,b) 转换成了函数 curriedMultiply,它一次只接受一个参数。
393. What are some advantages of using External JavaScript?
使用外部 JavaScript 有哪些优点?
- 知识点: 前端 (主题: javascript, frontend;标签: interviewbit, javascript, topic-specific, frontend)
- 类型: technical | 难度: easy | 子类型: concept
- 分类: fullstack
- id: 69b37b7758d557c902bb0cf6 | 官方: 否 | 付费: 否
答案:
External JavaScript is the JavaScript Code (script) written in a separate file with the extension.js, and then we link that file inside the or element of the HTML file where the code is to be placed.
外部 JavaScript 是写在扩展名为 .js 的单独文件中的 JavaScript 代码(脚本),然后我们将该文件链接到 HTML 文件中代码需要放置的位置的