最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

What is the @ symbol in Javascript? - Stack Overflow

programmeradmin5浏览0评论

I stumbled upon and I don't understand the answer since the user uses an @ symbol in a way I've never seen before. What does it do when attached to the if keyword? Can you attach it to other keywords?

I stumbled upon https://codereview.stackexchange./questions/10610/refactoring-javascript-into-pure-functions-to-make-code-more-readable-and-mainta and I don't understand the answer since the user uses an @ symbol in a way I've never seen before. What does it do when attached to the if keyword? Can you attach it to other keywords?

Share Improve this question edited Apr 13, 2017 at 12:40 CommunityBot 11 silver badge asked Jun 30, 2012 at 23:01 Leila HamonLeila Hamon 2,5957 gold badges25 silver badges32 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 12

It's not a JavaScript thing. It's a symbol used by whatever templating system that answer was referring to. Note that the <script> element has type text/html, which will prevent browsers from paying any attention to its contents.

Some other JavaScript code will find that script and fetch its innerHTML in order to merge the template with some data to create ... well whatever that template makes.

@: syntax in Razor

Said by @StriplingWarrior at Using Razor within JavaScript

It is razor code, not javascript, if you are interested in razor check: http://weblogs.asp/scottgu/archive/2010/07/02/introducing-razor.aspx

发布评论

评论列表(0)

  1. 暂无评论