美文网首页
2018-05-11 高思总结

2018-05-11 高思总结

作者: 范晓坤 | 来源:发表于2018-05-23 17:38 被阅读0次

1.扩展String的原型方法,实现trim,删除空格

if(!String.prototype.trim){
  Sting.prototype.trim = function(){
    return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
  }
}

2.考察函数声明提前,以及JS分解析和执行阶段

var a =1;
function A(){
  a =3;
  return;
  function a(){}
}
A();
console.log(a)//1

如果此时改为

var a =1;
function A(){
  a =3;
  return;
}
A();
console.log(a)//3

3.考察作用域

var arr1=[1,2,3,4,5],arr2=[];
fot(var i=0;i<arr.length;i++){
   arr2.push(function(){alert(i)});
}
console.log(arr2[3]());//5

4.左定宽,右自适应

1⃣️position +margin
//html
<div class='left'>定宽</div>
<div class='right'>自适应</div>
//css
.left{
  width:200px;
  height:660px;
  position:absolute;
  top:0;
  left:0;
}
.right{
  height:660px;
  margin-left:200px;
}
2⃣️float + margin
//html
<div class='left'>定宽</div>
<div class='right'>自适应</div>
//css
.left{
  width:200px;
  height:660px;
  float:left;
}
.right{
  height:660px;
  margin-left:200px;//或者overflow:hidden;
}

3⃣️flex布局

//html
<div class="parent">
  <div class='left'>定宽</div>
<div class='right'>自适应</div>
</div>
//css
.parent{
  display:flex;
}
.left{
  width:200px;
  height:660px;
}
.right{
  height:660px;
  flex:1;
}
5⃣️table

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <!--5 table-->
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        /*table 的显示特性为 每列的单元格 宽度和 一定等于 表格宽度。
         table-layout: fixed 可加速渲染,也是设定布局优先。
         table-cell 中不可以设置 margin 但是可以通过 padding 来设置间距*/

        .parent {
            /*必须有100%宽度*/
            display: table;
            table-layout: fixed;
            width: 100%;
        }

        .left {
            width: 200px;
            height: 600px;
            background: red;
            text-align: center; /*文字水平居中*/
            line-height: 600px; /*文字垂直居中*/
            color: #fff;

            display: table-cell;
        }

        .right {
            height: 600px;
            background: yellow;
            text-align: center; /*文字水平居中*/
            line-height: 600px; /*文字垂直居中*/

            display: table-cell;
        }
    </style>
</head>
<body class="parent">
<div class="left">定宽</div>
<div class="right">自适应</div>
</body>
</html>

5.js事件循环

https://yangbo5207.github.io/wutongluo/ji-chu-jin-jie-xi-lie/shi-si-3001-es6-chang-yong-zhi-shi-he-ji.html

相关文章

  • 2018-05-11 高思总结

    1.扩展String的原型方法,实现trim,删除空格 2.考察函数声明提前,以及JS分解析和执行阶段 如果此时改...

  • 2018-05-11

    2018-05-11号第一次小组会总结: 1、感受团队向上的正能量。 2、理清自己所要的东西,一路带着排斥豁出去 ...

  • 2018-05-13

    计算机与通信工程学院 学院组织集体收看纪念马克思诞辰200周年大会直播 作者:刘杰时间:2018-05-11 【本...

  • 2018-05-13

    计算机与通信工程学院 学院组织集体收看纪念马克思诞辰200周年大会直播 作者:刘杰时间:2018-05-11 【本...

  • 2018-05-11总结

    利用for循环,查找给定范围内满足条件的数。 双层for循环的使用。 练习 &&与 ||或 的使用。 \n ...

  • 高思

    当思想不受社会羁绊,自身创造力且可波及世界巅峰,甩大多数人群且自认为高分人群几条街后,眼睛里有光,心里有正确,脑海...

  • 2018-05-11拼音总结

  • 慕思高

    朝思高 以初阳之磅礴敬别日之酒 夕思高 以残日之璀璨礼将来之剑 慕思高 以情不断之思作念,酸不腐,痴不改,以青春之...

  • 高思危

    芯儿学习记 居卑后,知登高为危 处晦后,知向明太露 守静后,知好动过劳 养默后,知多言为躁

  • (毛路路)四种跨分片交易方案

    2018-05-11 [四种跨分片交易方案](https://zhuanlan.zhihu.com/p/36706...

网友评论

      本文标题:2018-05-11 高思总结

      本文链接:https://www.haomeiwen.com/subject/styldftx.html