Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                // 請寫一個叫做 isUpperCase 的 functuon,並且接收一個字串,回傳這個字串的第一個字母是否為大寫。
// isUpperCase("abcd") 正確回傳值:false
// isUpperCase("Abcd") 正確回傳值:true
// isUpperCase("ABCD") 正確回傳值:true
// isUpperCase("aBCD") 正確回傳值:false

// https://stackoverflow.com/questions/1027224/how-can-i-test-if-a-letter-in-a-string-is-uppercase-or-lowercase-using-javascrip
function isUpperCase (str) {
  if (typeof str === 'string') {

    let firstChar = str.charAt(0)
    let range = firstChar.charCodeAt(0)
    let isUppercase = range >= 65 && range <= 90
    let isLowercase = range >= 97 && range <= 124

    if (!isLowercase && !isUppercase) {
      console.log('這不是英文')
      return false
    }
    if ( isUppercase ){
    // if ( firstChar === firstChar.toUpperCase() ){
      console.log('回傳值:', true)
      return true
    } else {
      console.log('回傳值:', false)
      return false
    }
  } else {
    console.log('請輸入字串!')
  }
}

isUpperCase("abcd")
isUpperCase("Abcd")
isUpperCase("ABCD")
isUpperCase("aBCD")
isUpperCase("-BCD")
              
            
!
999px

Console