js中的数据类型

Home » JavaScript » js中的数据类型

文章归档

文件夹

截取字符的时候,整型不可以使用indexOf会报错。
可以用取余取整去截取整型字符,或者转成字符串。
另外在比较上如果不用全等(===)就要注意判断的关系,可以看下以下的例子。
“0”==0 true;

0==false true;
“0”==false true;
false==”false” false;
然而即使”0″==0 为 true,
if(“0”) {alert(1)} 会执行 其他两个不会执行。

给一个判断js数据类型的方法供大家研究。

function getType(o)
{
var _t;
return ((_t = typeof(o)) == "object" ? o==null && "null" || Object.prototype.toString.call(o).slice(8,-1):_t).toLowerCase();
}

18 Responses to “js中的数据类型”
  • vans outlet

    I wanted to send you this tiny note so as to give many thanks the moment again on the pretty strategies you’ve shared in this article. This has been simply extremely generous of people like you to make openly what a lot of folks might have offered for sale for an electronic book in making some money for themselves, certainly considering that you might have tried it in the event you desired. The basics likewise worked to be the good way to be sure that other people have similar zeal just as my own to know the truth good deal more when it comes to this matter. I am sure there are numerous more pleasurable sessions up front for individuals who look into your blog post.

    回复
  • kobe shoes

    A lot of thanks for all your labor on this site. My aunt delights in doing internet research and it’s really easy to see why. Most of us notice all relating to the lively way you deliver worthwhile tactics on the web site and in addition invigorate contribution from other ones on that point then our own child is undoubtedly learning a great deal. Take advantage of the rest of the year. You’re carrying out a brilliant job.

    回复
  • ultra boost

    I would like to voice my gratitude for your generosity in support of those people who actually need help with the niche. Your special commitment to passing the solution throughout had become exceedingly good and have without exception allowed associates like me to get to their objectives. Your entire warm and helpful information indicates much a person like me and far more to my office workers. Regards; from everyone of us.

    回复
  • air jordan 11

    I must express appreciation to this writer just for rescuing me from this type of crisis. Just after scouting throughout the the net and obtaining ideas that were not powerful, I thought my life was gone. Living without the presence of strategies to the difficulties you have resolved by means of the article is a crucial case, as well as the ones which may have in a negative way affected my career if I had not discovered the blog. The knowledge and kindness in handling all the details was vital. I’m not sure what I would’ve done if I had not come across such a thing like this. I can now look ahead to my future. Thank you so much for this expert and sensible help. I won’t think twice to refer your web site to anyone who needs to have counselling about this problem.

    回复
  • yeezy

    I enjoy you because of all of your effort on this blog. My aunt loves participating in investigations and it’s easy to understand why. A number of us learn all of the dynamic means you create practical secrets on the web site and even cause participation from some others on this article plus our own princess is without a doubt being taught a lot. Have fun with the remaining portion of the year. You are always conducting a really good job.

    回复
  • supreme clothing

    I precisely wished to say thanks all over again. I’m not certain the things that I would’ve carried out without the entire basics shown by you regarding such a area of interest. It seemed to be the intimidating scenario in my opinion, nevertheless looking at a professional manner you dealt with it took me to jump with fulfillment. I am just happier for this service and in addition sincerely hope you recognize what a great job you are always carrying out educating men and women using a site. More than likely you haven’t met all of us.

    回复
  • pure boost

    I precisely had to say thanks again. I’m not certain what I might have used in the absence of the actual pointers provided by you over this question. It has been the horrifying situation for me personally, but finding out this expert tactic you managed that made me to jump over contentment. I am just happy for the support and then hope that you really know what a powerful job you happen to be carrying out instructing some other people through your blog post. I know that you’ve never encountered any of us.

    回复
  • nike air max 270

    I want to show my affection for your kind-heartedness giving support to people that really want help on this important idea. Your real commitment to passing the solution across was surprisingly good and have continuously enabled guys and women much like me to arrive at their ambitions. Your entire helpful facts means a lot to me and even further to my mates. Thanks a ton; from everyone of us.

    回复
  • nike react flyknit

    My husband and i felt absolutely fortunate when Ervin could finish off his basic research with the ideas he discovered from your web pages. It is now and again perplexing to simply choose to be releasing guidelines that most people could have been trying to sell. Therefore we already know we’ve got the blog owner to appreciate for that. Those illustrations you have made, the easy site navigation, the relationships you assist to engender – it is most extraordinary, and it’s letting our son in addition to the family feel that that content is exciting, which is unbelievably indispensable. Thank you for everything!

    回复
  • Adidas NMD XR1 Zebra Crossing Blue White

    I am only writing to let you know what a outstanding encounter my cousin’s daughter enjoyed studying your web page. She came to find such a lot of pieces, including what it is like to have an ideal teaching mood to have the others clearly master a number of tricky issues. You truly did more than people’s desires. I appreciate you for rendering the necessary, healthy, explanatory and cool tips about your topic to Ethel.

    回复
  • lebron 11

    I needed to post you this very small note just to thank you the moment again with the remarkable tips you’ve provided in this article. It has been quite wonderfully open-handed with you to give easily precisely what a number of people would’ve offered for sale as an e-book to help make some cash for their own end, chiefly seeing that you might have done it if you desired. The inspiring ideas also worked as the easy way to understand that someone else have a similar zeal much like my very own to learn way more in terms of this issue. I believe there are many more pleasant instances up front for those who look over your site.

    回复
  • golden goose sale

    My spouse and i felt quite joyous Emmanuel managed to finish up his investigation because of the ideas he received from your very own site. It is now and again perplexing to simply always be giving freely hints which a number of people could have been selling. And we also recognize we’ve got you to give thanks to for that. All the explanations you made, the simple site navigation, the friendships you make it easier to create – it is most terrific, and it is leading our son in addition to the family do think the theme is enjoyable, which is certainly tremendously serious. Thank you for the whole thing!

    回复
  • retro jordans

    I really wanted to make a simple word so as to say thanks to you for the precious advice you are giving at this website. My extensive internet investigation has now been paid with reputable facts and techniques to talk about with my colleagues. I would claim that many of us visitors are truly fortunate to dwell in a wonderful site with many lovely people with valuable tactics. I feel very much blessed to have come across your website and look forward to many more exciting times reading here. Thanks again for everything.

    回复
  • ultra boost

    I intended to post you a little bit of observation in order to give thanks again over the breathtaking tactics you’ve contributed in this article. It’s quite extremely generous with people like you to convey publicly what many people would’ve advertised for an ebook in order to make some bucks for themselves, chiefly considering the fact that you might well have tried it if you ever decided. The good tips additionally served like the fantastic way to understand that other people have similar fervor similar to mine to realize lots more when it comes to this condition. I know there are many more pleasurable situations up front for people who examine your website.

    回复
  • tory burch shoes

    I precisely desired to thank you so much all over again. I do not know what I would’ve achieved in the absence of those tactics revealed by you on my industry. Certainly was a horrifying concern in my opinion, but understanding a new skilled manner you treated the issue made me to cry with contentment. I’m just happy for this advice and as well , expect you recognize what a great job you’re doing instructing people via your webpage. Most probably you have never got to know any of us.

    回复
  • Balenciaga UK

    Jordan 12 Gym Redhttp://www.jordan12gymred.us.com/
    nike factory outlet store onlinehttp://www.nikefactoryoutletstoreonline.com/
    nike factory outlethttp://www.nikefactoryoutletstoreonline.us/
    Nike Outlethttp://www.nikestores.us.com/
    air jordan 33http://www.jordan33.us/
    Yeezyhttp://www.cheapjerseysfromchina.us/
    custom nfl jerseyshttp://www.customnfljerseys.us/
    jordan 11 concordhttp://www.jordan11concord.us.com/
    Air Jordan 12 Gym Redhttp://www.jordan12gymred.us/
    Jordan 12 Gym Red 2018http://www.redjordan12.us/
    Yeezyhttp://www.yeezy.com.co/
    Yeezyshttp://www.yeezys.us.com/
    Yeezyhttp://www.yeezysupply.us.com/
    Yeezy Boost 350http://www.yeezy-shoes.us.com/
    Yeezy Boosthttp://www.yeezy-boost350.com/
    Yeezy Boost 350 V2http://www.yeezyboost350.us.com/
    Yeezy Boost 350 V2 Blue Tinthttp://www.yeezybluetint.com/
    Yeezy 500http://www.yeezy500utilityblack.com/
    Yeezy 500http://www.yeezy500utilityblack.us/
    Vapor Maxhttp://www.vapor-max.org.uk/
    Salomon UKhttp://www.salomon-shoes.org.uk/
    Salomonhttp://www.salomons.me.uk/
    Salomon Shoeshttp://www.salomonspeedcross4.org.uk/
    Off White Air Jordan 1http://www.offwhitejordan1.com/
    Vapor Maxhttp://www.nikevapormax.org.uk/
    Nike React Element 87http://www.nikereactelement87.us.com/
    Nike React Element 87http://www.nikereactelement87.us/
    Nike Plushttp://www.nikeplus.us/
    Nike Outlet Onlinehttp://www.nike–outlet.us/
    Nike Outlet Store Online Shoppinghttp://www.nikeoutletstoreonlineshopping.us/
    Nike Outlet Storehttp://www.nikeoutletonlineshopping.us/
    Nike NBA Jerseyshttp://www.nikenbajerseys.us/
    Air Max Nikehttp://www.nikeairmax.us/
    Air Max 2017http://www.max2017.us/
    Jordan Shoes 2018http://www.jordan-com.com/
    Jordan 11 Concord 2018http://www.jordan11-concord.com/
    Cheap Yeezy Shoeshttp://www.cs7boots1.com/
    Wholesale Cheap NBA Jerseyshttp://www.cheapnba-jerseys.us/
    Birkenstock Sandals UKhttp://www.birkenstocksandalsuk.me.uk/
    Basketball Jerseyhttp://www.basketball-jersey.us/
    Balenciaga UKhttp://www.balenciaga.me.uk/
    Balenciaga UKhttp://www.balenciagauk.org.uk/
    Balenciagahttp://www.balenciagatriples.org.uk/
    Balenciagahttp://www.birkenstocks.me.uk/
    Balenciaga UKhttp://www.balenciagatrainers.org.uk/
    Nike Air Maxhttp://www.airmax270.org.uk/
    Yeezy Shoeshttp://www.adidasyeezyshoes.org.uk/
    Yeezy Shoeshttp://www.adidasyeezyshoes.org.uk/

    回复
  • NBA Jerseys

    Yeezyshttp://www.yeezy.com.co/
    Yeezyshttp://www.yeezys.us.com/
    Yeezy Shoeshttp://www.yeezysupply.us.com/
    Yeezy Boost 350http://www.yeezy-shoes.us.com/
    Yeezy Boost 350 V2http://www.yeezy-boost350.com/
    Yeezy Boosthttp://www.yeezyboost350.us.com/
    Yeezy Boost 350 V2 Blue Tinthttp://www.yeezybluetint.com/
    Yeezy 500http://www.yeezy500utilityblack.com/
    Adidas Yeezy 500http://www.yeezy500utilityblack.us/
    Vapor Maxhttp://www.vapor-max.org.uk/
    Salomon Shoeshttp://www.salomon-shoes.org.uk/
    Salomonhttp://www.salomons.me.uk/
    Salomon Speedcross 4http://www.salomonspeedcross4.org.uk/
    Off White Air Jordan 1http://www.offwhitejordan1.com/
    Nike VaporMaxhttp://www.nikevapormax.org.uk/
    Nike React Element 87http://www.nikereactelement87.us.com/
    React Element 87http://www.nikereactelement87.us/
    Nike Plushttp://www.nikeplus.us/
    Nike Outlet Onlinehttp://www.nike–outlet.us/
    Nike Outlethttp://www.nikeoutletstoreonlineshopping.us/
    Nike Outlet Store Online Shoppinghttp://www.nikeoutletonlineshopping.us/
    NBA Jerseyshttp://www.nikenbajerseys.us/
    Nike Air Maxhttp://www.nikeairmax.us/
    Air Max Nikehttp://www.max2017.us/
    Air Jordan Shoeshttp://www.jordan-com.com/
    Jordan 11 Concord 2018http://www.jordan11-concord.com/
    Cheap Yeezy Shoeshttp://www.cs7boots1.com/
    Wholesale Cheap NBA Jerseyshttp://www.cheapnba-jerseys.us/
    Birkenstock UKhttp://www.birkenstocksandalsuk.me.uk/
    NBA Jerseyshttp://www.basketball-jersey.us/
    Balenciagahttp://www.balenciaga.me.uk/
    Balenciagahttp://www.balenciagauk.org.uk/
    Balenciagahttp://www.balenciagatriples.org.uk/
    Balenciagahttp://www.birkenstocks.me.uk/
    Balenciagahttp://www.balenciagatrainers.org.uk/
    Air Max 270http://www.airmax270.org.uk/
    Yeezy Shoeshttp://www.adidasyeezyshoes.org.uk/
    Yeezy Shoeshttp://www.adidasyeezyshoes.org.uk/

    回复
  • Air Max Nike

    Air Jordan 12 Gym Redhttp://www.jordan12gymred.us.com/
    nike factory outlethttp://www.nikefactoryoutletstoreonline.com/
    nike factory outlethttp://www.nikefactoryoutletstoreonline.us/
    Nike Outlethttp://www.nikestores.us.com/
    jordan 33http://www.jordan33.us/
    Yeezy Shoeshttp://www.cheapjerseysfromchina.us/
    custom nfl jerseyshttp://www.customnfljerseys.us/
    jordan 11 concord 2018http://www.jordan11concord.us.com/
    Air Jordan 12 Gym Redhttp://www.jordan12gymred.us/
    Jordan 12 Gym Redhttp://www.redjordan12.us/
    Yeezyshttp://www.yeezy.com.co/
    Yeezyhttp://www.yeezys.us.com/
    Yeezyhttp://www.yeezysupply.us.com/
    Yeezy Shoeshttp://www.yeezy-shoes.us.com/
    Yeezy Boost 350http://www.yeezy-boost350.com/
    Yeezy Boost 350 V2http://www.yeezyboost350.us.com/
    Yeezy Blue Tinthttp://www.yeezybluetint.com/
    Adidas Yeezy 500http://www.yeezy500utilityblack.com/
    Yeezy 500 Utility Blackhttp://www.yeezy500utilityblack.us/
    Vapor Maxhttp://www.vapor-max.org.uk/
    Salomonhttp://www.salomon-shoes.org.uk/
    Salomon UKhttp://www.salomons.me.uk/
    Salomon UKhttp://www.salomonspeedcross4.org.uk/
    Off White Jordan 1http://www.offwhitejordan1.com/
    Nike VaporMaxhttp://www.nikevapormax.org.uk/
    Nike Element 87http://www.nikereactelement87.us.com/
    React Element 87http://www.nikereactelement87.us/
    Nike Plushttp://www.nikeplus.us/
    Nike Outlet Onlinehttp://www.nike–outlet.us/
    Nike Outlet Store Online Shoppinghttp://www.nikeoutletstoreonlineshopping.us/
    Nike Outlet Storehttp://www.nikeoutletonlineshopping.us/
    Cheap Nike NBA Jerseyshttp://www.nikenbajerseys.us/
    Air Max 97http://www.nikeairmax.us/
    Air Max 2017http://www.max2017.us/
    Jordan Shoeshttp://www.jordan-com.com/
    Jordan 11 Concordhttp://www.jordan11-concord.com/
    Cheap Yeezy Boosthttp://www.cs7boots1.com/
    Cheap NBA Jerseyshttp://www.cheapnba-jerseys.us/
    Birkenstock Sandals UKhttp://www.birkenstocksandalsuk.me.uk/
    NBA Jerseyshttp://www.basketball-jersey.us/
    Balenciagahttp://www.balenciaga.me.uk/
    Balenciagahttp://www.balenciagauk.org.uk/
    Balenciagahttp://www.balenciagatriples.org.uk/
    Balenciaga UKhttp://www.birkenstocks.me.uk/
    Balenciaga Trainershttp://www.balenciagatrainers.org.uk/
    Nike Air Maxhttp://www.airmax270.org.uk/
    Yeezy Shoeshttp://www.adidasyeezyshoes.org.uk/
    Yeezy Shoeshttp://www.adidasyeezyshoes.org.uk/

    回复

发表评论

Your email address will not be published.