Added roman numeral condition for <=0 || >= 5000
This commit is contained in:
parent
1c3b81e7b7
commit
96ac6101cf
2 changed files with 2 additions and 1 deletions
1
app.js
1
app.js
|
@ -58,6 +58,7 @@ var App = new Vue({
|
||||||
* @return {[string]} [roman numeral conversion of provided whole number]
|
* @return {[string]} [roman numeral conversion of provided whole number]
|
||||||
*/
|
*/
|
||||||
function intToRoman(n) {
|
function intToRoman(n) {
|
||||||
|
if (n <= 0 || n >= 5000) return '';
|
||||||
// Set up mapping to compare crucial roman numerals to their integet values
|
// Set up mapping to compare crucial roman numerals to their integet values
|
||||||
var mapping = {
|
var mapping = {
|
||||||
'M': 1000, 'CM': 900, 'D': 500, 'CD': 400, 'C': 100,
|
'M': 1000, 'CM': 900, 'D': 500, 'CD': 400, 'C': 100,
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<small class="pull-left text-muted">Roman Numerals</small>
|
<small class="pull-left text-muted">Roman Numerals</small>
|
||||||
<br />
|
<br />
|
||||||
<h1 class="pull-right">{{ result }}</h1>
|
<h1 class="pull-right">{{ result }}</h1>
|
||||||
<h1 class="pull-left text-muted">{{ resultRoman }}</h1>
|
<h3 class="pull-left text-muted">{{ resultRoman }}</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Table -->
|
<!-- Table -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue