Git Product home page Git Product logo

wiki's People

Contributors

aclk avatar

Watchers

 avatar

wiki's Issues

Nodejs汇总

汇总

对象和字符串之间的转换

  • 对象转字符串
var foo={ a: 20, b: [-100007], c: 100006, d: 'Node.JS', e: true, f: 4 };  
console.log(JSON.stringify(foo));// Node原生支持JSON  
// {"a":20,"b":[-100007],"c":100006,"d":"Node.JS","e":true,"f":4}
  • 字符串转对象
  1. 用eval函数
var foo="{_id:110}";  
var o=eval('('+foo+')');// 必须加括号才可以将该字符串转换成对象,加括号表示运行里面的代码。
console.log(o._id);//110
  1. 用JSON.parse函数
var foo='{"_id":110}';// 属性名必须已经被引号括起,否则转换将失败。  
var o=JSON.parse(foo);  
console.log(o._id);// 110

(os)模块

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.