<ul class="entries">
{% for post in paginator.posts %}
<li>
<a href="{{ post.url }}">
<h3>{{ post.title }}</h3>
<p class="blogdate">{{ post.date | date: "%d %B %Y" }}</p>
<div>{{ post.content |truncatehtml | truncatewords: 60 }}</div>
</a>
</li>
{% endfor %}
</ul>
Run Code Online (Sandbox Code Playgroud)
这显示了我的所有帖子,我只想展示最新的帖子.
这看起来很简单,但JavaScript却给出了错误的结果.
我做错了什么还是这是一种语言怪癖?
[5,10,1] .sort();
[1,10,5]