Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

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.


                  <div id="interactive" class="viewport"></div>





  inputStream: {
    name: 'Live',
    type: 'LiveStream',
    target: document.querySelector('#interactive'),//埋め込んだdivのID
    constraints: {
      facingMode: 'environment',
    area: {//必要ならバーコードの読み取り範囲を調整できる(この場合は、上30%/下30%は読み取りしない)
      top: "30%",
      right: "0%",
      left: "0%",
      bottom: "30%"
  locator: {
    patchSize: 'medium',
    halfSample: true,
  numOfWorkers: 2,
  decoder: {
    readers: ['ean_reader']//ISBNは基本的にこれ(他にも種類あり)
  locate: true,
}, (err) => {
  if(!err) {
    // alert("started");

Quagga.onDetected(success => {
  const code = success.codeResult.code;
  if(calc(code)) alert(code);

const calc = isbn => {
  const arrIsbn = isbn
    .map(num => parseInt(num));
  let remainder = 0;
  const checkDigit = arrIsbn.pop();

  arrIsbn.forEach((num, index) => {
    remainder += num * (index % 2 === 0 ? 1 : 3);
  remainder %= 10;
  remainder = remainder === 0 ? 0 : 10 - remainder;

  return checkDigit === remainder;