这是正确的JavaScript [英] Is this correct in javascript

查看:60
本文介绍了这是正确的JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

如果是两个int值,则返回它们的和.除非两个值相同,否则请使用jquery或javascript
返回其总和的两倍

Dear All,

if two int values, return their sum. Unless the two values are the same, then return double their sum using jquery or javascript

sumDouble(1, 2) -> 3
sumDouble(3, 2) -> 5
sumDouble(2, 2) -> 8







public int sumDouble(int a, int b) {
if(a==b) return 2*(a+b);
else return a+b;
}





2.如果两个2个字符串a和b返回包含相同长度2子字符串的位置的数目.因此,"xxcaazz"和"xxbaaz"会产生3,因为使用jQuery或javascript函数,"xx","aa"和"az"子字符串在两个字符串中都出现在同一位置.





2.if two 2 strings, a and b, return the number of the positions where they contain the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3, since the "xx", "aa", and "az" substrings appear in the same place in both strings using jquery or javascript functions.

string_match('xxcaazz', 'xxbaaz') → 3
string_match('abc', 'abc') → 2
string_match('abc', 'axc') → 0

推荐答案

我们不做您的作业:这是有原因的.在这里,您可以考虑自己被告知的内容,并尝试理解它.也可以在那里帮助您的导师识别您的弱点,并将更多的注意力放在补救措施上.
自己尝试,您可能会发现它并不像您想的那么困难!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Try it yourself, you may find it is not as difficult as you think!


这篇关于这是正确的JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆