我试图将文本存储在变量var sendSpecialChat = hi;
document.writeIn(sendSpecialChat.toUpperCase());
document.getElementById('print').innerHTML = "sendSpecialChat";
大写中,但我无法找出它无法正常工作的原因。这实际上并不是我想要做的,但我简化了代码:
<p id="print"></p>
&#13;
{{1}}&#13;
虽然它不起作用。我的代码出了什么问题?
答案 0 :(得分:2)
var sendSpecialChat = "hi";
document.getElementById('print').innerHTML = sendSpecialChat.toUpperCase();
将为您提供字符串的大写版本。你的代码有一些问题,你需要在字符串周围使用引号(&#34;),而不是在变量名称周围。
<p id="print"></p>
&#13;
'use strict';
/**
* Module dependencies
*/
var coursesPolicy = require('../policies/courses.server.policy'),
courses = require('../controllers/courses.server.controller');
var passport = require('passport');
var isAuthenticated = function(req, res, next) {
// if user is authenticated in the session, call the next() to call the next request handler
// Passport adds this method to request object. A middleware is allowed to add properties to
// request and response objects
if (req.isAuthenticated())
return next();
// if the user is not authenticated then redirect the user to the login page
res.redirect('/');
};
module.exports = function (app) {
// Courses collection routes
app.route('/api/courses').all(coursesPolicy.isAllowed)
.get(courses.list)
.post(courses.create);
// Single course routes
app.route('/api/courses/:courseId', isAuthenticated).all(coursesPolicy.isAllowed)
.get(courses.read)
.put(courses.update)
.delete(courses.delete);
// Finish by binding the course middleware
app.param('courseId', courses.courseByID);
};
&#13;