{"id":23291,"date":"2020-09-27T22:12:16","date_gmt":"2020-09-28T05:12:16","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=23291"},"modified":"2020-09-27T22:12:18","modified_gmt":"2020-09-28T05:12:18","slug":"error-unexpected-end-of-input","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/","title":{"rendered":"Error: Unexpected end of input"},"content":{"rendered":"\n<p><code>Uncaught SyntaxError: Unexpected end of input<\/code>.<\/p>\n\n\n\n<p>I know this very error has kept me up at night sometimes. Don\u2019t sweat it! This article will talk about ways to help you debug your code so you can conquer this error and move on with your project.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What does it mean?<\/h2>\n\n\n\n<p>More likely than not, it means you have mismatching brackets or quotes somewhere in your code. Ultimately, it is because the V8 engine is parsing your code in a certain way and is looking for a particular character.<br><\/p>\n\n\n\n<p>If the error gives you a line and char number, that\u2019s a good place to start hunting. If not at that point, backtrack in your code until you find it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How can I find it?&nbsp;<\/h2>\n\n\n\n<p>There are a couple of things you can do to help find syntax bugs in your code:&nbsp;<br><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Make sure everything is indented correctly. An extension like Prettier or Beautify can help in this regard. However, if you have an error in your syntax, the extension won\u2019t run or will work incorrectly. Indentation makes your code more readable, even if it\u2019s not necessarily required to run in a language like JavaScript.<\/li><li>Use the dropdown arrows on the left hand side of your editor to hide elements. If your elements have matching opening and closing brackets, the block will collapse. Here\u2019s an example:<\/li><\/ol>\n\n\n\n<p>Without clicking dropdowns:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/ha23z5EZYcYoJk4KPuDXGvIHhkWir1FemwG0gMADKSpFpFu-xRIKTSBT4QP_OdnNcSryU_xpKWoYj5kRdfd6ll53w1MdkaGcQaTeGPc8bSkzRXl3ZMEsjibThgqpLbTcTNDdtCXI\" alt=\"\"\/><\/figure>\n\n\n\n<p>With clicking dropdowns:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/RLi5xhW93dZQJR7ZjctsRlrRwtOGugviB6a-W56Jsw3S5Ek6qoes1RS8_gR5ZPxZqzSJJmrZHmI8Gzak7iZmqEyksTg0oq5Hs5hViVzlB0r7bF1ULgL64VaylKCgZlWDOTEGDeXP\" alt=\"\"\/><\/figure>\n\n\n\n<p>This will take attention away from the elements you don\u2019t need to concentrate on, and bring attention to places that might not have matching brackets. If you are not able to collapse it properly, there is more than likely a syntax error in that block of code.<br><\/p>\n\n\n\n<p>The more you perform code review or the more you encounter this error, the faster you will get at spotting these types of errors! Good luck debugging!<\/p>\n","protected":false},"excerpt":{"rendered":"Uncaught SyntaxError: Unexpected end of input. I know this very error has kept me up at night sometimes. Don\u2019t sweat it! This article will talk about ways to help you debug your code so you can conquer this error and move on with your project. What does it mean? More likely than not, it means&hellip;","protected":false},"author":77,"featured_media":23292,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11933],"tags":[],"class_list":{"0":"post-23291","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-javascript"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"JavaScript","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":[]},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.4 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Error: Unexpected End of Input | Career Karma<\/title>\n<meta name=\"description\" content=\"Learn how to deal with an &quot;Unexpected End of Input&quot; error in JavaScript in this article by Career Karma.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Error: Unexpected end of input\" \/>\n<meta property=\"og:description\" content=\"Learn how to deal with an &quot;Unexpected End of Input&quot; error in JavaScript in this article by Career Karma.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-28T05:12:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-28T05:12:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/brett-jordan-gz-fIvZEgKQ-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1020\" \/>\n\t<meta property=\"og:image:height\" content=\"765\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Christina Kopecky\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christina Kopecky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/\"},\"author\":{\"name\":\"Christina Kopecky\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/ae0cdc4a5d198690d78482646894074e\"},\"headline\":\"Error: Unexpected end of input\",\"datePublished\":\"2020-09-28T05:12:16+00:00\",\"dateModified\":\"2020-09-28T05:12:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/\"},\"wordCount\":310,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/brett-jordan-gz-fIvZEgKQ-unsplash.jpg\",\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/\",\"name\":\"Error: Unexpected End of Input | Career Karma\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/brett-jordan-gz-fIvZEgKQ-unsplash.jpg\",\"datePublished\":\"2020-09-28T05:12:16+00:00\",\"dateModified\":\"2020-09-28T05:12:18+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/ae0cdc4a5d198690d78482646894074e\"},\"description\":\"Learn how to deal with an \\\"Unexpected End of Input\\\" error in JavaScript in this article by Career Karma.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/#primaryimage\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/brett-jordan-gz-fIvZEgKQ-unsplash.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/09\\\/brett-jordan-gz-fIvZEgKQ-unsplash.jpg\",\"width\":1020,\"height\":765,\"caption\":\"Scrabble Letters Form Sentence Containing Errors\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/error-unexpected-end-of-input\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/javascript\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Error: Unexpected end of input\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/#\\\/schema\\\/person\\\/ae0cdc4a5d198690d78482646894074e\",\"name\":\"Christina Kopecky\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/image-3-150x150.jpg\",\"caption\":\"Christina Kopecky\"},\"description\":\"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.\",\"sameAs\":[\"http:\\\/\\\/www.linkedin.com\\\/in\\\/cmvnk\"],\"url\":\"https:\\\/\\\/careerkarma.com\\\/blog\\\/author\\\/christina-kopecky\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Error: Unexpected End of Input | Career Karma","description":"Learn how to deal with an \"Unexpected End of Input\" error in JavaScript in this article by Career Karma.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/","og_locale":"en_US","og_type":"article","og_title":"Error: Unexpected end of input","og_description":"Learn how to deal with an \"Unexpected End of Input\" error in JavaScript in this article by Career Karma.","og_url":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-09-28T05:12:16+00:00","article_modified_time":"2020-09-28T05:12:18+00:00","og_image":[{"width":1020,"height":765,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/brett-jordan-gz-fIvZEgKQ-unsplash.jpg","type":"image\/jpeg"}],"author":"Christina Kopecky","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"Christina Kopecky","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/"},"author":{"name":"Christina Kopecky","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"headline":"Error: Unexpected end of input","datePublished":"2020-09-28T05:12:16+00:00","dateModified":"2020-09-28T05:12:18+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/"},"wordCount":310,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/brett-jordan-gz-fIvZEgKQ-unsplash.jpg","articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/","url":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/","name":"Error: Unexpected End of Input | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/brett-jordan-gz-fIvZEgKQ-unsplash.jpg","datePublished":"2020-09-28T05:12:16+00:00","dateModified":"2020-09-28T05:12:18+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e"},"description":"Learn how to deal with an \"Unexpected End of Input\" error in JavaScript in this article by Career Karma.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/brett-jordan-gz-fIvZEgKQ-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/09\/brett-jordan-gz-fIvZEgKQ-unsplash.jpg","width":1020,"height":765,"caption":"Scrabble Letters Form Sentence Containing Errors"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/error-unexpected-end-of-input\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/careerkarma.com\/blog\/javascript\/"},{"@type":"ListItem","position":3,"name":"Error: Unexpected end of input"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/ae0cdc4a5d198690d78482646894074e","name":"Christina Kopecky","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/06\/image-3-150x150.jpg","caption":"Christina Kopecky"},"description":"Christina is an experienced technical writer, covering topics as diverse as Java, SQL, Python, and web development. She earned her Master of Music in flute performance from the University of Kansas and a bachelor's degree in music with minors in French and mass communication from Southeast Missouri State. Prior to joining the Career Karma team in June 2020, Christina was a teaching assistant, team lead, and section lead at Lambda School, where she led student groups, performed code and project reviews, and debugged problems for students. Christina's technical content is featured frequently in publications like Codecademy, Repl.it, and Educative.","sameAs":["http:\/\/www.linkedin.com\/in\/cmvnk"],"url":"https:\/\/careerkarma.com\/blog\/author\/christina-kopecky\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/23291","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=23291"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/23291\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/23292"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=23291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=23291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=23291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}